本文整理汇总了C++中TiXmlAttributeA::Next方法的典型用法代码示例。如果您正苦于以下问题:C++ TiXmlAttributeA::Next方法的具体用法?C++ TiXmlAttributeA::Next怎么用?C++ TiXmlAttributeA::Next使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TiXmlAttributeA
的用法示例。
在下文中一共展示了TiXmlAttributeA::Next方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: StreamOut
void TiXmlElementA::StreamOut( TIXMLA_OSTREAM * stream ) const
{
(*stream) << "<" << value;
TiXmlAttributeA* attrib;
for ( attrib = attributeSet.First(); attrib; attrib = attrib->Next() )
{
(*stream) << " ";
attrib->StreamOut( stream );
}
// If this node has children, give it a closing tag. Else
// make it an empty tag.
TiXmlNodeA* node;
if ( firstChild )
{
(*stream) << ">";
for ( node = firstChild; node; node=node->NextSibling() )
{
node->StreamOut( stream );
}
(*stream) << "</" << value << ">";
}
else
{
(*stream) << " />";
}
}
示例2: Print
void TiXmlElementA::Print( FILE* cfile, int depth ) const
{
int i;
for ( i=0; i<depth; i++ )
{
fprintf( cfile, " " );
}
fprintf( cfile, "<%s", value.c_str() );
TiXmlAttributeA* attrib;
for ( attrib = attributeSet.First(); attrib; attrib = attrib->Next() )
{
fprintf( cfile, " " );
attrib->Print( cfile, depth );
}
// There are 3 different formatting approaches:
// 1) An element without children is printed as a <foo /> node
// 2) An element with only a text child is printed as <foo> text </foo>
// 3) An element with children is printed on multiple lines.
TiXmlNodeA* node;
if ( !firstChild )
{
fprintf( cfile, " />" );
}
else if ( firstChild == lastChild && firstChild->ToText() )
{
fprintf( cfile, ">" );
firstChild->Print( cfile, depth + 1 );
fprintf( cfile, "</%s>", value.c_str() );
}
else
{
fprintf( cfile, ">" );
for ( node = firstChild; node; node=node->NextSibling() )
{
if ( !node->ToText() )
{
fprintf( cfile, "\n" );
}
node->Print( cfile, depth+1 );
}
fprintf( cfile, "\n" );
for( i=0; i<depth; ++i )
fprintf( cfile, " " );
fprintf( cfile, "</%s>", value.c_str() );
}
}
示例3: Clone
TiXmlNodeA* TiXmlElementA::Clone() const
{
TiXmlElementA* clone = new TiXmlElementA( Value() );
if ( !clone )
return 0;
CopyToClone( clone );
// Clone the attributes, then clone the children.
for(TiXmlAttributeA* attribute = attributeSet.First();
attribute;
attribute = attribute->Next() )
{
clone->SetAttribute( attribute->Name(), attribute->Value() );
}
for ( TiXmlNodeA* node = firstChild; node; node = node->NextSibling() )
{
clone->LinkEndChild( node->Clone() );
}
return clone;
}