本文整理汇总了C++中CConfig::AddSubConfig方法的典型用法代码示例。如果您正苦于以下问题:C++ CConfig::AddSubConfig方法的具体用法?C++ CConfig::AddSubConfig怎么用?C++ CConfig::AddSubConfig使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CConfig
的用法示例。
在下文中一共展示了CConfig::AddSubConfig方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ToConfig
CConfig CIRCNetwork::ToConfig() {
CConfig config;
if (!m_sNick.empty()) {
config.AddKeyValuePair("Nick", m_sNick);
}
if (!m_sAltNick.empty()) {
config.AddKeyValuePair("AltNick", m_sAltNick);
}
if (!m_sIdent.empty()) {
config.AddKeyValuePair("Ident", m_sIdent);
}
if (!m_sRealName.empty()) {
config.AddKeyValuePair("RealName", m_sRealName);
}
if (!m_sBindHost.empty()) {
config.AddKeyValuePair("BindHost", m_sBindHost);
}
config.AddKeyValuePair("IRCConnectEnabled", CString(GetIRCConnectEnabled()));
config.AddKeyValuePair("FloodRate", CString(GetFloodRate()));
config.AddKeyValuePair("FloodBurst", CString(GetFloodBurst()));
// Modules
CModules& Mods = GetModules();
if (!Mods.empty()) {
for (unsigned int a = 0; a < Mods.size(); a++) {
CString sArgs = Mods[a]->GetArgs();
if (!sArgs.empty()) {
sArgs = " " + sArgs;
}
config.AddKeyValuePair("LoadModule", Mods[a]->GetModName() + sArgs);
}
}
// Servers
for (unsigned int b = 0; b < m_vServers.size(); b++) {
config.AddKeyValuePair("Server", m_vServers[b]->GetString());
}
// Chans
for (unsigned int c = 0; c < m_vChans.size(); c++) {
CChan* pChan = m_vChans[c];
if (pChan->InConfig()) {
config.AddSubConfig("Chan", pChan->GetName(), pChan->ToConfig());
}
}
return config;
}
示例2: ToConfig
CConfig CIRCNetwork::ToConfig() const {
CConfig config;
if (!m_sNick.empty()) {
config.AddKeyValuePair("Nick", m_sNick);
}
if (!m_sAltNick.empty()) {
config.AddKeyValuePair("AltNick", m_sAltNick);
}
if (!m_sIdent.empty()) {
config.AddKeyValuePair("Ident", m_sIdent);
}
if (!m_sRealName.empty()) {
config.AddKeyValuePair("RealName", m_sRealName);
}
if (!m_sBindHost.empty()) {
config.AddKeyValuePair("BindHost", m_sBindHost);
}
config.AddKeyValuePair("IRCConnectEnabled", CString(GetIRCConnectEnabled()));
config.AddKeyValuePair("FloodRate", CString(GetFloodRate()));
config.AddKeyValuePair("FloodBurst", CString(GetFloodBurst()));
config.AddKeyValuePair("JoinDelay", CString(GetJoinDelay()));
config.AddKeyValuePair("Encoding", m_sEncoding);
if (!m_sQuitMsg.empty()) {
config.AddKeyValuePair("QuitMsg", m_sQuitMsg);
}
// Modules
const CModules& Mods = GetModules();
if (!Mods.empty()) {
for (CModule* pMod : Mods) {
CString sArgs = pMod->GetArgs();
if (!sArgs.empty()) {
sArgs = " " + sArgs;
}
config.AddKeyValuePair("LoadModule", pMod->GetModName() + sArgs);
}
}
// Servers
for (CServer* pServer : m_vServers) {
config.AddKeyValuePair("Server", pServer->GetString());
}
for (const CString& sFP : m_ssTrustedFingerprints) {
config.AddKeyValuePair("TrustedServerFingerprint", sFP);
}
// Chans
for (CChan* pChan : m_vChans) {
if (pChan->InConfig()) {
config.AddSubConfig("Chan", pChan->GetName(), pChan->ToConfig());
}
}
return config;
}
示例3: ToConfig
CConfig CUser::ToConfig() {
CConfig config;
CConfig passConfig;
CString sHash;
switch (m_eHashType) {
case HASH_NONE:
sHash = "Plain";
break;
case HASH_MD5:
sHash = "MD5";
break;
case HASH_SHA256:
sHash = "SHA256";
break;
}
passConfig.AddKeyValuePair("Salt", m_sPassSalt);
passConfig.AddKeyValuePair("Method", sHash);
passConfig.AddKeyValuePair("Hash", GetPass());
config.AddSubConfig("Pass", "password", passConfig);
config.AddKeyValuePair("Nick", GetNick());
config.AddKeyValuePair("AltNick", GetAltNick());
config.AddKeyValuePair("Ident", GetIdent());
config.AddKeyValuePair("RealName", GetRealName());
config.AddKeyValuePair("BindHost", GetBindHost());
config.AddKeyValuePair("DCCBindHost", GetDCCBindHost());
config.AddKeyValuePair("QuitMsg", GetQuitMsg());
if (CZNC::Get().GetStatusPrefix() != GetStatusPrefix())
config.AddKeyValuePair("StatusPrefix", GetStatusPrefix());
config.AddKeyValuePair("Skin", GetSkinName());
config.AddKeyValuePair("Language", GetLanguage());
config.AddKeyValuePair("ChanModes", GetDefaultChanModes());
config.AddKeyValuePair("Buffer", CString(GetBufferCount()));
config.AddKeyValuePair("KeepBuffer", CString(KeepBuffer()));
config.AddKeyValuePair("MultiClients", CString(MultiClients()));
config.AddKeyValuePair("DenyLoadMod", CString(DenyLoadMod()));
config.AddKeyValuePair("Admin", CString(IsAdmin()));
config.AddKeyValuePair("DenySetBindHost", CString(DenySetBindHost()));
config.AddKeyValuePair("TimestampFormat", GetTimestampFormat());
config.AddKeyValuePair("AppendTimestamp", CString(GetTimestampAppend()));
config.AddKeyValuePair("PrependTimestamp", CString(GetTimestampPrepend()));
config.AddKeyValuePair("TimezoneOffset", CString(m_fTimezoneOffset));
config.AddKeyValuePair("JoinTries", CString(m_uMaxJoinTries));
config.AddKeyValuePair("MaxJoins", CString(m_uMaxJoins));
config.AddKeyValuePair("IRCConnectEnabled", CString(GetIRCConnectEnabled()));
// Allow Hosts
if (!m_ssAllowedHosts.empty()) {
for (set<CString>::iterator it = m_ssAllowedHosts.begin(); it != m_ssAllowedHosts.end(); ++it) {
config.AddKeyValuePair("Allow", *it);
}
}
// CTCP Replies
if (!m_mssCTCPReplies.empty()) {
for (MCString::const_iterator itb = m_mssCTCPReplies.begin(); itb != m_mssCTCPReplies.end(); ++itb) {
config.AddKeyValuePair("CTCPReply", itb->first.AsUpper() + " " + itb->second);
}
}
// Modules
CModules& Mods = GetModules();
if (!Mods.empty()) {
for (unsigned int a = 0; a < Mods.size(); a++) {
CString sArgs = Mods[a]->GetArgs();
if (!sArgs.empty()) {
sArgs = " " + sArgs;
}
config.AddKeyValuePair("LoadModule", Mods[a]->GetModName() + sArgs);
}
}
// Networks
for (unsigned int d = 0; d < m_vIRCNetworks.size(); d++) {
CIRCNetwork *pNetwork = m_vIRCNetworks[d];
config.AddSubConfig("Network", pNetwork->GetName(), pNetwork->ToConfig());
}
return config;
}
示例4: ToConfig
CConfig CUser::ToConfig() const {
CConfig config;
CConfig passConfig;
CString sHash;
switch (m_eHashType) {
case HASH_NONE:
sHash = "Plain";
break;
case HASH_MD5:
sHash = "MD5";
break;
case HASH_SHA256:
sHash = "SHA256";
break;
}
passConfig.AddKeyValuePair("Salt", m_sPassSalt);
passConfig.AddKeyValuePair("Method", sHash);
passConfig.AddKeyValuePair("Hash", GetPass());
config.AddSubConfig("Pass", "password", passConfig);
config.AddKeyValuePair("Nick", GetNick());
config.AddKeyValuePair("AltNick", GetAltNick());
config.AddKeyValuePair("Ident", GetIdent());
if (!m_sRealName.empty()) {
config.AddKeyValuePair("RealName", GetRealName());
}
config.AddKeyValuePair("BindHost", GetBindHost());
config.AddKeyValuePair("DCCBindHost", GetDCCBindHost());
config.AddKeyValuePair("QuitMsg", GetQuitMsg());
if (CZNC::Get().GetStatusPrefix() != GetStatusPrefix())
config.AddKeyValuePair("StatusPrefix", GetStatusPrefix());
config.AddKeyValuePair("Skin", GetSkinName());
config.AddKeyValuePair("ChanModes", GetDefaultChanModes());
config.AddKeyValuePair("ChanBufferSize", CString(GetChanBufferSize()));
config.AddKeyValuePair("QueryBufferSize", CString(GetQueryBufferSize()));
config.AddKeyValuePair("AutoClearChanBuffer",
CString(AutoClearChanBuffer()));
config.AddKeyValuePair("AutoClearQueryBuffer",
CString(AutoClearQueryBuffer()));
config.AddKeyValuePair("MultiClients", CString(MultiClients()));
config.AddKeyValuePair("DenyLoadMod", CString(DenyLoadMod()));
config.AddKeyValuePair("Admin", CString(IsAdmin()));
config.AddKeyValuePair("DenySetBindHost", CString(DenySetBindHost()));
config.AddKeyValuePair("TimestampFormat", GetTimestampFormat());
config.AddKeyValuePair("AppendTimestamp", CString(GetTimestampAppend()));
config.AddKeyValuePair("PrependTimestamp", CString(GetTimestampPrepend()));
config.AddKeyValuePair("Timezone", m_sTimezone);
config.AddKeyValuePair("JoinTries", CString(m_uMaxJoinTries));
config.AddKeyValuePair("MaxNetworks", CString(m_uMaxNetworks));
config.AddKeyValuePair("MaxQueryBuffers", CString(m_uMaxQueryBuffers));
config.AddKeyValuePair("MaxJoins", CString(m_uMaxJoins));
config.AddKeyValuePair("ClientEncoding", GetClientEncoding());
// Allow Hosts
if (!m_ssAllowedHosts.empty()) {
for (const CString& sHost : m_ssAllowedHosts) {
config.AddKeyValuePair("Allow", sHost);
}
}
// CTCP Replies
if (!m_mssCTCPReplies.empty()) {
for (const auto& itb : m_mssCTCPReplies) {
config.AddKeyValuePair("CTCPReply",
itb.first.AsUpper() + " " + itb.second);
}
}
// Modules
const CModules& Mods = GetModules();
if (!Mods.empty()) {
for (CModule* pMod : Mods) {
CString sArgs = pMod->GetArgs();
if (!sArgs.empty()) {
sArgs = " " + sArgs;
}
config.AddKeyValuePair("LoadModule", pMod->GetModName() + sArgs);
}
}
// Networks
for (CIRCNetwork* pNetwork : m_vIRCNetworks) {
config.AddSubConfig("Network", pNetwork->GetName(),
pNetwork->ToConfig());
}
return config;
}