本文整理汇总了C++中Tag::addChildCopy方法的典型用法代码示例。如果您正苦于以下问题:C++ Tag::addChildCopy方法的具体用法?C++ Tag::addChildCopy怎么用?C++ Tag::addChildCopy使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tag
的用法示例。
在下文中一共展示了Tag::addChildCopy方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Tag
Tag* SIManager::SI::tag() const
{
if( !m_valid )
return 0;
Tag* t = new Tag( "si" );
t->setXmlns( XMLNS_SI );
if( !m_id.empty() )
t->addAttribute( "id", m_id );
if( !m_mimetype.empty() )
t->addAttribute( "mime-type", m_mimetype.empty() ? "binary/octet-stream" : m_mimetype );
if( !m_profile.empty() )
t->addAttribute( "profile", m_profile );
if( m_tag1 )
t->addChildCopy( m_tag1 );
if( m_tag2 )
t->addChildCopy( m_tag2 );
return t;
}
示例2: tag
Tag* Event::tag() const
{
if( !m_valid )
return 0;
Tag* event = new Tag( "event", XMLNS, XMLNS_PUBSUB_EVENT );
Tag* child = new Tag( event, util::lookup( m_type, eventTypeValues ) );
Tag* item = 0;
switch( m_type )
{
case PubSub::EventCollection:
{
item = new Tag( child, "node", "id", m_node );
item->addChildCopy( m_config );
break;
}
case PubSub::EventPurge:
case PubSub::EventDelete:
case PubSub::EventConfigure:
child->addAttribute( "node", m_node );
if( m_type == PubSub::EventConfigure )
child->addChildCopy( m_config );
break;
case PubSub::EventItems:
case PubSub::EventItemsRetract:
{
child->addAttribute( "node", m_node );
if( m_itemOperations )
{
// Tag* item;
ItemOperation* op;
ItemOperationList::const_iterator itt = m_itemOperations->begin();
for( ; itt != m_itemOperations->end(); ++itt )
{
op = (*itt);
// item = new Tag( child, op->retract ? "retract" : "item", "id", op->item );
if( op->payload )
child->addChildCopy( op->payload );
}
}
break;
}
case EventSubscription:
{
child->addAttribute( "node", m_node );
child->addAttribute( "jid", m_jid.full() );
child->addAttribute( "subscription", m_subscription ? "subscribed" : "none" );
break;
}
default:
delete event;
return 0;
}
if( m_subscriptionIDs || !m_collection.empty() )
{
Tag* headers = new Tag( event, "headers", XMLNS, "http://jabber.org/protocol/shim" );
StringList::const_iterator it = m_subscriptionIDs->begin();
for( ; it != m_subscriptionIDs->end(); ++it )
{
(new Tag( headers, "header", "name", "pubsub#subid" ))->setCData( (*it) );
}
if( !m_collection.empty() )
(new Tag( headers, "header", "name", "pubsub#collection" ) )
->setCData( m_collection );
}
return event;
}