• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ Tag类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: Tag

Tag* GSIOTInfo::tag() const
{
	Tag* t = new Tag( "gsiot" );
	t->setXmlns( XMLNS_GSIOT );

	Tag *tiot = new Tag( t, "iot" );
	tiot->addAttribute( "ver", g_IOTGetVersion()+"(build "+g_IOTGetBuildInfo()+")" );

	if( m_deviceList.size()>0){
		std::list<GSIOTDevice *>::const_iterator it = m_deviceList.begin();
		for(;it!=m_deviceList.end();it++){
		    Tag *c = new Tag(t, "device");
			c->addAttribute("id",(*it)->getId());
			c->addAttribute("name",ASCIIToUTF8((*it)->getName()));
			c->addAttribute("type",(*it)->getType());
			if( (*it)->getType()!=(*it)->getExType() && IOT_DEVICE_Unknown!=(*it)->getExType() ){ c->addAttribute( "extype", (*it)->getExType() ); }

			if( !(*it)->getVer().empty() && (*it)->getVer()!="1.0" ) c->addAttribute("ver",(*it)->getVer());
			c->addAttribute("readtype",(*it)->getReadType());
			
			const defUseable useable = (*it)->get_all_useable_state();
			if( defUseable_OK != useable ) { c->addAttribute("useable",useable); }; // 默认可用,不可用时才提供此值

			const defAlarmState AlarmState = (*it)->GetCurAlarmState();
			if( macAlarmState_IsAlarm(AlarmState) ) { c->addAttribute( "almst", AlarmState ); }; // 默认正常

			const std::string PrePicChangeCode = (*it)->GetPrePicChangeCode();
			if( !PrePicChangeCode.empty() ) { c->addAttribute( "prepic", PrePicChangeCode ); };
		}
	}
	return t;
}
开发者ID:asdfjkl697,项目名称:package,代码行数:32,代码来源:GSIOTInfo.cpp


示例2: handleIq

  bool Registration::handleIq( Stanza *stanza )
  {
    if( stanza->subtype() == StanzaIqError )
    {
      Tag *e = stanza->findChild( "error" );

      if( e->empty() || !m_registrationHandler )
        return false;

      if( e->hasChild( "conflict" ) || e->hasAttribute( "code", "409" ) )
        m_registrationHandler->handleRegistrationResult( RegistrationHandler::REGISTRATION_CONFLICT );
      else if( e->hasChild( "not-acceptable" ) || e->hasAttribute( "code", "406" ) )
        m_registrationHandler->handleRegistrationResult( RegistrationHandler::REGISTRATION_NOT_ACCEPTABLE );
      else if( e->hasChild( "bad-request" ) || e->hasAttribute( "code", "400" ) )
        m_registrationHandler->handleRegistrationResult( RegistrationHandler::REGISTRATION_BAD_REQUEST );
      else if( e->hasChild( "forbidden" ) || e->hasAttribute( "code", "403" ) )
        m_registrationHandler->handleRegistrationResult( RegistrationHandler::REGISTRATION_FORBIDDEN );
      else if( e->hasChild( "registration-required" ) || e->hasAttribute( "code", "407" ) )
        m_registrationHandler->handleRegistrationResult(
            RegistrationHandler::REGISTRATION_REGISTRATION_REQUIRED );
      else if( e->hasChild( "unexpected-request" ) || e->hasAttribute( "code", "400" ) )
        m_registrationHandler->handleRegistrationResult(
            RegistrationHandler::REGISTRATION_UNEXPECTED_REQUEST );
      else if( e->hasChild( "not-authorized" ) || e->hasAttribute( "code", "401" ) )
        m_registrationHandler->handleRegistrationResult( RegistrationHandler::REGISTRATION_NOT_AUTHORIZED );
      else if( e->hasChild( "not-allowed" ) || e->hasAttribute( "code", "405" ) )
        m_registrationHandler->handleRegistrationResult( RegistrationHandler::REGISTRATION_NOT_ALLOWED );
      else
        m_registrationHandler->handleRegistrationResult( RegistrationHandler::UNKNOWN_ERROR );
    }
    return false;
  }
