本文整理汇总了C++中Tag::addChild方法的典型用法代码示例。如果您正苦于以下问题:C++ Tag::addChild方法的具体用法?C++ Tag::addChild怎么用?C++ Tag::addChild使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tag
的用法示例。
在下文中一共展示了Tag::addChild方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: tagAuth_base
Tag* XmppGSAuth_base::tagAuth_base( bool hasmethod ) const
{
Tag *tAuth = new Tag( "authority" );
if( hasmethod )
{
tAuth->addAttribute( "method", m_srcmethod );
}
// ÏȼÓÈëÀ´±ö
defmapGSIOTUser::const_iterator it = GSIOTUserMgr::usermapFind( m_mapUser, XMPP_GSIOTUser_Guest );
if( it!=m_mapUser.end() )
{
GSIOTUser *pUser = it->second;
tAuth->addChild( pUser->tag(m_TagParam) );
}
for( defmapGSIOTUser::const_iterator it=m_mapUser.begin(); it!=m_mapUser.end(); ++it )
{
GSIOTUser *pUser = it->second;
if( GSIOTUserMgr::IsGuest(pUser) )
continue;
tAuth->addChild( pUser->tag(m_TagParam) );
}
return tAuth;
}
示例2: tag
Tag* DataForm::tag() const
{
if( m_type == TypeInvalid )
return 0;
Tag* x = new Tag( "x" );
x->setXmlns( XMLNS_X_DATA );
x->addAttribute( TYPE, util::lookup( m_type, dfTypeValues ) );
if( !m_title.empty() )
new Tag( x, "title", m_title );
StringList::const_iterator it_i = m_instructions.begin();
for( ; it_i != m_instructions.end(); ++it_i )
new Tag( x, "instructions", (*it_i) );
FieldList::const_iterator it = m_fields.begin();
for( ; it != m_fields.end(); ++it )
x->addChild( (*it)->tag() );
if( m_reported != NULL )
{
x->addChild( m_reported->tag() );
}
ItemList::const_iterator iti = m_items.begin();
for( ; iti != m_items.end(); ++iti )
x->addChild( (*iti)->tag() );
return x;
}
示例3: if
Tag* Search::Query::tag() const
{
Tag* t = new Tag( "query" );
t->setXmlns( XMLNS_SEARCH );
if( m_form )
t->addChild( m_form->tag() );
else if( m_fields )
{
if( !m_instructions.empty() )
new Tag( t, "instructions", m_instructions );
if( m_fields & SearchFieldFirst )
new Tag( t, "first", m_values.first() );
if( m_fields & SearchFieldLast )
new Tag( t, "last", m_values.last() );
if( m_fields & SearchFieldNick )
new Tag( t, "nick", m_values.nick() );
if( m_fields & SearchFieldEmail )
new Tag( t, "email", m_values.email() );
}
else if( !m_srl.empty() )
{
SearchResultList::const_iterator it = m_srl.begin();
for( ; it != m_srl.end(); ++it )
{
t->addChild( (*it)->tag() );
}
}
return t;
}
示例4: tag
Tag* XmppGSEvent::tag() const
{
Tag* i = new Tag( "gsiot" );
i->setXmlns( XMLNS_GSIOT_EVENT );
Tag *tmgr = new Tag( i,"event" );
tmgr->addAttribute( "method", m_srcmethod );
if( m_pDevice ) tmgr->addChild( m_pDevice->tag(m_TagParam) );
if( m_TagParam.isValid && m_TagParam.isResult )
{
;
}
else
{
new Tag( tmgr, "state", m_runstate?"1":"0" );
}
Tag *cdo = new Tag( tmgr, "do" );
for( std::list<ControlEvent*>::const_iterator it=m_Events.begin(); it!=m_Events.end(); ++it )
{
cdo->addChild( (*it)->tag(m_TagParam) );
}
return i;
}
示例5: Tag
Tag* Registration::Query::tag() const
{
Tag* t = new Tag( "query" );
t->setXmlns( XMLNS_REGISTER );
if( !m_instructions.empty() )
new Tag( t, "instructions", m_instructions );
if ( m_reg )
new Tag( t, "registered" );
if( m_form )
t->addChild( m_form->tag() );
else if( m_oob )
t->addChild( m_oob->tag() );
else if( m_del )
new Tag( t, "remove" );
else if( m_fields )
{
if( m_fields & FieldUsername )
new Tag( t, "username", m_values.username );
if( m_fields & FieldNick )
new Tag( t, "nick", m_values.nick );
if( m_fields & FieldPassword )
new Tag( t, "password", m_values.password );
if( m_fields & FieldName )
new Tag( t, "name", m_values.name );
if( m_fields & FieldFirst )
new Tag( t, "first", m_values.first );
if( m_fields & FieldLast )
new Tag( t, "last", m_values.last );
if( m_fields & FieldEmail )
new Tag( t, "email", m_values.email );
if( m_fields & FieldAddress )
new Tag( t, "address", m_values.address );
if( m_fields & FieldCity )
new Tag( t, "city", m_values.city );
if( m_fields & FieldState )
new Tag( t, "state", m_values.state );
if( m_fields & FieldZip )
new Tag( t, "zip", m_values.zip );
if( m_fields & FieldPhone )
new Tag( t, "phone", m_values.phone );
if( m_fields & FieldUrl )
new Tag( t, "url", m_values.url );
if( m_fields & FieldDate )
new Tag( t, "date", m_values.date );
if( m_fields & FieldMisc )
new Tag( t, "misc", m_values.misc );
if( m_fields & FieldText )
new Tag( t, "text", m_values.text );
}
return t;
}
示例6: sendXhtmlTag
static void sendXhtmlTag(Tag *body, void *data) {
Tag *stanzaTag = (Tag*) data;
if (body) {
Tag *html = new Tag("html");
html->addAttribute("xmlns", "http://jabber.org/protocol/xhtml-im");
body->addAttribute("xmlns", "http://www.w3.org/1999/xhtml");
html->addChild(body);
stanzaTag->addChild(html);
}
Transport::instance()->send(stanzaTag);
}
示例7: tag
Tag* DataForm::tag() const
{
if( m_type == FormTypeInvalid )
return 0;
Tag *x = new Tag( "x" );
x->addAttribute( "xmlns", XMLNS_X_DATA );
if( !m_title.empty() )
new Tag( x, "title", m_title );
StringList::const_iterator it_i = m_instructions.begin();
for( ; it_i != m_instructions.end(); ++it_i )
new Tag( x, "instructions", (*it_i) );
FieldList::const_iterator it = m_fields.begin();
for( ; it != m_fields.end(); ++it )
{
DataFormItem *i = dynamic_cast<DataFormItem*>( (*it) );
if( i )
{
x->addChild( i->tag() );
continue;
}
DataFormReported *r = dynamic_cast<DataFormReported*>( (*it) );
if( r )
{
x->addChild( r->tag() );
continue;
}
x->addChild( (*it)->tag() );
}
switch( m_type )
{
case FormTypeForm:
x->addAttribute( "type", "form" );
break;
case FormTypeSubmit:
x->addAttribute( "type", "submit" );
break;
case FormTypeCancel:
x->addAttribute( "type", "cancel" );
break;
case FormTypeResult:
x->addAttribute( "type", "result" );
break;
default:
break;
}
return x;
}
示例8: Tag
Tag* Adhoc::Command::tag() const
{
if( m_node.empty() )
return 0;
Tag* c = new Tag( "command" );
c->setXmlns( XMLNS_ADHOC_COMMANDS );
c->addAttribute( "node", m_node );
if( m_actions != 0 )
{
// Multi-stage command response
if( m_status != InvalidStatus )
c->addAttribute( "status", statusString( m_status ) );
else
c->addAttribute( "status", statusString( Executing ) );
Tag* actions = new Tag( c, "actions" );
if( m_action != InvalidAction )
c->addAttribute( "execute", actionString( m_action ) );
else
c->addAttribute( "execute", actionString( Complete ) );
if( ( m_actions & Previous ) == Previous )
new Tag( actions, "prev" );
if( ( m_actions & Next ) == Next )
new Tag( actions, "next" );
if( ( m_actions & Complete ) == Complete )
new Tag( actions, "complete" );
}
else
{
// Single-stage command request/response or Multi-stage command request
if( m_action != InvalidAction )
c->addAttribute( "action", actionString( m_action ) );
if( m_status != InvalidStatus )
c->addAttribute( "status", statusString( m_status ) );
}
if ( !m_sessionid.empty() )
c->addAttribute( "sessionid", m_sessionid );
if( m_plugin && *m_plugin )
c->addChild( m_plugin->tag() );
NoteList::const_iterator it = m_notes.begin();
for( ; it != m_notes.end(); ++it )
c->addChild( (*it)->tag() );
return c;
}
示例9: tag
Tag* Forward::tag() const
{
if( !m_stanza )
return 0;
Tag* f = new Tag( "forwarded" );
f->setXmlns( XMLNS_STANZA_FORWARDING );
if( m_delay )
f->addChild( m_delay->tag() );
if( m_stanza )
f->addChild( m_stanza->tag() );
return f;
}
示例10: addBoolean
void AdhocTag::addBoolean(const std::string &label, const std::string &var, bool value) {
if (xdata == NULL)
initXData();
Tag *field = new Tag("field");
field->addAttribute("type", "boolean");
field->addAttribute("label", label);
field->addAttribute("var", var);
if (value)
field->addChild(new Tag("value", "1"));
else
field->addChild(new Tag("value", "0"));
xdata->addChild(field);
}
示例11: addListSingle
void AdhocTag::addListSingle(const std::string &label, const std::string &var, std::list <std::string> &values) {
if (xdata == NULL)
initXData();
Tag *field = new Tag("field");
field->addAttribute("type", "list-single");
field->addAttribute("label", label);
field->addAttribute("var", var);
for (std::list<std::string>::iterator it = values.begin(); it != values.end(); it++) {
Tag *option = new Tag("option");
option->addChild( new Tag("value", *it) );
field->addChild(option);
}
xdata->addChild(field);
}
示例12: bare
ConfigHandler::ConfigHandler(User *user, const std::string &from, const std::string &id) : m_from(from), m_user(user) {
setRequestType(CALLER_ADHOC);
std::string bare(JID(from).bare());
IQ _response(IQ::Result, from, id);
Tag *response = _response.tag();
response->addAttribute("from", Transport::instance()->jid());
AdhocTag *adhocTag = new AdhocTag(Transport::instance()->getId(), "transport_irc_config", "executing");
adhocTag->setAction("complete");
adhocTag->setTitle("IRC Nickserv password configuration");
adhocTag->setInstructions("Choose the server you want to change password for.");
std::map <std::string, std::string> values;
std::map<std::string, UserRow> users = Transport::instance()->sql()->getUsersByJid(bare);
for (std::map<std::string, UserRow>::iterator it = users.begin(); it != users.end(); it++) {
std::string server = (*it).second.jid.substr(bare.size());
values[server] = stringOf((*it).second.id);
m_userId.push_back(stringOf((*it).second.id));
}
adhocTag->addListSingle("IRC server", "irc_server", values);
adhocTag->addTextPrivate("New NickServ password", "password");
response->addChild(adhocTag);
Transport::instance()->send(response);
}
示例13: tag
Tag* Message::tag() const
{
if( m_subtype == Invalid )
return 0;
Tag* t = new Tag( "message" );
if( m_to )
t->addAttribute( "to", m_to.full() );
if( m_from )
t->addAttribute( "from", m_from.full() );
if( !m_id.empty() )
t->addAttribute( "id", m_id );
if( !m_timestamp.empty() )
t->addAttribute( "timestamp", m_timestamp );
t->addAttribute( TYPE, typeString( m_subtype ) );
getLangs( m_bodies, m_body, "body", t );
getLangs( m_subjects, m_subject, "subject", t );
getLangs( m_htmls, m_html, "html", t );
if( !m_thread.empty() )
new Tag( t, "thread", m_thread );
StanzaExtensionList::const_iterator it = m_extensionList.begin();
for( ; it != m_extensionList.end(); ++it )
t->addChild( (*it)->tag() );
return t;
}
示例14: name
authRequest *SpectrumRosterManager::handleAuthorizationRequest(PurpleAccount *account, const char *remote_user, const char *id, const char *alias, const char *message, gboolean on_list, PurpleAccountRequestAuthorizationCb authorize_cb, PurpleAccountRequestAuthorizationCb deny_cb, void *user_data) {
std::string name(remote_user);
authRequest *req = new authRequest;
req->authorize_cb = authorize_cb;
req->deny_cb = deny_cb;
req->user_data = user_data;
req->account = m_user->account();
req->who = name;
req->mainJID = m_user->jid();
m_authRequests[name] = req;
Log(m_user->jid(), "purpleAuthorizeReceived: " << name << "on_list:" << on_list);
// std::for_each( name.begin(), name.end(), replaceBadJidCharacters() );
if (Transport::instance()->getConfiguration().jid_escaping) {
name = JID::escapeNode(name);
}
else {
std::for_each( name.begin(), name.end(), replaceBadJidCharacters() );
}
// send subscribe presence to user
Tag *tag = new Tag("presence");
tag->addAttribute("type", "subscribe" );
tag->addAttribute("from", name + "@" + Transport::instance()->jid());
tag->addAttribute("to", m_user->jid());
if (alias) {
Tag *nick = new Tag("nick", std::string(alias));
nick->addAttribute("xmlns","http://jabber.org/protocol/nick");
tag->addChild(nick);
}
Transport::instance()->send(tag);
return req;
}
示例15: Tag
const std::string SIProfileFT::requestFT( const JID& to, const std::string& name, long size,
const std::string& hash, const std::string& desc,
const std::string& date, const std::string& mimetype,
int streamTypes )
{
if( name.empty() || size <= 0 || !m_manager )
return EmptyString;
Tag* file = new Tag( "file", XMLNS, XMLNS_SI_FT );
file->addAttribute( "name", name );
file->addAttribute( "size", size );
if( !hash.empty() )
file->addAttribute( "hash", hash );
if( !date.empty() )
file->addAttribute( "date", date );
if( !desc.empty() )
new Tag( file, "desc", desc );
if( m_ranged )
new Tag( file, "range" );
Tag* feature = new Tag( "feature", XMLNS, XMLNS_FEATURE_NEG );
DataForm df( TypeForm );
DataFormField* dff = df.addField( DataFormField::TypeListSingle, "stream-method" );
StringMap sm;
if( streamTypes & FTTypeS5B )
sm["s5b"] = XMLNS_BYTESTREAMS;
if( streamTypes & FTTypeIBB )
sm["ibb"] = XMLNS_IBB;
if( streamTypes & FTTypeOOB )
sm["oob"] = XMLNS_IQ_OOB;
dff->setOptions( sm );
feature->addChild( df.tag() );
return m_manager->requestSI( this, to, XMLNS_SI_FT, file, feature, mimetype );
}