当前位置: 首页>>代码示例>>C++>>正文


C++ Tag::addAttribute方法代码示例

本文整理汇总了C++中Tag::addAttribute方法的典型用法代码示例。如果您正苦于以下问题:C++ Tag::addAttribute方法的具体用法?C++ Tag::addAttribute怎么用?C++ Tag::addAttribute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Tag的用法示例。


在下文中一共展示了Tag::addAttribute方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: storeAnnotations

  void Annotations::storeAnnotations( const AnnotationsHandler::AnnotationsList& aList )
  {
    Tag *s = new Tag( "storage" );
    s->addAttribute( "xmlns", XMLNS_ANNOTATIONS );

    if( aList.size() )
    {
      AnnotationsHandler::AnnotationsList::const_iterator it = aList.begin();
      for( ; it != aList.end(); ++it )
      {
        Tag *n = new Tag( s, "note", (*it).note );
        n->addAttribute( "jid", (*it).jid );
        n->addAttribute( "cdate", (*it).cdate );
        n->addAttribute( "mdate", (*it).mdate );
      }
    }

    storeXML( s, this );
  }
开发者ID:SupportSpace,项目名称:SupportCenter,代码行数:19,代码来源:annotations.cpp

示例2: tag

  Tag* GPGSigned::tag() const
  {
    if( !m_valid )
      return 0;

    Tag* x = new Tag( "x", m_signature );
    x->addAttribute( XMLNS, XMLNS_X_GPGSIGNED );

    return x;
  }
开发者ID:hcmlab,项目名称:mobileSSI,代码行数:10,代码来源:gpgsigned.cpp

示例3: tag

Tag* GPGEncrypted::tag() const
{
    if( !m_valid )
        return 0;

    Tag* x = new Tag( "x", m_encrypted );
    x->addAttribute( XMLNS, XMLNS_X_GPGENCRYPTED );

    return x;
}
开发者ID:nikhildhamsaniya,项目名称:iGame,代码行数:10,代码来源:gpgencrypted.cpp

示例4: tag

  Tag* Receipt::tag() const
  {
    if( m_rcpt == Invalid )
      return 0;

    Tag* tag = new Tag( util::lookup( m_rcpt, receiptValues ), XMLNS, XMLNS_RECEIPTS );
    if ( !m_id.empty() )
      tag->addAttribute( "id", m_id );
    return tag;
  }
开发者ID:OSUser,项目名称:avbot,代码行数:10,代码来源:receipt.cpp

示例5: changePassword

  void Registration::changePassword( const std::string& password )
  {
    if( !m_parent || !m_parent->authed() )
      return;

    const std::string id = m_parent->getID();

    Tag *iq = new Tag( "iq" );
    iq->addAttribute( "type", "set" );
    iq->addAttribute( "id", id );
    iq->addAttribute( "to", m_parent->server() );
    Tag *q = new Tag( iq, "query" );
    q->addAttribute( "xmlns", XMLNS_REGISTER );
    new Tag( q, "username", m_parent->username() );
    new Tag( q, "password", password );

    m_parent->trackID( this, id, CHANGE_PASSWORD );
    m_parent->send( iq );
  }
开发者ID:SupportSpace,项目名称:SupportCenter,代码行数:19,代码来源:registration.cpp

示例6: search

  void Search::search( const JID& directory, const DataForm& form, SearchHandler *sh )
  {
    if( !m_parent || !directory || !sh )
      return;

    const std::string& id = m_parent->getID();

    Tag *iq = new Tag( "iq" );
    iq->addAttribute( "id", id );
    iq->addAttribute( "type", "set" );
    iq->addAttribute( "to", directory.full() );
    Tag *q = new Tag( iq, "query" );
    q->addAttribute( "xmlns", XMLNS_SEARCH );
    q->addChild( form.tag() );

    m_track[id] = sh;
    m_parent->trackID( this, id, DoSearch );
    m_parent->send( iq );
  }
开发者ID:soubok,项目名称:libset,代码行数:19,代码来源:search.cpp