开发者ID:SupportSpace,项目名称:SupportCenter,代码行数:32,代码来源:registration.cpp


示例3: Tag

 // ---- Client::SessionCreation ----
 Tag* Client::SessionCreation::tag() const
 {
   Tag* t = new Tag( "session" );
   t->setXmlns( XMLNS_STREAM_SESSION );
   return t;
 }
开发者ID:page31,项目名称:GJTalk,代码行数:7,代码来源:client.cpp


示例4: ResourceSelectJob

void TagTest::testRIDIsolation()
{
    {
        ResourceSelectJob *select = new ResourceSelectJob(QStringLiteral("akonadi_knut_resource_0"));
        AKVERIFYEXEC(select);
    }

    Tag tag;
    tag.setGid("gid");
    tag.setType("mytype");
    tag.setRemoteId("rid_0");

    TagCreateJob *createJob = new TagCreateJob(tag, this);
    AKVERIFYEXEC(createJob);
    QVERIFY(createJob->tag().isValid());

    qint64 tagId;
    {
        TagFetchJob *fetchJob = new TagFetchJob(this);
        AKVERIFYEXEC(fetchJob);
        Q_FOREACH (const Tag &tag, fetchJob->tags()) {
            qDebug() << tag.gid();
        }
        QCOMPARE(fetchJob->tags().count(), 1);
        QCOMPARE(fetchJob->tags().first().gid(), QByteArray("gid"));
        QCOMPARE(fetchJob->tags().first().type(), QByteArray("mytype"));
        QCOMPARE(fetchJob->tags().first().remoteId(), QByteArray("rid_0"));
        tagId = fetchJob->tags().first().id();
    }

    {
        ResourceSelectJob *select = new ResourceSelectJob(QStringLiteral("akonadi_knut_resource_1"));
        AKVERIFYEXEC(select);
    }

    tag.setRemoteId("rid_1");
    createJob = new TagCreateJob(tag, this);
    createJob->setMergeIfExisting(true);
    AKVERIFYEXEC(createJob);
    QVERIFY(createJob->tag().isValid());

    {
        TagFetchJob *fetchJob = new TagFetchJob(this);
        AKVERIFYEXEC(fetchJob);
        QCOMPARE(fetchJob->tags().count(), 1);
        QCOMPARE(fetchJob->tags().first().gid(), QByteArray("gid"));
        QCOMPARE(fetchJob->tags().first().type(), QByteArray("mytype"));
        QCOMPARE(fetchJob->tags().first().remoteId(), QByteArray("rid_1"));

        QCOMPARE(fetchJob->tags().first().id(), tagId);

    }

    TagDeleteJob *deleteJob = new TagDeleteJob(Tag(tagId), this);
    AKVERIFYEXEC(deleteJob);

    {
        ResourceSelectJob *select = new ResourceSelectJob(QStringLiteral(""));
        AKVERIFYEXEC(select);
    }
}
开发者ID:quazgar,项目名称:kdepimlibs,代码行数:61,代码来源:tagtest.cpp


示例5: void

