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


C++ ConfigFile::getName方法代码示例

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


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

示例1: findFileName

bool
Configuration::saveFile(std::string name)
{
    int idx = findFileName(name);
    if(idx >= 0) {
        ConfigFile *c = m_ConfigFiles.at(idx);
        switch(c->getMode()) {
        case eFM_ReadOnly:
            debugOutput(DEBUG_LEVEL_VERBOSE, "Not saving readonly config file: %s\n", c->getName().c_str());
            break;
        case eFM_Temporary:
            debugOutput(DEBUG_LEVEL_VERBOSE, "Not saving temporary config file: %s\n", c->getName().c_str());
            break;
        case eFM_ReadWrite:
            debugOutput(DEBUG_LEVEL_VERBOSE, "Saving config file: %s\n", c->getName().c_str());
            try {
                c->writeFile();
            } catch (...) {
                debugError("Could not write file: %s\n", c->getName().c_str());
                return false;
            }
        default:
            debugOutput(DEBUG_LEVEL_VERBOSE, "bad mode for file: %s\n", c->getName().c_str());
        }
    }
    return true;
}
开发者ID:,项目名称:,代码行数:27,代码来源:

示例2: debugOutput

libconfig::Setting *
Configuration::getDeviceSetting( unsigned int vendor_id, unsigned model_id )
{
    for ( std::vector<ConfigFile *>::iterator it = m_ConfigFiles.begin();
      it != m_ConfigFiles.end();
      ++it )
    {
        ConfigFile *c = *it;
        try {
            Setting &list = c->lookup("device_definitions");
            unsigned int children = list.getLength();
            for(unsigned int i = 0; i < children; i++) {
                Setting &s = list[i];
                try {
                    Setting &vendorid = s["vendorid"];
                    Setting &modelid = s["modelid"];
                    uint32_t vid = vendorid;
                    uint32_t mid = modelid;
                    if (vendor_id == vid && model_id == mid) {
                        debugOutput(DEBUG_LEVEL_VERBOSE,
                                    "  device VME for %X:%x found in %s\n",
                                    vendor_id, model_id, c->getName().c_str());
                        c->showSetting(s);
                        return &s;
                    }
                } catch (...) {
                    debugWarning("Bogus format\n");
                }
            }
        } catch (...) {
            debugOutput(DEBUG_LEVEL_VERBOSE, "  %s has no device definitions\n", c->getName().c_str());
        }
    }
    return NULL;
}
开发者ID:,项目名称:,代码行数:35,代码来源:

示例3: switch

bool
Configuration::save()
{
    bool retval = true;
    for (unsigned int idx = 0; idx < m_ConfigFiles.size(); idx++) {
        ConfigFile *c = m_ConfigFiles.at(idx);
        switch(c->getMode()) {
        case eFM_ReadOnly:
            debugOutput(DEBUG_LEVEL_VERBOSE, "Not saving readonly config file: %s\n", c->getName().c_str());
            break;
        case eFM_Temporary:
            debugOutput(DEBUG_LEVEL_VERBOSE, "Not saving temporary config file: %s\n", c->getName().c_str());
            break;
        case eFM_ReadWrite:
            debugOutput(DEBUG_LEVEL_VERBOSE, "Saving config file: %s\n", c->getName().c_str());
            try {
                c->writeFile();
            } catch (...) {
                debugError("Could not write file: %s\n", c->getName().c_str());
                retval = false;
            }
        default:
            debugOutput(DEBUG_LEVEL_VERBOSE, "bad mode for file: %s\n", c->getName().c_str());
        }
    }
    return retval;
}
开发者ID:,项目名称:,代码行数:27,代码来源:

示例4: catch

libconfig::Setting *
Configuration::getSetting( std::string path )
{
    for ( std::vector<ConfigFile *>::iterator it = m_ConfigFiles.begin();
      it != m_ConfigFiles.end();
      ++it )
    {
        ConfigFile *c = *it;
        try {
            Setting &s = c->lookup(path);
            return &s;
        } catch (...) {
            debugOutput(DEBUG_LEVEL_VERY_VERBOSE, "  %s has no setting %s\n",
                        c->getName().c_str(), path.c_str());
        }
    }
    return NULL;
}
开发者ID:,项目名称:,代码行数:18,代码来源:


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