本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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;
}