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


C++ VarList::Count方法代码示例

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


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

示例1: Initialize

bool NetSystem::Initialize() {
    if (NULL == (m_pKernel = Kernel::Employ()) ||
            NULL == (m_pCallBackSystem = CallBackSystem::Employ()) ||
            NULL == (m_pConfigManage = ConfigManage::Employ()) ||
            NULL == (m_pObjectManage = ObjectManage::Employ()) ||
            NULL == (m_pHeartBeatManage = HeartBeatManage::Employ()) ||
            NULL == (m_pLogSystem = LogSystem::Employ())) {
        LOG_ERROR("NetSystem initialize failed");
        Assert(false);
        return false;
    }

    m_alive = true;
    const CIniConfig * globlaconfig = m_pConfigManage->GetConfig(KERNEL_CONFIG_GLOBLA_INI);
    if (NULL == globlaconfig) {
        LOG_ERROR("Get GloblaConfig Failed");
        Assert(false);
        return false;
    }

    const char * pStrServerTypes = globlaconfig->GetStringConfig("Global", "ServerTypes");
    if ("" == string(pStrServerTypes)) {
        LOG_ERROR("Get ServerTypes Failed");
        Assert(false);
        return false;
    }

    VarList types;
    SafeSplitString(pStrServerTypes, ";", types);
    UI32 nCount = types.Count();
    if (0 >= nCount) {
        LOG_ERROR("Count Of ServerTypes : 0");
        Assert(0);
        return false;
    }

    for (UI32 i = 0; i < nCount; i++) {
        m_linkmanage.AddLinkType(types.GetString(i));
    }

    const CIniConfig * baseconfig = m_pConfigManage->GetConfig(KERNEL_CONFIG_BASE_INI);
    if (NULL == baseconfig) {
        LOG_ERROR("Get BaseConfig failed ");
        Assert(false);
        return false;
    }

    const char * pstartlisten = baseconfig->GetStringConfig("Base", "Listen");
    if (pstartlisten != NULL && strlen(pstartlisten) != 0) {
        VarList lslist;
        SafeSplitString(pstartlisten, ";", lslist);
        nCount = lslist.Count();
        for (UI32 i = 0; i < nCount; i++) {
            VarList listeninfo;
            SafeSplitString(lslist.GetString(i), ",", listeninfo);
            if (listeninfo.Count() != 3) {
                LOG_ERROR("Check the format of you listen config : %s", lslist.GetString(i));
                Assert(false);
                return false;
            }

            Listen(listeninfo.GetString(0), listeninfo.GetString(1), StringAsInt(listeninfo.GetString(2)), LISTEN_GAME_SOCKET);
        }
    }

    const char * pstartconnects = baseconfig->GetStringConfig("Base", "Connect");
    if (pstartconnects != NULL && strlen(pstartconnects) != 0) {
        VarList connects;
        SafeSplitString(pstartconnects, ";", connects);
        nCount = connects.Count();
        for (UI32 i = 0; i < nCount; i++) {
            VarList connectinfo;
            SafeSplitString(connects.GetString(i), ",", connectinfo);
            if (connectinfo.Count() != 3) {
                LOG_ERROR("Check the format of you connect config : %s", connects.GetString(i));
                Assert(false);
                return false;
            }

            Connect(connectinfo.GetString(0), connectinfo.GetString(1), StringAsInt(connectinfo.GetString(2)));
        }
    }

    const char * pConsolelisten = baseconfig->GetStringConfig("Base", "Console");
    if (pConsolelisten != NULL && strlen(pConsolelisten) != 0) {
        VarList csllist;
        SafeSplitString(pConsolelisten, ";", csllist);
        nCount = csllist.Count();
        for (UI32 i = 0; i < nCount; i++) {
            VarList listeninfo;
            SafeSplitString(csllist.GetString(i), ",", listeninfo);
            if (listeninfo.Count() != 3) {
                LOG_ERROR("Check the format of you listen config : %s", csllist.GetString(i));
                Assert(false);
                return false;
            }

            Listen(listeninfo.GetString(0), listeninfo.GetString(1), StringAsInt(listeninfo.GetString(2)), LISTEN_CONSOLE_SOCKET);
        }
    }
//.........这里部分代码省略.........
开发者ID:854825967,项目名称:kernel,代码行数:101,代码来源:NetSystem.cpp


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