本文整理汇总了C++中Tag::findChildWithAttrib方法的典型用法代码示例。如果您正苦于以下问题:C++ Tag::findChildWithAttrib方法的具体用法?C++ Tag::findChildWithAttrib怎么用?C++ Tag::findChildWithAttrib使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tag
的用法示例。
在下文中一共展示了Tag::findChildWithAttrib方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setResource
void ResourceManager::setResource(const Presence &stanza) {
std::string resource = stanza.from().resource();
if (resource.empty())
return;
Tag *stanzaTag = stanza.tag();
Tag *c = stanzaTag->findChildWithAttrib("xmlns", "http://jabber.org/protocol/caps");
int caps = -1;
// presence has caps
if (c != NULL) {
caps = Transport::instance()->getCapabilities(c->findAttribute("ver"));
}
setResource(resource, stanza.priority(), caps, (int) stanza.presence(), stanza.status());
delete stanzaTag;
}
示例2: Tag
AdhocTag::AdhocTag(const IQ &stanza) : Tag("command") {
m_from = stanza.from().full();
m_id = stanza.id();
xdata = NULL;
Tag *iq = stanza.tag();
Tag *command = iq->findChild("command");
if (command) {
const Tag::AttributeList & attributes = command->attributes();
for (Tag::AttributeList::const_iterator it = attributes.begin(); it != attributes.end(); it++) {
addAttribute(std::string((*it)->name()), std::string((*it)->value()));
}
Tag *x = command->findChildWithAttrib("xmlns","jabber:x:data");
if (x) {
xdata = x->clone();
addChild(xdata);
}
}
delete iq;
}
示例3: main
//.........这里部分代码省略.........
{
++fail;
fprintf( stderr, "test '%s' failed: %s\n", name.c_str(), t->xml().c_str() );
}
//-------
name = "findChild 1";
c = t->findChild( "uni" );
if( c != u )
{
++fail;
fprintf( stderr, "test '%s' failed: %s\n", name.c_str(), t->xml().c_str() );
}
//-------
name = "findChild 2";
c = t->findChild( "uni", "u3" );
if( c != u )
{
++fail;
fprintf( stderr, "test '%s' failed: %s\n", name.c_str(), t->xml().c_str() );
}
//-------
name = "findChild 3";
c = t->findChild( "uni", "u3", "3u" );
if( c != u )
{
++fail;
fprintf( stderr, "test '%s' failed: %s\n", name.c_str(), t->xml().c_str() );
}
//-------
name = "findChildWithAttrib 1";
c = t->findChildWithAttrib( "u3" );
if( c != u )
{
++fail;
fprintf( stderr, "test '%s' failed: %s\n", name.c_str(), t->xml().c_str() );
}
//-------
name = "findChildWithAttrib 2";
c = t->findChildWithAttrib( "u3", "3u" );
if( c != u )
{
++fail;
fprintf( stderr, "test '%s' failed: %s\n", name.c_str(), t->xml().c_str() );
}
//-------
name = "attribute order";
c = new Tag( "abc" );
c->addAttribute( "abc", "def" );
c->addAttribute( "xyz", "123" );
d = c->clone();
if( *c != *d )
{
++fail;
fprintf( stderr, "test '%s' failed: %s\n", name.c_str(), d->xml().c_str() );
}
delete c;
c = 0;
delete d;
d = 0;