Replaces StringPairArray with Section in Config.

This commit is contained in:
seelabs
2015-03-06 15:32:20 -08:00
committed by Tom Ritchford
parent 8f88d915ba
commit 6b9e842ddd
28 changed files with 165 additions and 281 deletions

View File

@@ -147,36 +147,6 @@ bool getSingleSection (IniFileSections& secSource,
return bSingle;
}
beast::StringPairArray
parseKeyValueSection (IniFileSections& secSource, std::string const& strSection)
{
beast::StringPairArray result;
typedef IniFileSections::mapped_type Entries;
Entries* const entries = getIniFileSection (secSource, strSection);
if (entries != nullptr)
{
for (Entries::const_iterator iter = entries->begin ();
iter != entries->end (); ++iter)
{
std::string const line (iter->c_str ());
int const equalPos = line.find ('=');
if (equalPos != std::string::npos)
{
result.set (
line.substr (0, equalPos),
line.substr (equalPos + 1));
}
}
}
return result;
}
/** Parses a set of strings into IP::Endpoint
Strings which fail to parse are not included in the output. If a stream is
provided, human readable diagnostic error messages are written for each
@@ -469,17 +439,6 @@ void Config::loadFromString (std::string const& fileContents)
parsedAddresses.cbegin (), parsedAddresses.cend ());
}
insightSettings = parseKeyValueSection (secConfig, SECTION_INSIGHT);
nodeDatabase = parseKeyValueSection (
secConfig, ConfigSection::nodeDatabase ());
ephemeralNodeDatabase = parseKeyValueSection (
secConfig, ConfigSection::tempNodeDatabase ());
importNodeDatabase = parseKeyValueSection (
secConfig, ConfigSection::importNodeDatabase ());
if (getSingleSection (secConfig, SECTION_NODE_SIZE, strTemp))
{
if (strTemp == "tiny")