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


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

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


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

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