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


C++ TiXmlElement::LastChild方法代码示例

本文整理汇总了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;
}
开发者ID:Joooo,项目名称:pseudoform,代码行数:35,代码来源:tinyxml.cpp

示例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;
}
开发者ID:blastak,项目名称:avat,代码行数:54,代码来源:AdvancedAnnotator.cpp

示例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" );
开发者ID:huntriver,项目名称:TankVSBugs-CSE380-,代码行数:67,代码来源:xmltest.cpp

示例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" );
开发者ID:bsmr-worldforge,项目名称:libwfut,代码行数:67,代码来源:xmltest.cpp

示例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" );
开发者ID:E-LLP,项目名称:europa,代码行数:67,代码来源:xmltest.cpp


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