ConfigManager::ConfigManager()
  : m_initialized(false)
{
  addParameter(ConfigParameter("configfile:", "c", CONFIGFILE_CONFIG_KEY,
                               "Specifies the path to the configuration file."));
  Getopt::instance().addParameter(GetoptParameter("dump-config", "dc",
                                  "Dump the configuration read from the configuration file."));
  Getopt::instance().addParameter(GetoptParameter("config-option:", "o",
                                                    "Overwrite a configuration option.", true));
}
示例#2
0
    bool ConfigTree::paramFromPtree(ptree fromPtree, ConfigParameter &toParam)
    {
        CONFIGSYS_DEBUG_CALLS;

        std::string typStr = fromPtree.get<std::string>("type");
        value_type vt = stringToValueType(typStr);
        
        toParam = ConfigParameter(vt);

        toParam.setDescription(fromPtree.get("desc", ""));

        std::string modStr = fromPtree.get("modified", "false");
        toParam.setModified(modStr.compare("true") == 0);

        std::string lockStr = fromPtree.get("locked", "false");
        toParam.setLocked(lockStr.compare("true") == 0);

        return addPtreeValueandRangeToParam(fromPtree, toParam);
    }