示例7: handleIq

  bool LastActivity::handleIq( Stanza *stanza )
  {
    switch( stanza->subtype() )
    {
      case StanzaIqGet:
      {
        time_t now = time( 0 );

        Tag *t = new Tag( "iq" );
        t->addAttribute( "type", "result" );
        t->addAttribute( "id", stanza->id() );
        t->addAttribute( "to", stanza->from().full() );
        Tag *q = new Tag( t, "query" );
        std::ostringstream oss;
        oss << (int)(now - m_active);
        q->addAttribute( "seconds", oss.str() );
        q->addAttribute( "xmlns", XMLNS_LAST );

        m_parent->send( t );
        break;
      }

      case StanzaIqSet:
      {
        Tag *t = new Tag( "iq" );
        t->addAttribute( "id", stanza->id() );
        t->addAttribute( "to", stanza->from().full() );
        t->addAttribute( "type", "error" );
        Tag *e = new Tag( t, "error" );
        e->addAttribute( "type", "cancel" );
        Tag *f = new Tag( e, "feature-not-implemented" );
        f->addAttribute( "xmlns", XMLNS_XMPP_STANZAS );

        m_parent->send( t );
        break;
      }

      default:
        break;
    }

    return true;
  }
开发者ID:SupportSpace,项目名称:SupportCenter,代码行数:43,代码来源:lastactivity.cpp

示例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()->clone() );

    NoteList::const_iterator it = m_notes.begin();
    for( ; it != m_notes.end(); ++it )
      c->addChild( (*it)->tag() );

    return c;
  }
开发者ID:hcmlab,项目名称:mobileSSI,代码行数:53,代码来源:adhoc.cpp

示例9: tag

  Tag* IQ::tag() const
  {
    if( m_subtype == Invalid )
      return 0;

    Tag* t = new Tag( "iq" );
    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 );
    t->addAttribute( TYPE, typeString( m_subtype ) );

    StanzaExtensionList::const_iterator it = m_extensionList.begin();
    for( ; it != m_extensionList.end(); ++it )
      t->addChild( (*it)->tag() );

    return t;
  }
开发者ID:OSUser,项目名称:avbot,代码行数:20,代码来源:iq.cpp

示例10: 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;
  }
开发者ID:Abhi347,项目名称:s3eGloox,代码行数:20,代码来源:simanager.cpp

示例11: 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);
}
开发者ID:bochi,项目名称:spectrum-gw,代码行数:11,代码来源:spectrumconversation.cpp

示例12: testAttributes

void TagTest::testAttributes()
{
    Tag tag;
    {
        tag.setGid("gid2");
        TagAttribute *attr = tag.attribute<TagAttribute>(Tag::AddIfMissing);
        attr->setDisplayName(QStringLiteral("name"));
        attr->setInToolbar(true);
        tag.addAttribute(attr);
        TagCreateJob *createjob = new TagCreateJob(tag, this);
        AKVERIFYEXEC(createjob);
        QVERIFY(createjob->tag().isValid());
        tag = createjob->tag();

        {
            TagFetchJob *fetchJob = new TagFetchJob(createjob->tag(), this);
            fetchJob->fetchScope().fetchAttribute<TagAttribute>();
            AKVERIFYEXEC(fetchJob);
            QCOMPARE(fetchJob->tags().size(), 1);
            QVERIFY(fetchJob->tags().first().hasAttribute<TagAttribute>());
            //we need to clone because the returned attribute is just a reference and destroyed on the next line
            //FIXME we should find a better solution for this (like returning a smart pointer or value object)
            QScopedPointer<TagAttribute> tagAttr(fetchJob->tags().first().attribute<TagAttribute>()->clone());
            QVERIFY(tagAttr);
            QCOMPARE(tagAttr->displayName(), QStringLiteral("name"));
            QCOMPARE(tagAttr->inToolbar(), true);
        }
    }
    //Try fetching multiple items
    Tag tag2;
    {
        tag2.setGid("gid22");
        TagAttribute *attr = tag.attribute<TagAttribute>(Tag::AddIfMissing)->clone();
        attr->setDisplayName(QStringLiteral("name2"));
        attr->setInToolbar(true);
        tag2.addAttribute(attr);
        TagCreateJob *createjob = new TagCreateJob(tag2, this);
        AKVERIFYEXEC(createjob);
        QVERIFY(createjob->tag().isValid());
        tag2 = createjob->tag();

        {
            TagFetchJob *fetchJob = new TagFetchJob(Tag::List() << tag << tag2, this);
            fetchJob->fetchScope().fetchAttribute<TagAttribute>();
            AKVERIFYEXEC(fetchJob);
            QCOMPARE(fetchJob->tags().size(), 2);
            QVERIFY(fetchJob->tags().at(0).hasAttribute<TagAttribute>());
            QVERIFY(fetchJob->tags().at(1).hasAttribute<TagAttribute>());
        }
    }

    TagDeleteJob *deleteJob = new TagDeleteJob(Tag::List() << tag << tag2, this);
    AKVERIFYEXEC(deleteJob);
}
开发者ID:quazgar,项目名称:kdepimlibs,代码行数:54,代码来源:tagtest.cpp

