当前位置: 首页>>代码示例>>C++>>正文


C++ TElement::Init方法代码示例

本文整理汇总了C++中TElement::Init方法的典型用法代码示例。如果您正苦于以下问题:C++ TElement::Init方法的具体用法?C++ TElement::Init怎么用?C++ TElement::Init使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TElement的用法示例。


在下文中一共展示了TElement::Init方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: AddEquivalence


//.........这里部分代码省略.........
	num2 = FindDOF (node2, isb2, ise2);
	// printf ("Scheme:1.3. num2=%d\n",num2);
	
	isBase = isb1 || isb2 || isbn1 || isbn2;
	isExt = ise1 || ise2 || isen1 || isen2;

	// printf ("Scheme:2\n");
	

	if (num1==-1 && num2 == -1)
	{

		TElement var (EqvList.Add());
		
		// printf ("Scheme:3\n");
		
		TList doflist;
		var.AddElement(doflist);
		doflist.SetName ("doflist");

		// printf ("Scheme:4\n");
		
		
		TString n1 (doflist.Add());
		TString n2 (doflist.Add());
		n1.SetValue (node1);
		n2.SetValue (node2);

		// printf ("Scheme:5\n");


		TInteger base;
		var.AddElement(base);
		base.SetName ("isBase");
		base.SetValue (isBase);

		TInteger ext;
		var.AddElement(ext);
		ext.SetName ("isExt");
		ext.SetValue (isExt);


	}else
	if (num1==-1)
	{
		TElement el (EqvList.GetAt(num2));
		TList doflist (el.GetField ("doflist", isOK));
		TInteger isb (el.GetField ("isBase", isOK));
		TInteger ise (el.GetField ("isExt", isOK));

		isb.SetValue (isBase);
		ise.SetValue (isExt);
		
		TString n1 (doflist.Add());
		n1.SetValue (node1);

	}else
	if (num2==-1)
	{
		TElement el (EqvList.GetAt(num1));
		TList doflist (el.GetField ("doflist", isOK));
		TInteger isb (el.GetField ("isBase", isOK));
		TInteger ise (el.GetField ("isExt", isOK));

		isb.SetValue (isBase);
		ise.SetValue (isExt);

		TString n2 (doflist.Add());
		n2.SetValue (node2);
	}else
	if (num1 != num2)
	{
		TElement el (EqvList.GetAt(num1));
		TList doflist1 (el.GetField ("doflist", isOK));
		TInteger isb (el.GetField ("isBase", isOK));
		TInteger ise (el.GetField ("isExt", isOK));

		isb.SetValue (isBase);
		ise.SetValue (isExt);

		el.Init (EqvList.GetAt(num2));
		TList doflist2 (el.GetField ("doflist", isOK));
		
//		TList doflist2 (EqvList.GetAt(num2));
		TIterator it (doflist2.GetIterator());
		
		while (it.More())
		{
			TString n1 (it.Value());
			QString value = n1.GetValue();
			TString n2 (doflist1.Add());
			n2.SetValue (value);
			
			it.Next();
		}
		EqvList.RemoveVar (el);
	}
	
	return;
}
开发者ID:laduga,项目名称:pradis,代码行数:101,代码来源:Scheme.cpp

示例2: LoadOldBaseMaterial

void LoadOldBaseMaterial(AnsiString aFileName, TTreeView *aTreeView)
{

    ifstream infile(aFileName.c_str());

    char   buf[250];
 /// ----------------
    TTemp       CompareArray[1900];
    TTreeNode  *aParentNode = NULL;
    int         CurrentIndex = 0;
 /// ----------------

//    bool flag = false;
    bool fl1 = false;
    bool fl2 = false;
    bool fl3 = false;
//    bool fl4 = false;
//    bool fl5 = false;
//    bool fl6 = false;

      ShortString  Artikul;
      ShortString  Name;
      double       price;
//      ShortString  id;
      ShortString  Dim;

  // ---- Запалняю Триивью ----------
  TTreeNode *Node;
  aTreeView->Items->BeginUpdate();

      while (infile >> buf){
                   if (!fl1) {Artikul = buf; fl1 = true;}
             else  if (!fl2) {Name = buf; fl2 = true;}
             else  if (!fl3) {price = StrToFloat(buf); fl3 = true;}
             else  {/*if (!fl4) {fl4 = true;}
             else  if (!fl5) {fl5 = true;}
             else  if (!fl6) {fl6 = true;}
             else  { */
                     fl1 = false; fl2 = false; fl3 = false; //fl4 = false; fl5 = false; fl6 = false;
                     Dim = buf;


                 // ------------   Составляем массив из повторяющихся елементов (3 штуки) -----------
                     aParentNode = NULL;
                     bool aPresent = false;
                     for (int cc = 0; cc < CurrentIndex; cc++) {
                             if (CompareArray[cc].as[1] == Name[1] && CompareArray[cc].as[2] == Name[2] && CompareArray[cc].as[3] == Name[3]) {
                                 aPresent = true;
                                 aParentNode  = CompareArray[cc].Node;
                                 break;
                             }
                     }

                 // ------- Если нету тогда создаем новый родительский узел ---------------------
                     if (!aPresent) {
                           TElement  *Element = (TElement*) malloc (sizeof(TElement));  Element->Init();

                           Element->Id = ++GlobalMaterialCounter;
                           Element->ParentId = -1;
                           Element->Level    = 0;

                           CompareArray[CurrentIndex].as   = Name;
                           CompareArray[CurrentIndex].as.SetLength(3);
                           Element->Name                = CompareArray[CurrentIndex].as;

                           Node = aTreeView->Items->AddObject(NULL,CompareArray[CurrentIndex].as, Element);

                           CompareArray[CurrentIndex].Node = Node;
                           aParentNode = Node;

                           CurrentIndex ++;
                     }
                  // ------------

                     TElement  *Element = (TElement*) malloc (sizeof(TElement));  Element->Init();

                     for (int i = 1; i <= int(Name   [0]); i++) if (Name   [i] == '_') Name   [i] = ' ';
                     for (int i = 1; i <= int(Dim    [0]); i++) if (Dim    [i] == '_') Dim    [i] = ' ';
                     for (int i = 1; i <= int(Artikul[0]); i++) if (Artikul[i] == '_') Artikul[i] = ' ';


                     Element->GlobalElementId = ++GlobalElementID;
                     Element->Id = ++GlobalMaterialCounter;
                     Element->ParentId = (aParentNode == NULL) ? -1 : ((TElement*)aParentNode->Data)->Id;
                     Element->Level    = (aParentNode == NULL) ?  0 : 1;
                     Element->Type = etMaterial;
                     Element->Name = Name;
                     Element->Data.Price = price;
                     Element->Data.Dimension = Dim;
                     Element->Data.CatalogNumber = Artikul;

                     Node = aTreeView->Items->AddChildObject(aParentNode,Element->Name, Element);
                     Node->SelectedIndex = (aParentNode == NULL) ?  0 : 2;
                     Node->ImageIndex    = (aParentNode == NULL) ?  0 : 2;
                     Node->StateIndex    = (aParentNode == NULL) ?  0 : 2;
             }
        }

  aTreeView->Items->EndUpdate();
}
开发者ID:Medcheg,项目名称:sources_old,代码行数:100,代码来源:mpiLibrary.cpp


注:本文中的TElement::Init方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。