// . also sets m_sitePathDepth to what it should be
// . -1 indicates unknown (not enough data, etc.) or host/domain is the site
// . returns false if blocked, true otherwise
// . returns true and sets g_errno on error
// . sets m_site to reference into "url" so XmlDoc::updateTagdb() can just
//   pass a bunch of site ptrs to msg9a
// . "url" MUST BE NORMALIZED via Url.cpp. so using Links' buffer is ok!
// . TODO: consider setting "state" to null if your url host has tons of inlinx
bool SiteGetter::getSite ( char   *url      ,
			   TagRec *gr       ,
			   int32_t    timestamp,
			   //char   *coll     ,
			   collnum_t collnum,
			   int32_t    niceness ,
			   //bool    addTags  ,
			   void   *state    ,
			   void (* callback)(void *state) ) {
	
	// save it
	m_gr       = gr;
	m_url      = url;
	//m_coll     = coll;
	m_collnum = collnum;
	//m_addTags  = addTags;
	m_state    = state;
	m_callback = callback;
	m_timestamp= timestamp;
	m_niceness = niceness;
	m_errno    = 0;

	// is it domain only?
	m_hasSubdomain = ::hasSubdomain ( url );

	// reset
	m_siteLen = 0;
	m_site[0] = '\0';
	m_allDone  = false;
	m_addedTag.reset();

	// set this to unknown for now
	m_sitePathDepth    = -1;
	m_oldSitePathDepth = -1;

	// reset this just in case
	g_errno = 0;

	//
	// HARDCODED algos
	//
	// ~ /user/ /users/ /profile/ myspace facebook linkedin
	//
	if ( setRecognizedSite ( ) ) {
		m_allDone = true;
		return true;
	}

	// bail if nothing else we can do
	if ( ! gr ) return setSite ( ) ;

	CollectionRec *cr = g_collectiondb.getRec ( collnum );
	// g_errno should be set if this is NULL
	if ( ! cr ) return true;
	//if ( ! cr->m_subsiteDetectionEnabled ) return true;

	// check the current tag for an age
	Tag *tag = gr->getTag("sitepathdepth");
	// if there and the age is young, skip it
	int32_t age = -1;
	//int32_t now = getTimeGlobal();
	//if ( tag ) age = now - tag->m_timestamp;
	// to parse conssitently for the qa test "qatest123" coll use 
	// "timestamp" as the "current time"
	if ( tag ) age = timestamp - tag->m_timestamp;
	// if there, at least get it (might be -1)
	if ( tag ) m_oldSitePathDepth = atol ( tag->getTagData() );
	// . if older than 10 days, we need to redo it
	// . if caller give us a timestamp of 0, never redo it!
	if ( age > 10*24*60*60 && timestamp != 0 ) age = -1;

	//if ( strstr(m_url,"http://www.topix.com/yp/albuquerque/c/community-religion-and-spirituality-churches") )
	//	log("hey");

	// . if our site quality is low, forget about dividing it up too
	// . if age is valid, skip it
	// . also if caller does not want a callback, like XmlDoc.cpp,
	//   then use whatever we got
	if ( age >= 0 || ! m_state ) { // || hostRootNumInlinks < 500 ) {
		// do not add to tagdb
		m_state = NULL;
		// just use what we had, it is not expired
		m_sitePathDepth = m_oldSitePathDepth;
		// . now set the site with m_sitePathDepth
		// . sanity check, should not block since m_state is NULL
		if ( ! setSite () ) { char *xx=NULL;*xx=0; }
		// we did not block
		return true;
	}

	// right now we only run on host #0 so we do not flood the cluster
	// with queries...
//.........这里部分代码省略.........
开发者ID:Doken-Tokuyama,项目名称:open-source-search-engine,代码行数:101,代码来源:SiteGetter.cpp


示例6: taglib_tag_set_comment

void taglib_tag_set_comment(TagLib_Tag *tag, const char *comment)
{
  Tag *t = reinterpret_cast<Tag *>(tag);
  t->setComment(String(comment, unicodeStrings ? String::UTF8 : String::Latin1));
}
开发者ID:ABuus,项目名称:partyplayer,代码行数:5,代码来源:tag_c.cpp


示例7: taglib_tag_set_year

void taglib_tag_set_year(TagLib_Tag *tag, unsigned int year)
{
  Tag *t = reinterpret_cast<Tag *>(tag);
  t->setYear(year);
}
开发者ID:ABuus,项目名称:partyplayer,代码行数:5,代码来源:tag_c.cpp


示例8: main

int main( int /*argc*/, char** /*argv*/ )
{
  int fail = 0;
  std::string name;
  Tag *t;

  // -------
  {
    name = "empty tag() test";
    Receipt r( Receipt::Invalid );
    t = r.tag();
    if( t )
    {
      ++fail;
      fprintf( stderr, "test '%s' failed\n", name.c_str() );
    }
    delete t;
    t = 0;
  }

  // -------
  {
    name = "request";
    Receipt r( Receipt::Request );
    t = r.tag();
    if( t->xml() != "<request xmlns='"+ XMLNS_RECEIPTS + "'/>" )
    {
      ++fail;
      fprintf( stderr, "test '%s' failed: %s\n", name.c_str(), t->xml().c_str() );
    }
    delete t;
    t = 0;
  }

  // -------
  {
    name = "received";
    Receipt r( Receipt::Received );
    t = r.tag();
    if( t->xml() != "<received xmlns='"+ XMLNS_RECEIPTS + "'/>" )
    {
      ++fail;
      fprintf( stderr, "test '%s' failed: %s\n", name.c_str(), t->xml().c_str() );
    }
    delete t;
    t = 0;
  }

  StanzaExtensionFactory sef;
  sef.registerExtension( new Receipt( Receipt::Invalid ) );
  // -------
  {
    name = "Receipt::Request/SEFactory test";
    Tag* f = new Tag( "message" );
    new Tag( f, "request", "xmlns", XMLNS_RECEIPTS );
    Message msg( Message::Normal, JID(), "" );
    sef.addExtensions( msg, f );
    const Receipt* se = msg.findExtension<Receipt>( ExtReceipt );
    if( se == 0 || se->rcpt() != Receipt::Request )
    {
      ++fail;
      fprintf( stderr, "test '%s' failed\n", name.c_str() );
    }
    delete f;
  }

  // -------
  {
    name = "Receipt::Received/SEFactory test";
    Tag* f = new Tag( "message" );
    new Tag( f, "received", "xmlns", XMLNS_RECEIPTS );
    Message msg( Message::Normal, JID(), "" );
    sef.addExtensions( msg, f );
    const Receipt* se = msg.findExtension<Receipt>( ExtReceipt );
    if( se == 0 || se->rcpt() != Receipt::Received )
    {
      ++fail;
      fprintf( stderr, "test '%s' failed\n", name.c_str() );
    }
    delete f;
  }

  printf( "Receipt: " );
  if( fail == 0 )
  {
    printf( "OK\n" );
    return 0;
  }
  else
  {
    fprintf( stderr, "%d test(s) failed\n", fail );
    return 1;
  }

}
开发者ID:jvalvert,项目名称:societas,代码行数:95,代码来源:receipt_test.cpp


示例9: LOG

DefineSpriteTag::DefineSpriteTag(RECORDHEADER h, std::istream& in, RootMovieClip* root):DictionaryTag(h,root)
{
	in >> SpriteID >> FrameCount;

	LOG(LOG_TRACE,"DefineSprite ID: " << SpriteID);
	//Create a non top level TagFactory
	TagFactory factory(in, false);
	Tag* tag;
	bool done=false;
	bool empty=true;
	do
	{
		tag=factory.readTag(root);
		/* We need no locking here, because the vm can only
		 * access this object after construction
		 */
		switch(tag->getType())
		{
			case DICT_TAG:
				delete tag;
				throw ParseException("Dictionary tag inside a sprite. Should not happen.");
			case DISPLAY_LIST_TAG:
				addToFrame(static_cast<DisplayListTag*>(tag));
				empty=false;
				break;
			case SHOW_TAG:
			{
				delete tag;
				frames.emplace_back(Frame());
				empty=true;
				break;
			}
			case SYMBOL_CLASS_TAG:
			case ABC_TAG:
			case CONTROL_TAG:
			case ACTION_TAG:
				delete tag;
				throw ParseException("Control tag inside a sprite. Should not happen.");
			case FRAMELABEL_TAG:
				addFrameLabel(frames.size()-1,static_cast<FrameLabelTag*>(tag)->Name);
				delete tag;
				empty=false;
				break;
			case TAG:
				delete tag;
				LOG(LOG_NOT_IMPLEMENTED,_("Unclassified tag inside Sprite?"));
				break;
			case END_TAG:
				delete tag;
				done=true;
				if(empty && frames.size()!=FrameCount)
					frames.pop_back();
				break;
		}
	}
	while(!done);

	if(frames.size()!=FrameCount)
	{
		//This condition is not critical as Sprites are not executed while being parsed
		LOG(LOG_CALLS,_("Inconsistent frame count in Sprite ID ") << SpriteID);
	}

	setFramesLoaded(frames.size());
}
开发者ID:Kelimion,项目名称:lightspark,代码行数:65,代码来源:tags.cpp


示例10: UninitializedEntity

void Group::addTag(const Tag &tag) {
    if (!util::checkEntityInput(tag, false)) {
        throw UninitializedEntity();
    }
    backend()->addTag(tag.id());
}
开发者ID:Prabhnith,项目名称:nix,代码行数:6,代码来源:Group.cpp


示例11: backend

bool Group::removeTag(const Tag &tag) {
    if (!util::checkEntityInput(tag, false)) {
        return false;
    }
    return backend()->removeTag(tag.id());
}
开发者ID:Prabhnith,项目名称:nix,代码行数:6,代码来源:Group.cpp


示例12: add

 void add( const Tag& tag ) {
     m_tags.insert( std::make_pair( tag.getName(), tag ) );
 }
开发者ID:hendrics,项目名称:Catch,代码行数:3,代码来源:catch_tags.hpp


示例13: while

std::list<Tag *> M3U8Parser::parseEntries(stream_t *stream)
{
    std::list<Tag *> entrieslist;
    Tag *lastTag = NULL;
    char *psz_line;

    while((psz_line = vlc_stream_ReadLine(stream)))
    {
        if(*psz_line == '#')
        {
            if(!strncmp(psz_line, "#EXT", 4)) //tag
            {
                std::string key;
                std::string attributes;
                const char *split = strchr(psz_line, ':');
                if(split)
                {
                    key = std::string(psz_line + 1, split - psz_line - 1);
                    attributes = std::string(split + 1);
                }
                else
                {
                    key = std::string(psz_line + 1);
                }

                if(!key.empty())
                {
                    Tag *tag = TagFactory::createTagByName(key, attributes);
                    if(tag)
                        entrieslist.push_back(tag);
                    lastTag = tag;
                }
            }
        }
        else if(*psz_line)
        {
            /* URI */
            if(lastTag && lastTag->getType() == AttributesTag::EXTXSTREAMINF)
            {
                AttributesTag *streaminftag = static_cast<AttributesTag *>(lastTag);
                /* master playlist uri, merge as attribute */
                Attribute *uriAttr = new (std::nothrow) Attribute("URI", std::string(psz_line));
                if(uriAttr)
                    streaminftag->addAttribute(uriAttr);
            }
            else /* playlist tag, will take modifiers */
            {
                Tag *tag = TagFactory::createTagByName("", std::string(psz_line));
                if(tag)
                    entrieslist.push_back(tag);
            }
            lastTag = NULL;
        }
        else // drop
        {
            lastTag = NULL;
        }

        free(psz_line);
    }

    return entrieslist;
}
开发者ID:MarkYuan,项目名称:vlc,代码行数:63,代码来源:Parser.cpp


示例14: taglib_tag_set_artist

void taglib_tag_set_artist(TagLib_Tag *tag, const char *artist)
{
  Tag *t = reinterpret_cast<Tag *>(tag);
  t->setArtist(String(artist, unicodeStrings ? String::UTF8 : String::Latin1));
}
开发者ID:ABuus,项目名称:partyplayer,代码行数:5,代码来源:tag_c.cpp


示例15:

Tag
    Element::add_tag(const Tag &tag) {
        m_tags[tag.key()] = tag.value();
        return tag;
    }
开发者ID:,项目名称:,代码行数:5,代码来源:


示例16: taglib_tag_set_album

void taglib_tag_set_album(TagLib_Tag *tag, const char *album)
{
  Tag *t = reinterpret_cast<Tag *>(tag);
  t->setAlbum(String(album, unicodeStrings ? String::UTF8 : String::Latin1));
}
开发者ID:ABuus,项目名称:partyplayer,代码行数:5,代码来源:tag_c.cpp


示例17: Tag

  Tag* PrivacyManager::Query::tag() const
  {
    Tag* t = new Tag( "query" );
    t->setXmlns( XMLNS_PRIVACY );

    std::string child;
    switch( m_context )
    {
      case PLRequestList:
      case PLRemove:
      case PLStore:
        child = "list";
        break;
      case PLDefault:
      case PLUnsetDefault:
        child = "default";
        break;
      case PLActivate:
      case PLUnsetActivate:
        child = "active";
        break;
      default:
      case PLRequestNames:
        return t;
        break;
    }
    Tag* c = new Tag( t, child );

    if( !m_names.empty() )
      c->addAttribute( "name", (*m_names.begin()) );

    int count = 0;
    PrivacyListHandler::PrivacyList::const_iterator it = m_items.begin();
    for( ; it != m_items.end(); ++it )
    {
      Tag* i = new Tag( c, "item" );

      switch( (*it).type() )
      {
        case PrivacyItem::TypeJid:
          i->addAttribute( TYPE, "jid" );
          break;
        case PrivacyItem::TypeGroup:
          i->addAttribute( TYPE, "group" );
          break;
        case PrivacyItem::TypeSubscription:
          i->addAttribute( TYPE, "subscription" );
          break;
        default:
          break;
      }

      switch( (*it).action() )
      {
        case PrivacyItem::ActionAllow:
          i->addAttribute( "action", "allow" );
          break;
        case PrivacyItem::ActionDeny:
          i->addAttribute( "action", "deny" );
          break;
      }

      int pType = (*it).packetType();
      if( pType != 15 )
      {
        if( pType & PrivacyItem::PacketMessage )
          new Tag( i, "message" );
        if( pType & PrivacyItem::PacketPresenceIn )
          new Tag( i, "presence-in" );
        if( pType & PrivacyItem::PacketPresenceOut )
          new Tag( i, "presence-out" );
        if( pType & PrivacyItem::PacketIq )
          new Tag( i, "iq" );
      }

      i->addAttribute( "value", (*it).value() );
      i->addAttribute( "order", ++count );
    }

    return t;
  }
开发者ID:hcmlab,项目名称:mobileSSI,代码行数:81,代码来源:privacymanager.cpp


示例18: taglib_tag_set_genre

void taglib_tag_set_genre(TagLib_Tag *tag, const char *genre)
{
  Tag *t = reinterpret_cast<Tag *>(tag);
  t->setGenre(String(genre, unicodeStrings ? String::UTF8 : String::Latin1));
}
开发者ID:ABuus,项目名称:partyplayer,代码行数:5,代码来源:tag_c.cpp


示例19: operator

		inline bool operator()(const uint32_t a,const Tag &b) const { return (a < b.id()); }
开发者ID:curtiszimmerman,项目名称:ZeroTierOne,代码行数:1,代码来源:Tag.hpp


示例20: taglib_tag_set_track

void taglib_tag_set_track(TagLib_Tag *tag, unsigned int track)
{
  Tag *t = reinterpret_cast<Tag *>(tag);
  t->setTrack(track);
}
开发者ID:ABuus,项目名称:partyplayer,代码行数:5,代码来源:tag_c.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ TagDecl类代码示例发布时间:2022-05-31
下一篇:
C++ TableWorkspace_sptr类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap