本文整理汇总了C++中inifile::Section::GetName方法的典型用法代码示例。如果您正苦于以下问题:C++ Section::GetName方法的具体用法?C++ Section::GetName怎么用?C++ Section::GetName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类inifile::Section
的用法示例。
在下文中一共展示了Section::GetName方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: LoadBot
void BnxDriver::LoadBot(const IniFile::Section &clSection) {
bool bEnabled = clSection.GetValue<bool>("enabled", true);
if (!bEnabled)
return;
std::string strServer = clSection.GetValue<std::string>("server", "");
std::string strNickname = clSection.GetValue<std::string>("nickname", "");
if (strServer.empty() || strNickname.empty())
return;
BnxBot *pclBot = GetBot(clSection.GetName());
if (pclBot == NULL) {
pclBot = new BnxBot();
pclBot->SetProfileName(clSection.GetName());
m_vBots.push_back(pclBot);
}
std::string strPort = clSection.GetValue<std::string>("port", "6667");
std::string strUsername = clSection.GetValue<std::string>("username", "BnxBot");
std::string strRealName = clSection.GetValue<std::string>("realname", "BnxBot");
std::string strAccessList = clSection.GetValue<std::string>("accesslist", "access.lst");
std::string strShitList = clSection.GetValue<std::string>("shitlist", "shit.lst");
std::string strSeenList = clSection.GetValue<std::string>("seenlist", "seen.lst");
std::string strResponseRules = clSection.GetValue<std::string>("responserules", "response.txt");
std::string strHomeChannels = clSection.GetValue<std::string>("homechannels", "");
std::string strNickServ = clSection.GetValue<std::string>("nickserv", "");
std::string strNickServPassword = clSection.GetValue<std::string>("nickservpassword", "");
pclBot->SetServerAndPort(strServer, strPort);
pclBot->SetNickServAndPassword(strNickServ, strNickServPassword);
pclBot->SetNickname(strNickname);
pclBot->SetUsername(strUsername);
pclBot->SetRealName(strRealName);
pclBot->LoadResponseRules(strResponseRules);
pclBot->LoadAccessList(strAccessList);
pclBot->LoadShitList(strShitList);
pclBot->LoadSeenList(strSeenList);
pclBot->SetLogFile(m_strLogFile);
pclBot->SetHomeChannels(strHomeChannels);
}
示例2: LoadFromSystemSection
void LoadFromSystemSection(Config::Layer* layer, const IniFile::Section& section) const
{
const std::string section_name = section.GetName();
// Regular key,value pairs
const IniFile::Section::SectionMap& section_map = section.GetValues();
for (const auto& value : section_map)
{
const auto location = MapINIToRealLocation(section_name, value.first);
if (location.section.empty() && location.key.empty())
continue;
layer->Set(location, value.second);
}
}
示例3: LoadFromSystemSection
void LoadFromSystemSection(Config::Layer* config_layer, const IniFile::Section& section) const
{
const std::string section_name = section.GetName();
if (section.HasLines())
{
// Trash INI File chunks
std::vector<std::string> chunk;
section.GetLines(&chunk, true);
if (chunk.size())
{
const auto mapped_config = MapINIToRealLocation(section_name, "");
if (mapped_config.section.empty() && mapped_config.key.empty())
return;
auto* config_section =
config_layer->GetOrCreateSection(mapped_config.system, mapped_config.section);
config_section->SetLines(chunk);
}
}
// Regular key,value pairs
const IniFile::Section::SectionMap& section_map = section.GetValues();
for (const auto& value : section_map)
{
const auto mapped_config = MapINIToRealLocation(section_name, value.first);
if (mapped_config.section.empty() && mapped_config.key.empty())
continue;
auto* config_section =
config_layer->GetOrCreateSection(mapped_config.system, mapped_config.section);
config_section->Set(mapped_config.key, value.second);
}
}