本文整理汇总了C++中TiXmlElement::LastChild方法的典型用法代码示例。如果您正苦于以下问题:C++ TiXmlElement::LastChild方法的具体用法?C++ TiXmlElement::LastChild怎么用?C++ TiXmlElement::LastChild使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TiXmlElement
的用法示例。
在下文中一共展示了TiXmlElement::LastChild方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: VisitEnter
bool TiXmlPrinter::VisitEnter( const TiXmlElement& element, const TiXmlAttribute* firstAttribute )
{
DoIndent();
buffer += "<";
buffer += element.Value();
for( const TiXmlAttribute* attrib = firstAttribute; attrib; attrib = attrib->Next() )
{
buffer += " ";
attrib->Print( 0, 0, &buffer );
}
if ( !element.FirstChild() )
{
buffer += " />";
DoLineBreak();
}
else
{
buffer += ">";
if ( element.FirstChild()->ToText()
&& element.LastChild() == element.FirstChild()
&& element.FirstChild()->ToText()->CDATA() == false )
{
simpleTextPrint = true;
// no DoLineBreak()!
}
else
{
DoLineBreak();
}
}
++depth;
return true;
}
示例2: ApplyNewObjectToXml
void CAdvancedAnnotator::ApplyNewObjectToXml(const int knIdx)
{
const int knFrame = m_nCurrFrame;
TiXmlElement* elemFrame = m_pXMLFrameInfo->FirstChildElement("Frame");
bool bFrameExist = false;
for(elemFrame; elemFrame; elemFrame = elemFrame->NextSiblingElement())
{
int nFrameXML = -1;
elemFrame->Attribute("Number",&nFrameXML);
if(nFrameXML >= knFrame)
{
bFrameExist = (nFrameXML == knFrame); //T:존재, F:지나감
break;
}
}
int nSetId = 0;
if (!elemFrame) // 한개도 없을 때
{
elemFrame = new TiXmlElement("Frame");
m_pXMLFrameInfo->LinkEndChild(elemFrame);
elemFrame->SetAttribute("Number", knFrame);
}
else if(!bFrameExist) // 지나갔을 때
{
TiXmlElement elemNewFrame("Frame");
elemNewFrame.SetAttribute("Number", knFrame);
elemFrame = (TiXmlElement*)(m_pXMLFrameInfo->InsertBeforeChild(elemFrame, elemNewFrame));
}
else
{
TiXmlElement* tempObject = elemFrame->LastChild("Object")->ToElement();
if(tempObject) tempObject->Attribute("Id",&nSetId);
++nSetId;
}
m_mapGT[m_nCurrFrame][knIdx].Id = nSetId;
TiXmlElement* elemObject = new TiXmlElement("Object");
elemFrame->LinkEndChild(elemObject);
elemObject->SetAttribute("Id", nSetId);
elemObject->SetAttribute("Uid", -1);
elemObject->SetAttribute("Type", m_mapGT[m_nCurrFrame][knIdx].strObjType.c_str());
elemObject->SetAttribute("Class", m_mapGT[m_nCurrFrame][knIdx].strObjClass.c_str());
elemObject->SetAttribute("SubClass", m_mapGT[m_nCurrFrame][knIdx].strObjSubClass.c_str());
elemObject->SetAttribute("x", m_mapGT[m_nCurrFrame][knIdx].rectROI.x);
elemObject->SetAttribute("y", m_mapGT[m_nCurrFrame][knIdx].rectROI.y);
elemObject->SetAttribute("w", m_mapGT[m_nCurrFrame][knIdx].rectROI.width);
elemObject->SetAttribute("h", m_mapGT[m_nCurrFrame][knIdx].rectROI.height);
m_mapGT[m_nCurrFrame][knIdx].eCondition = CGroundTruth::GT_SAVE;
}
示例3: main
//.........这里部分代码省略.........
outputStream.str().c_str(), true );
#endif
node = doc.RootElement();
assert( node );
XmlTest( "Root element exists.", true, ( node != 0 && node->ToElement() ) );
XmlTest ( "Root element value is 'ToDo'.", "ToDo", node->Value());
node = node->FirstChild();
XmlTest( "First child exists & is a comment.", true, ( node != 0 && node->ToComment() ) );
node = node->NextSibling();
XmlTest( "Sibling element exists & is an element.", true, ( node != 0 && node->ToElement() ) );
XmlTest ( "Value is 'Item'.", "Item", node->Value() );
node = node->FirstChild();
XmlTest ( "First child exists.", true, ( node != 0 && node->ToText() ) );
XmlTest ( "Value is 'Go to the'.", "Go to the", node->Value() );
//////////////////////////////////////////////////////
printf ("\n** Iterators. **\n");
// Walk all the top level nodes of the document.
count = 0;
for( node = doc.FirstChild();
node;
node = node->NextSibling() )
{
count++;
}
XmlTest( "Top level nodes, using First / Next.", 3, count );
count = 0;
for( node = doc.LastChild();
node;
node = node->PreviousSibling() )
{
count++;
}
XmlTest( "Top level nodes, using Last / Previous.", 3, count );
// Walk all the top level nodes of the document,
// using a different syntax.
count = 0;
for( node = doc.IterateChildren( 0 );
node;
node = doc.IterateChildren( node ) )
{
count++;
}
XmlTest( "Top level nodes, using IterateChildren.", 3, count );
// Walk all the elements in a node.
count = 0;
for( element = todoElement->FirstChildElement();
element;
element = element->NextSiblingElement() )
{
count++;
}
XmlTest( "Children of the 'ToDo' element, using First / Next.",
3, count );
// Walk all the elements in a node by value.
count = 0;
for( node = todoElement->FirstChild( "Item" );
示例4: main
//.........这里部分代码省略.........
XmlTest( "Output stream correct.", string( demoEnd ).c_str(),
outputStream.str().c_str(), true );
#endif
node = doc.RootElement();
XmlTest( "Root element exists.", true, ( node != 0 && node->ToElement() ) );
XmlTest ( "Root element value is 'ToDo'.", "ToDo", node->Value());
node = node->FirstChild();
XmlTest( "First child exists & is a comment.", true, ( node != 0 && node->ToComment() ) );
node = node->NextSibling();
XmlTest( "Sibling element exists & is an element.", true, ( node != 0 && node->ToElement() ) );
XmlTest ( "Value is 'Item'.", "Item", node->Value() );
node = node->FirstChild();
XmlTest ( "First child exists.", true, ( node != 0 && node->ToText() ) );
XmlTest ( "Value is 'Go to the'.", "Go to the", node->Value() );
//////////////////////////////////////////////////////
printf ("\n** Iterators. **\n");
// Walk all the top level nodes of the document.
count = 0;
for( node = doc.FirstChild();
node;
node = node->NextSibling() )
{
count++;
}
XmlTest( "Top level nodes, using First / Next.", 3, count );
count = 0;
for( node = doc.LastChild();
node;
node = node->PreviousSibling() )
{
count++;
}
XmlTest( "Top level nodes, using Last / Previous.", 3, count );
// Walk all the top level nodes of the document,
// using a different sytax.
count = 0;
for( node = doc.IterateChildren( 0 );
node;
node = doc.IterateChildren( node ) )
{
count++;
}
XmlTest( "Top level nodes, using IterateChildren.", 3, count );
// Walk all the elements in a node.
count = 0;
for( element = todoElement->FirstChildElement();
element;
element = element->NextSiblingElement() )
{
count++;
}
XmlTest( "Children of the 'ToDo' element, using First / Next.",
3, count );
// Walk all the elements in a node by value.
count = 0;
for( node = todoElement->FirstChild( "Item" );
示例5: main
//.........这里部分代码省略.........
XmlTest( "Output stream correct.", string( demoEnd ).c_str(),
outputStream.str().c_str(), true );
#endif
node = doc.RootElement();
XmlTest( "Root element exists.", true, ( node != 0 && node->ToElement() ) );
XmlTest ( "Root element value is 'ToDo'.", "ToDo", node->Value());
node = node->FirstChild();
XmlTest( "First child exists & is a comment.", true, ( node != 0 && node->ToComment() ) );
node = node->NextSibling();
XmlTest( "Sibling element exists & is an element.", true, ( node != 0 && node->ToElement() ) );
XmlTest ( "Value is 'Item'.", "Item", node->Value() );
node = node->FirstChild();
XmlTest ( "First child exists.", true, ( node != 0 && node->ToText() ) );
XmlTest ( "Value is 'Go to the'.", "Go to the", node->Value() );
//////////////////////////////////////////////////////
printf ("\n** Iterators. **\n");
// Walk all the top level nodes of the document.
count = 0;
for( node = doc.FirstChild();
node;
node = node->NextSibling() )
{
count++;
}
XmlTest( "Top level nodes, using First / Next.", 3, count );
count = 0;
for( node = doc.LastChild();
node;
node = node->PreviousSibling() )
{
count++;
}
XmlTest( "Top level nodes, using Last / Previous.", 3, count );
// Walk all the top level nodes of the document,
// using a different sytax.
count = 0;
for( node = doc.IterateChildren( 0 );
node;
node = doc.IterateChildren( node ) )
{
count++;
}
XmlTest( "Top level nodes, using IterateChildren.", 3, count );
// Walk all the elements in a node.
count = 0;
for( element = todoElement->FirstChildElement();
element;
element = element->NextSiblingElement() )
{
count++;
}
XmlTest( "Children of the 'ToDo' element, using First / Next.",
3, count );
// Walk all the elements in a node by value.
count = 0;
for( node = todoElement->FirstChild( "Item" );