本文整理汇总了C++中TElement类的典型用法代码示例。如果您正苦于以下问题:C++ TElement类的具体用法?C++ TElement怎么用?C++ TElement使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TElement类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: NoLabelInicialisationException
QString Include::GetFile()
{
if(Root.IsNull())
{
throw NoLabelInicialisationException("Include: label do not inicialised.");
}
if(Root.IsNull())
{
throw NoLabelInicialisationException("Include: label do not inicialised.");
}
TIterator TITER;
TITER.Init(Root, false);
while (TITER.More())
{
TElement val = TITER.Value();
QString name = val.GetName();
if(name == "File name")
{
TString valint = (TString)val;
return valint.GetValue();
}
TITER.Next();
}
return "";
}
示例2: NoLabelInicialisationException
int Scheme::FindDOF(QString name, bool& isBase, bool &isExt)
{
if(Root.IsNull())
{
throw NoLabelInicialisationException("Scheme: label do not inicialised.");
}
// printf ("Scheme:10\n");
GetEqvList();
TIterator eqv = EqvList.GetIterator();
// printf ("Scheme:11\n");
int num = 1;
while (eqv.More())
{
bool isOK;
// printf ("Scheme:------12\n");
TElement el (eqv.Value());
TList B (el.GetField ("doflist", isOK));
TInteger isb (el.GetField ("isBase", isOK));
TInteger ise (el.GetField ("isExt", isOK));
// if (isOK) printf ("Scheme:13 OK OK OK\n");
TIterator dofit = B.GetIterator();
// printf ("Scheme:14\n");
while (dofit.More())
{
TString dof (dofit.Value());
if (name == dof.GetValue())
{
isBase = (isb.GetValue()!=0);
isExt = (ise.GetValue()!=0);
return num;
}
dofit.Next();
}
eqv.Next();
num++;
}
return -1;
}
示例3: main
int main()
{
ifstream input1 ( "input1.txt" );
ifstream input2 ( "input2.txt" );
freopen ( "output.txt", "w", stdout );
string s1, s2;
getline( input1, s1, '\0' );
getline( input2, s2, '\0' );
TElement elem ( s1, s2 );
elem.a_star();
input1.close();
input2.close();
fclose (stdout);
return 0;
}
示例4: NoLabelInicialisationException
QString TData::GetDescription()
{
if(Root.IsNull())
{
throw NoLabelInicialisationException("TData: label do not inicialised.");
}
TIterator TITER;
TITER.Init(Root, false);
while (TITER.More())
{
TElement val = TITER.Value();
QString name = val.GetName();
if(name == "Description")
{
TString valstr = (TString)val;
return valstr.GetValue();
}
TITER.Next();
}
return "";
}
示例5: NoLabelInicialisationException
double DOF1::GetValue()
{
if(Root.IsNull())
{
throw NoLabelInicialisationException("DOF1: label do not inicialised.");
}
TIterator TITER;
TITER.Init(Root, false);
while (TITER.More())
{
TElement val = TITER.Value();
QString name = val.GetName();
if(name == "Value")
{
TReal valreal = (TReal)val;
return valreal.GetValue();
}
TITER.Next();
}
return 0.;
}
示例6: CheckElement
void CheckElement(TElement const & em)
{
if (em.type != TElement::EntityType::Node)
return;
uint64_t population = 1;
bool town = false;
bool capital = false;
int admin_level = numeric_limits<int>::max();
for (auto const & tag : em.Tags())
{
string key(tag.key), value(tag.value);
if (key == "population")
{
if (!strings::to_uint64(value, population))
continue;
}
else if (key == "admin_level")
{
if (!strings::to_int(value, admin_level))
continue;
}
else if (key == "capital" && value == "yes")
{
capital = true;
}
else if (key == "place" && (value == "city" || value == "town"))
{
town = true;
}
}
// Ignore regional capitals.
if (capital && admin_level > 2)
capital = false;
if (town || capital)
m_records.emplace_back(em.lat, em.lon, em.id, capital, population);
}
示例7: __releaseElt
static Sxmlelement __releaseElt (TElement elt) { Sxmlelement xml(elt); elt->removeReference(); return xml; }
示例8:
//------------------------------------------------------------------------
EXP void factoryFreeElement (TFactory f, TElement elt) { elt->removeReference(); }
示例9: GetEqvList
void Scheme::AddEquivalence (DOF1 nnode1, DOF1 nnode2)
{
int num1, num2;
bool isb1, isb2, ise1, ise2;
QString node1, node2;
bool isbn1, isbn2, isen1, isen2;
bool isBase, isExt;
bool isOK;
GetEqvList();
node1 = nnode1.GetObjectName();
node2 = nnode2.GetObjectName();
// printf ("Scheme:1 %s, %s\n", node1.toAscii().data(), node2.toAscii().data());
isbn1 = nnode1.GetBase();
isbn2 = nnode2.GetBase();
isen1 = nnode1.GetExternal();
isen2 = nnode2.GetExternal();
// printf ("Scheme:1.1 isen1=%d isen2=%d\n", isen1, isen2);
isb1=ise1=isb2=ise2 = false;
num1 = FindDOF (node1, isb1, ise1);
// printf ("Scheme:1.2. num1=%d\n",num1);
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)
//.........这里部分代码省略.........
示例10: 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();
}