本文整理汇总了C++中Tag::findChildren方法的典型用法代码示例。如果您正苦于以下问题:C++ Tag::findChildren方法的具体用法?C++ Tag::findChildren怎么用?C++ Tag::findChildren使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tag
的用法示例。
在下文中一共展示了Tag::findChildren方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
//.........这里部分代码省略.........
c->addChild( new Tag( "hello" ) );
d = new Tag( "hello" );
d->addAttribute( "test", "bacd" );
d->addChild( new Tag( "helloo" ) );
if( *d == *c )
{
++fail;
fprintf( stderr, "test '%s' failed\n", name.c_str() );
}
delete c;
delete d;
c = 0;
d = 0;
//-------
name = "operator!= test 1";
c = new Tag( "hello" );
c->addAttribute( "test", "bacd" );
c->addChild( new Tag( "hello" ) );
d = new Tag( "hello" );
d->addAttribute( "test", "bacd" );
d->addChild( new Tag( "hello" ) );
if( *d != *c )
{
++fail;
fprintf( stderr, "test '%s' failed\n", name.c_str() );
}
delete c;
delete d;
c = 0;
d = 0;
//-------
name = "findChildren test";
TagList l = t->findChildren( "vie" );
TagList::const_iterator it = l.begin();
if( l.size() != 2 || (*it) != v || *(++it) != v2 )
{
++fail;
fprintf( stderr, "test '%s' failed\n", name.c_str() );
}
delete c;
c = 0;
//-------
name = "util::escape";
if ( util::escape( "&<>'\"" ) != "&<>'"" )
{
++fail;
fprintf( stderr, "test '%s' failed\n", name.c_str() );
}
//-------
name = "xml() 1";
if( t->xml() != "<toe foo='bar'><uni u3='3u'><who w3='3w'><zoo z3='3z'/></who><yps y3='3y'/>"
"</uni><vie v3='3v' v32='3v2'><xep x3='3x'/></vie><vie/></toe>" )
{
++fail;
fprintf( stderr, "test '%s' failed: %s\n", name.c_str(), t->xml().c_str() );
}
//-------
name = "xml() 2";
t->addAttribute( "test", "bacd" );
if( t->xml() != "<toe foo='bar' test='bacd'><uni u3='3u'><who w3='3w'><zoo z3='3z'/></who><yps y3='3y'/>"
"</uni><vie v3='3v' v32='3v2'><xep x3='3x'/></vie><vie/></toe>" )