本文整理汇总了C++中CConfigFile::clear方法的典型用法代码示例。如果您正苦于以下问题:C++ CConfigFile::clear方法的具体用法?C++ CConfigFile::clear怎么用?C++ CConfigFile::clear使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CConfigFile
的用法示例。
在下文中一共展示了CConfigFile::clear方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ReadSettings
void CFBCallMonitor::ReadSettings()
{
CConfigFile *bpfbconfig = new CConfigFile(',');
bpfbconfig->clear();
bpfbconfig->loadConfig(CONFIG_FILE);
FB_IP_STRG = bpfbconfig->getString("FRITZBOXIP", "fritz.box");
FB_PORT_STRG = bpfbconfig->getString("TELDPORT", "1012");
FB_ZIEL1_STRG = bpfbconfig->getString("Ziel_1", "01234567890");
FB_ZIEL1N_STRG = bpfbconfig->getString("Ziel_1_name", "Nummer_1");
FB_ZIEL2_STRG = bpfbconfig->getString("Ziel_2", "01234567890");
FB_ZIEL2N_STRG = bpfbconfig->getString("Ziel_2_name", "Nummer_2");
FB_ZIEL3_STRG = bpfbconfig->getString("Ziel_3", "01234567890");
FB_ZIEL3N_STRG = bpfbconfig->getString("Ziel_3_name", "Nummer_3");
FB_BOXIP_STRG = bpfbconfig->getString("ip", "127.0.0.1");
FB_BOXUSERNAME_STRG = bpfbconfig->getString("loginname", "root");
FB_BOXPASSWORD_STRG = bpfbconfig->getString("passwort", "root");
FB_DEBUG = bpfbconfig->getInt32("debug", 0);
FB_ALLE = bpfbconfig->getInt32("Alle", 0);
FB_MONRING = bpfbconfig->getInt32("monRing", 1);
FB_MONDISCONNECT = bpfbconfig->getInt32("monDisconnect", 1);
FB_MUTERING = bpfbconfig->getInt32("muteRing", 1);
FB_POPUP = bpfbconfig->getInt32("popup", 0);
FB_INVERS = bpfbconfig->getInt32("invers", 1);
}
示例2: saveEventsToConfig
void CTimerManager::saveEventsToConfig()
{
CConfigFile *config = new CConfigFile(',');
config->clear();
CTimerEventMap::iterator pos = events.begin();
for(;pos != events.end();pos++)
{
CTimerEvent *event = pos->second;
event->saveToConfig(config);
}
config->saveConfig(CONFIGFILE);
delete config;
}
示例3: ReadConfig
//-----------------------------------------------------------------------------
// Read Webserver Configurationfile
// Call "Hooks_ReadConfig" so Hooks can read/write own Configuration Values
//-----------------------------------------------------------------------------
void Cyhttpd::ReadConfig(void) {
log_level_printf(3, "ReadConfig Start\n");
CConfigFile *Config = new CConfigFile(',');
bool have_config = false;
if (access(HTTPD_CONFIGFILE, R_OK) == 0)
have_config = true;
Config->loadConfig(HTTPD_CONFIGFILE);
// convert old config files
if (have_config) {
if (Config->getInt32("configfile.version", 0) == 0) {
CConfigFile OrgConfig = *Config;
Config->clear();
Config->setInt32("server.log.loglevel", OrgConfig.getInt32(
"LogLevel", 0));
Config->setInt32("configfile.version", CONF_VERSION);
Config->setString("webserver.websites", "WebsiteMain");
Config->setBool("webserver.threading", OrgConfig.getBool("THREADS",
true));
Config->setInt32("WebsiteMain.port", OrgConfig.getInt32("Port",
HTTPD_STANDARD_PORT));
Config->setString("WebsiteMain.directory", OrgConfig.getString(
"PrivatDocRoot", PRIVATEDOCUMENTROOT));
if (!OrgConfig.getString("PublicDocRoot", "").empty())
Config->setString("WebsiteMain.override_directory",
OrgConfig.getString("PublicDocRoot",
PRIVATEDOCUMENTROOT));
// mod_auth
Config->setString("mod_auth.username", OrgConfig.getString(
"AuthUser", AUTHUSER));
Config->setString("mod_auth.password", OrgConfig.getString(
"AuthPassword", AUTHPASSWORD));
Config->setString("mod_auth.no_auth_client", OrgConfig.getString(
"NoAuthClient", ""));
Config->setString("mod_auth.authenticate", OrgConfig.getString(
"Authenticate", "false"));
Config->setString("mod_sendfile.mime_types", HTTPD_SENDFILE_EXT);
Config->saveConfig(HTTPD_CONFIGFILE);
}
// Add Defaults for Version 2
if (Config->getInt32("configfile.version") < 2) {
Config->setString("mod_sendfile.mime_types", HTTPD_SENDFILE_EXT);
Config->setInt32("configfile.version", CONF_VERSION);
Config->setString("mod_sendfile.sendAll", "false");
Config->saveConfig(HTTPD_CONFIGFILE);
}
// Add Defaults for Version 4
if (Config->getInt32("configfile.version") < 4) {
Config->setInt32("configfile.version", CONF_VERSION);
Config->setString("Language.selected", HTTPD_DEFAULT_LANGUAGE);
Config->setString("Language.directory", HTTPD_LANGUAGEDIR);
if (Config->getString("WebsiteMain.hosted_directory", "").empty())
Config->setString("WebsiteMain.hosted_directory", HOSTEDDOCUMENTROOT);
Config->saveConfig(HTTPD_CONFIGFILE);
}
}
// configure debugging & logging
if (CLogging::getInstance()->LogLevel == 0)
CLogging::getInstance()->LogLevel = Config->getInt32("server.log.loglevel", 0);
if (CLogging::getInstance()->LogLevel > 0)
CLogging::getInstance()->setDebug(true);
// get variables
webserver->init(Config->getInt32("WebsiteMain.port", HTTPD_STANDARD_PORT),
Config->getBool("webserver.threading", true));
// informational use
ConfigList["WebsiteMain.port"] = itoa(Config->getInt32("WebsiteMain.port",
HTTPD_STANDARD_PORT));
ConfigList["webserver.threading"] = Config->getString(
"webserver.threading", "true");
ConfigList["configfile.version"] = Config->getInt32("configfile.version",
CONF_VERSION);
ConfigList["server.log.loglevel"] = itoa(Config->getInt32(
"server.log.loglevel", 0));
ConfigList["server.no_keep-alive_ips"] = Config->getString(
"server.no_keep-alive_ips", "");
webserver->conf_no_keep_alive_ips = Config->getStringVector(
"server.no_keep-alive_ips");
// MainSite
ConfigList["WebsiteMain.directory"] = Config->getString(
"WebsiteMain.directory", PRIVATEDOCUMENTROOT);
ConfigList["WebsiteMain.override_directory"] = Config->getString(
"WebsiteMain.override_directory", PUBLICDOCUMENTROOT);
ConfigList["WebsiteMain.hosted_directory"] = Config->getString(
"WebsiteMain.hosted_directory", HOSTEDDOCUMENTROOT);
ConfigList["Tuxbox.DisplayLogos"] = Config->getString("Tuxbox.DisplayLogos", "true");
// Check location of logos
if (Config->getString("Tuxbox.LogosURL", "").empty()) {
if (access(ConfigList["WebsiteMain.override_directory"] + "/logos", R_OK) == 0) {
Config->setString("Tuxbox.LogosURL", ConfigList["WebsiteMain.override_directory"] + "/logos");
have_config = false; //save config
//.........这里部分代码省略.........
示例4: ReadConfig
//-----------------------------------------------------------------------------
// Read Webserver Configurationfile
// Call "Hooks_ReadConfig" so Hooks can read/write own Configuration Values
//-----------------------------------------------------------------------------
void Cyhttpd::ReadConfig(void)
{
log_level_printf(3,"ReadConfig Start\n");
CConfigFile *Config = new CConfigFile(',');
bool have_config = false;
if(access(HTTPD_CONFIGFILE,4) == 0)
have_config = true;
Config->loadConfig(HTTPD_CONFIGFILE);
// convert old config files
if(have_config)
if(Config->getInt32("Port", 0) != 0)
{
CConfigFile OrgConfig = *Config;
Config->clear();
Config->setInt32("server.log.loglevel", OrgConfig.getInt32("LogLevel", 0));
Config->setString("configfile.version", "1");
Config->setString("webserver.websites", "WebsiteMain");
Config->setBool("webserver.threading", OrgConfig.getBool("THREADS", true));
Config->setInt32("WebsiteMain.port",OrgConfig.getInt32("Port", HTTPD_STANDARD_PORT));
Config->setString("WebsiteMain.directory", OrgConfig.getString("PrivatDocRoot", PRIVATEDOCUMENTROOT));
if(OrgConfig.getString("PublicDocRoot", "") != "")
Config->setString("WebsiteMain.override_directory", OrgConfig.getString("PublicDocRoot", PRIVATEDOCUMENTROOT));
if(OrgConfig.getString("HostedDocRoot", "") != "")
Config->setString("WebsiteMain.special_locations", "/hosted/="+OrgConfig.getString("HostedDocRoot", PRIVATEDOCUMENTROOT));
if(OrgConfig.getString("HostedDocRoot", "") != "")
Config->setString("Tuxbox.HostedDocumentRoot", OrgConfig.getString("HostedDocRoot", PRIVATEDOCUMENTROOT));
// mod_auth
Config->setString("mod_auth.username", OrgConfig.getString("AuthUser", AUTHUSER));
Config->setString("mod_auth.password", OrgConfig.getString("AuthPassword", AUTHPASSWORD));
Config->setString("mod_auth.no_auth_client", OrgConfig.getString("NoAuthClient", ""));
Config->setString("mod_auth.authenticate", OrgConfig.getString("Authenticate", "false"));
Config->setString("mod_sendfile.mime_types", HTTPD_SENDFILE_EXT);
Config->saveConfig(HTTPD_CONFIGFILE);
}
// configure debugging & logging
if(CLogging::getInstance()->LogLevel == 0)
CLogging::getInstance()->LogLevel = Config->getInt32("server.log.loglevel", 0);
// get variables
webserver->init(Config->getInt32("WebsiteMain.port", HTTPD_STANDARD_PORT), Config->getBool("webserver.threading", true));
// informational use
ConfigList["WebsiteMain.port"]= itoa(Config->getInt32("WebsiteMain.port", HTTPD_STANDARD_PORT));
ConfigList["webserver.threading"]= Config->getString("webserver.threading", "true");
ConfigList["configfile.version"]= Config->getString("configfile.version", "1");
ConfigList["server.log.loglevel"]= itoa(Config->getInt32("server.log.loglevel", 0));
ConfigList["server.no_keep-alive_ips"]= Config->getString("server.no_keep-alive_ips", "");
webserver->conf_no_keep_alive_ips = Config->getStringVector("server.no_keep-alive_ips");
// MainSite
ConfigList["PrivatDocumentRoot"]= Config->getString("WebsiteMain.directory", PRIVATEDOCUMENTROOT);
ConfigList["PublicDocumentRoot"]= Config->getString("WebsiteMain.override_directory", PUBLICDOCUMENTROOT);
ConfigList["HostedDocumentRoot"]= Config->getString("Tuxbox.HostedDocumentRoot", HOSTEDDOCUMENTROOT);
#ifdef Y_CONFIG_USE_OPEN_SSL
ConfigList["SSL"] = Config->getString("WebsiteMain.ssl", "false");
ConfigList["SSL_pemfile"] = Config->getString("WebsiteMain.ssl_pemfile", SSL_PEMFILE);
ConfigList["SSL_CA_file"] = Config->getString("WebsiteMain.ssl_ca_file", SSL_CA_FILE);
CySocket::SSL_pemfile = ConfigList["SSL_pemfile"];
CySocket::SSL_CA_file = ConfigList["SSL_CA_file"];
if(ConfigList["SSL"] == "true")
CySocket::initSSL();
#endif
ConfigList["server.user_name"]= Config->getString("server.user_name", "");
ConfigList["server.group_name"]= Config->getString("server.group_name", "");
ConfigList["server.chroot"]= Config->getString("server.chroot", "");
// Read App specifig settings by Hook
CyhookHandler::Hooks_ReadConfig(Config, ConfigList);
// Save if new defaults are set
if (!have_config)
Config->saveConfig(HTTPD_CONFIGFILE);
log_level_printf(3,"ReadConfig End\n");
delete Config;
}