示例13: Tag

Tag* SOCKS5BytestreamManager::Query::tag() const
{
    if( m_type == TypeInvalid /*|| m_sid.empty()*/ )
        return 0;

    Tag* t = new Tag( "query" );
    t->setXmlns( XMLNS_BYTESTREAMS );
    t->addAttribute( "sid", m_sid );
    switch( m_type )
    {
    case TypeSH:
    {
        t->addAttribute( "mode", util::deflookup( m_mode, s5bModeValues, "tcp" ) );
        StreamHostList::const_iterator it = m_hosts.begin();
        for( ; it != m_hosts.end(); ++it )
        {
            Tag* s = new Tag( t, "streamhost" );
            s->addAttribute( "jid", (*it).jid.full() );
            s->addAttribute( "host", (*it).host );
            s->addAttribute( "port", (*it).port );
        }
        break;
    }
    case TypeSHU:
    {
        Tag* s = new Tag( t, "streamhost-used" );
        s->addAttribute( "jid", m_jid.full() );
        break;
    }
    case TypeA:
    {
        Tag* c = new Tag( t, "activate" );
        c->setCData( m_jid.full() );
        break;
    }
    default:
        break;
    }

    return t;
}
开发者ID:kofbashen,项目名称:weishao,代码行数:41,代码来源:socks5bytestreammanager.cpp

示例14: restoreNextConnection

bool AutoConnectLoop::restoreNextConnection() {
	if (m_users.size() == 0) {
		Log("connection restorer", "There is no other account to be checked => stopping Restorer");
		delete this;
		return false;
	}
	std::string jid = m_users.back();
	m_users.pop_back();

	Log("connection restorer", "Checking next jid " << jid);
	User *user = Transport::instance()->userManager()->getUserByJID(jid);
	if (user == NULL) {
		Log("connection restorer", "Sending probe presence to " << jid);
		Tag *stanza = new Tag("presence");
		stanza->addAttribute( "to", jid);
		stanza->addAttribute( "type", "probe");
		stanza->addAttribute( "from", Transport::instance()->jid());
		Transport::instance()->send(stanza);
	}
	return true;
}
开发者ID:Svedrin,项目名称:spectrum,代码行数:21,代码来源:autoconnectloop.cpp

示例15: removeUsers

void SpectrumMUCConversation::removeUsers(AbstractUser *_user, GList *users) {
	GList *l;
	for (l = users; l != NULL; l = l->next) {
		std::string user((char *)l->data);
		Tag *tag = new Tag("presence");
		tag->addAttribute("from", m_jid + "/" + user);
		tag->addAttribute("to", _user->jid() + m_res);
		tag->addAttribute("type", "unavailable");

		Tag *x = new Tag("x");
		x->addAttribute("xmlns", "http://jabber.org/protocol/muc#user");

		Tag *item = new Tag("item");
		item->addAttribute("affiliation", "member");
		item->addAttribute("role", "participant");

		x->addChild(item);
		tag->addChild(x);
		Transport::instance()->send(tag);
	}
}
开发者ID:bochi,项目名称:spectrum-gw,代码行数:21,代码来源:spectrummucconversation.cpp


注:本文中的Tag::addAttribute方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。