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


C++ EntryList::size方法代码示例

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


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

示例1: getRelation

/*******************pubilc interface***********************/
BuddyDesc BuddyRelationLogic::getRelation(const Relationship& relationship) {
    if (relationship.from == relationship.to) {
        return ::Self;
    }
	
    Relationship relation = relationship;
    bool changed = operRelationship(relation);
		
    Entry key(relation.to, 0);
	
    EntryListHolderPtr holder = readObject(relation.from);
	
    if (holder) {
        EntryList entryResult = holder->get(key);
        if (entryResult.empty()) {
            MCE_DEBUG("BuddyRelationCacheManagerI::getRelation found empty.");
            return ::NoPath;
        }

        if (entryResult.size() != 1) {
            MCE_WARN("GetRelation should found only one entry. But found "
					<< entryResult.size() << " entries");
        }
        if(changed){
            return BuddyDescHelper::oppositeDesc(BuddyDescHelper::translateDesc(entryResult.at(0).desc));
        }else{
            return BuddyDescHelper::translateDesc(entryResult.at(0).desc);
        }
    } else {
        MCE_INFO("BuddyRelationCacheManagerI::getRelation, from: " << relation.from << " is not in cache");
    }
    return ::NoPath;
}
开发者ID:bradenwu,项目名称:oce,代码行数:34,代码来源:BuddyRelationLogic.cpp

示例2: searchAndDisplay

/**
 * This method performs the search and displays
 * the result to the screen.
 */
void Kiten::searchAndDisplay( const DictQuery &query )
{
  /* keep the user informed of what we are doing */
  _statusBar->showMessage( i18n( "Searching..." ) );

  /* This gorgeous incantation is all that's necessary to fill a DictQuery
    with a query and an Entrylist with all of the results form all of the
    requested dictionaries */
  EntryList *results = _dictionaryManager.doSearch( query );

  /* if there are no results */
  if ( results->size() == 0 ) //TODO: check here if the user actually prefers this
  {
    //create a modifiable copy of the original query
    DictQuery newQuery( query );

    bool tryAgain = false;

    do
    {
      //by default we don't try again
      tryAgain = false;

      //but if the matchtype is changed we try again
      if ( newQuery.getMatchType() == DictQuery::Exact )
      {
        newQuery.setMatchType( DictQuery::Beginning );
        tryAgain = true;
      }
      else if ( newQuery.getMatchType() == DictQuery::Beginning )
      {
        newQuery.setMatchType( DictQuery::Anywhere );
        tryAgain = true;
      }


      //try another search
      if ( tryAgain )
      {
        delete results;
        results = _dictionaryManager.doSearch( newQuery );

        //results means all is ok; don't try again
        if ( results->size() > 0 )
        {
          tryAgain = false;
        }
      }
    } while ( tryAgain );
  }

  /* synchronize the history (and store this pointer there) */
  addHistory( results );

  /* Add the current search to our drop down list */
  _inputManager->setSearchQuery( results->getQuery() );

  /* suppose it's about time to show the users the results. */
  displayResults( results );
}
开发者ID:KDE,项目名称:kiten,代码行数:64,代码来源:kiten.cpp

示例3: findEntry

int CustomerData::findEntry(const EntryList& entries, const std::string& stock)
{
    for(int i = 0; i < entries.size(); ++i)
    {
        if (entries[i].first == stock)
            return entries[i].second;
    }
    return -1;
}
开发者ID:szqh97,项目名称:test,代码行数:9,代码来源:Customer.cpp

示例4: AddUser

DB_Error DataBaseSqlite::AddUser(shared_ptr<User> user)
{
    DB_Error ret = CreateTable("User");
    if (ret == DB_OK)
    {
        EntryList entries = m_pTableComponent->GetTableFormat("User");
        PDEBUG ("entry size: %lu\n", entries.size());
        if (!entries.empty())
        {
            string sql(INSERT_TABLE);
            sql += string("User") + VALUE + LPARENT;
            EntryList::iterator iter = entries.begin();
            EntryList::iterator end  = entries.end();
            for (; iter != end;)
            {
                sql += "@" + iter->name;
                if (++iter != end)
                {
                    sql += ", ";
                }
            }
            sql += string(RPARENT) + SEMI;

            SqliteCommand cmd(this, sql);

            // Ugly hard code!!
            PDEBUG ("Begin binding\n");
            ret = cmd.Bind("@name", user->name());
            ret = ret ? ret : cmd.Bind("@uuid", user->uuid());
            int64 date = 0;
            if (user->has_reg_date())
            {
                ret = user->reg_date();
            }
            ret = ret ? ret : cmd.Bind("@reg_date", date);

            date = 0;

            if (user->has_last_login())
            {
                date = user->last_login();
            }
            ret = ret ? ret : cmd.Bind("@last_login", date);
            // Bind others ...
            ret = ret ? ret : cmd.Execute();
            // Execute ....
        }
    }
    return ret;
}
开发者ID:yangyingchao,项目名称:TeleHealth,代码行数:50,代码来源:DataBaseSqlite.cpp

示例5: CreateTable

DB_Error DataBaseSqlite::CreateTable(const string& name)
{
    DB_Error ret = DB_INVAL;


    EntryList entries = m_pTableComponent->GetTableFormat(name);
    PDEBUG ("entry size: %lu\n", entries.size());
    if (!entries.empty())
    {
        string sql(CREATE_TABLE);
        sql += IFNEXT + name + LPARENT;
        EntryList::iterator iter = entries.begin();
        EntryList::iterator end  = entries.end();
        for (; iter != end;)
        {
            sql += iter->name + " " +
                   g_SqlteKeywordMapping[iter->type];

            if (iter->primary)
            {
                sql += PRIMARY_KEY;
            }

            if (++iter != end)
            {
                sql += ", ";
            }
        }
        sql += string(RPARENT) + SEMI;

        SqliteCommand cmd(this, sql);
        ret = cmd.Execute();
    }


    PDEBUG ("Create %s, ret: %d\n", name.c_str(), ret);
    return ret;
}
开发者ID:yangyingchao,项目名称:TeleHealth,代码行数:38,代码来源:DataBaseSqlite.cpp


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