mirror of
https://github.com/Xahau/xahaud.git
synced 2025-11-29 06:55:49 +00:00
Cleanup: Combine Section and BasicConfig, move to basics
This commit is contained in:
@@ -2315,12 +2315,17 @@
|
|||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="..\..\src\ripple\basics\ArraySize.h">
|
<ClInclude Include="..\..\src\ripple\basics\ArraySize.h">
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\src\ripple\basics\BasicConfig.h">
|
||||||
|
</ClInclude>
|
||||||
<ClInclude Include="..\..\src\ripple\basics\BasicTypes.h">
|
<ClInclude Include="..\..\src\ripple\basics\BasicTypes.h">
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="..\..\src\ripple\basics\CheckLibraryVersions.h">
|
<ClInclude Include="..\..\src\ripple\basics\CheckLibraryVersions.h">
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="..\..\src\ripple\basics\CountedObject.h">
|
<ClInclude Include="..\..\src\ripple\basics\CountedObject.h">
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClCompile Include="..\..\src\ripple\basics\impl\BasicConfig.cpp">
|
||||||
|
<ExcludedFromBuild>True</ExcludedFromBuild>
|
||||||
|
</ClCompile>
|
||||||
<ClCompile Include="..\..\src\ripple\basics\impl\CheckLibraryVersions.cpp">
|
<ClCompile Include="..\..\src\ripple\basics\impl\CheckLibraryVersions.cpp">
|
||||||
<ExcludedFromBuild>True</ExcludedFromBuild>
|
<ExcludedFromBuild>True</ExcludedFromBuild>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
@@ -2333,6 +2338,9 @@
|
|||||||
<ClCompile Include="..\..\src\ripple\basics\impl\RangeSet.cpp">
|
<ClCompile Include="..\..\src\ripple\basics\impl\RangeSet.cpp">
|
||||||
<ExcludedFromBuild>True</ExcludedFromBuild>
|
<ExcludedFromBuild>True</ExcludedFromBuild>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\src\ripple\basics\impl\Section.cpp">
|
||||||
|
<ExcludedFromBuild>True</ExcludedFromBuild>
|
||||||
|
</ClCompile>
|
||||||
<ClCompile Include="..\..\src\ripple\basics\impl\StringUtilities.cpp">
|
<ClCompile Include="..\..\src\ripple\basics\impl\StringUtilities.cpp">
|
||||||
<ExcludedFromBuild>True</ExcludedFromBuild>
|
<ExcludedFromBuild>True</ExcludedFromBuild>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
@@ -2354,6 +2362,8 @@
|
|||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="..\..\src\ripple\basics\RangeSet.h">
|
<ClInclude Include="..\..\src\ripple\basics\RangeSet.h">
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\src\ripple\basics\Section.h">
|
||||||
|
</ClInclude>
|
||||||
<ClInclude Include="..\..\src\ripple\basics\StringUtilities.h">
|
<ClInclude Include="..\..\src\ripple\basics\StringUtilities.h">
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="..\..\src\ripple\basics\Sustain.h">
|
<ClInclude Include="..\..\src\ripple\basics\Sustain.h">
|
||||||
@@ -2434,9 +2444,6 @@
|
|||||||
<ClCompile Include="..\..\src\ripple\core\impl\LoadMonitor.cpp">
|
<ClCompile Include="..\..\src\ripple\core\impl\LoadMonitor.cpp">
|
||||||
<ExcludedFromBuild>True</ExcludedFromBuild>
|
<ExcludedFromBuild>True</ExcludedFromBuild>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="..\..\src\ripple\core\impl\Section.cpp">
|
|
||||||
<ExcludedFromBuild>True</ExcludedFromBuild>
|
|
||||||
</ClCompile>
|
|
||||||
<ClInclude Include="..\..\src\ripple\core\Job.h">
|
<ClInclude Include="..\..\src\ripple\core\Job.h">
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="..\..\src\ripple\core\JobQueue.h">
|
<ClInclude Include="..\..\src\ripple\core\JobQueue.h">
|
||||||
|
|||||||
@@ -3336,6 +3336,9 @@
|
|||||||
<ClInclude Include="..\..\src\ripple\basics\ArraySize.h">
|
<ClInclude Include="..\..\src\ripple\basics\ArraySize.h">
|
||||||
<Filter>ripple\basics</Filter>
|
<Filter>ripple\basics</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\src\ripple\basics\BasicConfig.h">
|
||||||
|
<Filter>ripple\basics</Filter>
|
||||||
|
</ClInclude>
|
||||||
<ClInclude Include="..\..\src\ripple\basics\BasicTypes.h">
|
<ClInclude Include="..\..\src\ripple\basics\BasicTypes.h">
|
||||||
<Filter>ripple\basics</Filter>
|
<Filter>ripple\basics</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
@@ -3345,6 +3348,9 @@
|
|||||||
<ClInclude Include="..\..\src\ripple\basics\CountedObject.h">
|
<ClInclude Include="..\..\src\ripple\basics\CountedObject.h">
|
||||||
<Filter>ripple\basics</Filter>
|
<Filter>ripple\basics</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClCompile Include="..\..\src\ripple\basics\impl\BasicConfig.cpp">
|
||||||
|
<Filter>ripple\basics\impl</Filter>
|
||||||
|
</ClCompile>
|
||||||
<ClCompile Include="..\..\src\ripple\basics\impl\CheckLibraryVersions.cpp">
|
<ClCompile Include="..\..\src\ripple\basics\impl\CheckLibraryVersions.cpp">
|
||||||
<Filter>ripple\basics\impl</Filter>
|
<Filter>ripple\basics\impl</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
@@ -3357,6 +3363,9 @@
|
|||||||
<ClCompile Include="..\..\src\ripple\basics\impl\RangeSet.cpp">
|
<ClCompile Include="..\..\src\ripple\basics\impl\RangeSet.cpp">
|
||||||
<Filter>ripple\basics\impl</Filter>
|
<Filter>ripple\basics\impl</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\src\ripple\basics\impl\Section.cpp">
|
||||||
|
<Filter>ripple\basics\impl</Filter>
|
||||||
|
</ClCompile>
|
||||||
<ClCompile Include="..\..\src\ripple\basics\impl\StringUtilities.cpp">
|
<ClCompile Include="..\..\src\ripple\basics\impl\StringUtilities.cpp">
|
||||||
<Filter>ripple\basics\impl</Filter>
|
<Filter>ripple\basics\impl</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
@@ -3381,6 +3390,9 @@
|
|||||||
<ClInclude Include="..\..\src\ripple\basics\RangeSet.h">
|
<ClInclude Include="..\..\src\ripple\basics\RangeSet.h">
|
||||||
<Filter>ripple\basics</Filter>
|
<Filter>ripple\basics</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\src\ripple\basics\Section.h">
|
||||||
|
<Filter>ripple\basics</Filter>
|
||||||
|
</ClInclude>
|
||||||
<ClInclude Include="..\..\src\ripple\basics\StringUtilities.h">
|
<ClInclude Include="..\..\src\ripple\basics\StringUtilities.h">
|
||||||
<Filter>ripple\basics</Filter>
|
<Filter>ripple\basics</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
@@ -3483,9 +3495,6 @@
|
|||||||
<ClCompile Include="..\..\src\ripple\core\impl\LoadMonitor.cpp">
|
<ClCompile Include="..\..\src\ripple\core\impl\LoadMonitor.cpp">
|
||||||
<Filter>ripple\core\impl</Filter>
|
<Filter>ripple\core\impl</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="..\..\src\ripple\core\impl\Section.cpp">
|
|
||||||
<Filter>ripple\core\impl</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClInclude Include="..\..\src\ripple\core\Job.h">
|
<ClInclude Include="..\..\src\ripple\core\Job.h">
|
||||||
<Filter>ripple\core</Filter>
|
<Filter>ripple\core</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
|||||||
@@ -20,7 +20,7 @@
|
|||||||
#ifndef RIPPLE_APP_FEEVOTE_H_INCLUDED
|
#ifndef RIPPLE_APP_FEEVOTE_H_INCLUDED
|
||||||
#define RIPPLE_APP_FEEVOTE_H_INCLUDED
|
#define RIPPLE_APP_FEEVOTE_H_INCLUDED
|
||||||
|
|
||||||
#include <ripple/core/Section.h>
|
#include <ripple/basics/BasicConfig.h>
|
||||||
#include <ripple/core/SystemParameters.h>
|
#include <ripple/core/SystemParameters.h>
|
||||||
|
|
||||||
namespace ripple {
|
namespace ripple {
|
||||||
|
|||||||
@@ -17,19 +17,22 @@
|
|||||||
*/
|
*/
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
|
|
||||||
#ifndef RIPPLE_CORE_SECTION_H_INCLUDED
|
#ifndef RIPPLE_BASICS_BASICCONFIG_H_INCLUDED
|
||||||
#define RIPPLE_CORE_SECTION_H_INCLUDED
|
#define RIPPLE_BASICS_BASICCONFIG_H_INCLUDED
|
||||||
|
|
||||||
#include <beast/utility/ci_char_traits.h>
|
#include <beast/utility/ci_char_traits.h>
|
||||||
#include <boost/lexical_cast.hpp>
|
#include <boost/lexical_cast.hpp>
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <ostream>
|
#include <ostream>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <utility>
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
namespace ripple {
|
namespace ripple {
|
||||||
|
|
||||||
|
using IniFileSections = std::map<std::string, std::vector<std::string>>;
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
/** Holds a collection of configuration values.
|
/** Holds a collection of configuration values.
|
||||||
A configuration file contains zero or more sections.
|
A configuration file contains zero or more sections.
|
||||||
*/
|
*/
|
||||||
@@ -160,7 +163,62 @@ get (Section const& section,
|
|||||||
return defaultValue;
|
return defaultValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
/** Holds unparsed configuration information.
|
||||||
|
The raw data sections are processed with intermediate parsers specific
|
||||||
|
to each module instead of being all parsed in a central location.
|
||||||
|
*/
|
||||||
|
class BasicConfig
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
std::map <std::string, Section, beast::ci_less> map_;
|
||||||
|
|
||||||
|
public:
|
||||||
|
/** Returns `true` if a section with the given name exists. */
|
||||||
|
bool
|
||||||
|
exists (std::string const& name) const;
|
||||||
|
|
||||||
|
/** Returns the section with the given name.
|
||||||
|
If the section does not exist, an empty section is returned.
|
||||||
|
*/
|
||||||
|
/** @{ */
|
||||||
|
Section const&
|
||||||
|
section (std::string const& name) const;
|
||||||
|
|
||||||
|
Section const&
|
||||||
|
operator[] (std::string const& name) const
|
||||||
|
{
|
||||||
|
return section(name);
|
||||||
|
}
|
||||||
|
/** @} */
|
||||||
|
|
||||||
|
/** Overwrite a key/value pair with a command line argument
|
||||||
|
If the section does not exist it is created.
|
||||||
|
The previous value, if any, is overwritten.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
overwrite (std::string const& section, std::string const& key,
|
||||||
|
std::string const& value);
|
||||||
|
|
||||||
|
friend
|
||||||
|
std::ostream&
|
||||||
|
operator<< (std::ostream& ss, BasicConfig const& c);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void
|
||||||
|
build (IniFileSections const& ifs);
|
||||||
|
|
||||||
|
/** Insert a legacy single section as a key/value pair.
|
||||||
|
Does nothing if the section does not exist, or does not contain
|
||||||
|
a single line that is not a key/value pair.
|
||||||
|
@deprecated
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
remap (std::string const& legacy_section,
|
||||||
|
std::string const& key, std::string const& new_section);
|
||||||
|
};
|
||||||
|
|
||||||
} // ripple
|
} // ripple
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -17,7 +17,7 @@
|
|||||||
*/
|
*/
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
|
|
||||||
#include <ripple/core/Section.h>
|
#include <ripple/basics/BasicConfig.h>
|
||||||
#include <boost/regex.hpp>
|
#include <boost/regex.hpp>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
@@ -76,8 +76,6 @@ Section::find (std::string const& name) const
|
|||||||
return {iter->second, true};
|
return {iter->second, true};
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
std::ostream&
|
std::ostream&
|
||||||
operator<< (std::ostream& os, Section const& section)
|
operator<< (std::ostream& os, Section const& section)
|
||||||
{
|
{
|
||||||
@@ -86,4 +84,64 @@ operator<< (std::ostream& os, Section const& section)
|
|||||||
return os;
|
return os;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
bool
|
||||||
|
BasicConfig::exists (std::string const& name) const
|
||||||
|
{
|
||||||
|
return map_.find (name) != map_.end();
|
||||||
|
}
|
||||||
|
|
||||||
|
Section const&
|
||||||
|
BasicConfig::section (std::string const& name) const
|
||||||
|
{
|
||||||
|
static Section none;
|
||||||
|
auto const iter = map_.find (name);
|
||||||
|
if (iter == map_.end())
|
||||||
|
return none;
|
||||||
|
return iter->second;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
BasicConfig::remap (std::string const& legacy_section,
|
||||||
|
std::string const& key, std::string const& new_section)
|
||||||
|
{
|
||||||
|
auto const iter = map_.find (legacy_section);
|
||||||
|
if (iter == map_.end())
|
||||||
|
return;
|
||||||
|
if (iter->second.keys() != 0)
|
||||||
|
return;
|
||||||
|
if (iter->second.lines().size() != 1)
|
||||||
|
return;
|
||||||
|
auto& s = map_[new_section];
|
||||||
|
s.append (iter->second.lines().front());
|
||||||
|
s.set (key, iter->second.lines().front());
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
BasicConfig::overwrite (std::string const& section, std::string const& key,
|
||||||
|
std::string const& value)
|
||||||
|
{
|
||||||
|
auto const result = map_.emplace (section, Section{});
|
||||||
|
result.first->second.set (key, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
BasicConfig::build (IniFileSections const& ifs)
|
||||||
|
{
|
||||||
|
for (auto const& entry : ifs)
|
||||||
|
{
|
||||||
|
auto const result = map_.emplace (entry.first, Section{});
|
||||||
|
result.first->second.append (entry.second);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
std::ostream&
|
||||||
|
operator<< (std::ostream& ss, BasicConfig const& c)
|
||||||
|
{
|
||||||
|
for (auto const& s : c.map_)
|
||||||
|
ss << "[" << s.first << "]\n" << s.second;
|
||||||
|
return ss;
|
||||||
|
}
|
||||||
|
|
||||||
} // ripple
|
} // ripple
|
||||||
@@ -17,6 +17,7 @@
|
|||||||
*/
|
*/
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
|
|
||||||
|
#include <ripple/basics/Log.h>
|
||||||
#include <boost/algorithm/string.hpp>
|
#include <boost/algorithm/string.hpp>
|
||||||
// VFALCO TODO Use std::chrono
|
// VFALCO TODO Use std::chrono
|
||||||
#include <boost/date_time/posix_time/posix_time.hpp>
|
#include <boost/date_time/posix_time/posix_time.hpp>
|
||||||
|
|||||||
@@ -18,6 +18,7 @@
|
|||||||
//==============================================================================
|
//==============================================================================
|
||||||
|
|
||||||
#include <ripple/basics/StringUtilities.h>
|
#include <ripple/basics/StringUtilities.h>
|
||||||
|
#include <beast/module/core/text/LexicalCast.h>
|
||||||
#include <beast/unit_test/suite.h>
|
#include <beast/unit_test/suite.h>
|
||||||
#include <boost/asio/ip/address.hpp>
|
#include <boost/asio/ip/address.hpp>
|
||||||
#include <boost/regex.hpp>
|
#include <boost/regex.hpp>
|
||||||
|
|||||||
@@ -20,7 +20,7 @@
|
|||||||
#ifndef RIPPLE_CORE_CONFIG_H_INCLUDED
|
#ifndef RIPPLE_CORE_CONFIG_H_INCLUDED
|
||||||
#define RIPPLE_CORE_CONFIG_H_INCLUDED
|
#define RIPPLE_CORE_CONFIG_H_INCLUDED
|
||||||
|
|
||||||
#include <ripple/core/Section.h>
|
#include <ripple/basics/BasicConfig.h>
|
||||||
#include <ripple/core/SystemParameters.h>
|
#include <ripple/core/SystemParameters.h>
|
||||||
#include <ripple/data/protocol/RippleAddress.h>
|
#include <ripple/data/protocol/RippleAddress.h>
|
||||||
#include <ripple/unity/json.h>
|
#include <ripple/unity/json.h>
|
||||||
@@ -39,8 +39,6 @@
|
|||||||
|
|
||||||
namespace ripple {
|
namespace ripple {
|
||||||
|
|
||||||
typedef std::map<std::string, std::vector<std::string>> IniFileSections;
|
|
||||||
|
|
||||||
IniFileSections
|
IniFileSections
|
||||||
parseIniFile (std::string const& strInput, const bool bTrim);
|
parseIniFile (std::string const& strInput, const bool bTrim);
|
||||||
|
|
||||||
@@ -64,62 +62,6 @@ parseKeyValueSection (IniFileSections& secSource, std::string const& strSection)
|
|||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
/** Holds unparsed configuration information.
|
|
||||||
The raw data sections are processed with intermediate parsers specific
|
|
||||||
to each module instead of being all parsed in a central location.
|
|
||||||
*/
|
|
||||||
class BasicConfig
|
|
||||||
{
|
|
||||||
private:
|
|
||||||
std::map <std::string, Section, beast::ci_less> map_;
|
|
||||||
|
|
||||||
public:
|
|
||||||
/** Returns `true` if a section with the given name exists. */
|
|
||||||
bool
|
|
||||||
exists (std::string const& name) const;
|
|
||||||
|
|
||||||
/** Returns the section with the given name.
|
|
||||||
If the section does not exist, an empty section is returned.
|
|
||||||
*/
|
|
||||||
/** @{ */
|
|
||||||
Section const&
|
|
||||||
section (std::string const& name) const;
|
|
||||||
|
|
||||||
Section const&
|
|
||||||
operator[] (std::string const& name) const
|
|
||||||
{
|
|
||||||
return section(name);
|
|
||||||
}
|
|
||||||
/** @} */
|
|
||||||
|
|
||||||
/** Overwrite a key/value pair with a command line argument
|
|
||||||
If the section does not exist it is created.
|
|
||||||
The previous value, if any, is overwritten.
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
overwrite (std::string const& section, std::string const& key,
|
|
||||||
std::string const& value);
|
|
||||||
|
|
||||||
friend
|
|
||||||
std::ostream&
|
|
||||||
operator<< (std::ostream& ss, BasicConfig const& c);
|
|
||||||
|
|
||||||
protected:
|
|
||||||
void
|
|
||||||
build (IniFileSections const& ifs);
|
|
||||||
|
|
||||||
/** Insert a legacy single section as a key/value pair.
|
|
||||||
Does nothing if the section does not exist, or does not contain
|
|
||||||
a single line that is not a key/value pair.
|
|
||||||
@deprecated
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
remap (std::string const& legacy_section,
|
|
||||||
std::string const& key, std::string const& new_section);
|
|
||||||
};
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
const int SYSTEM_PEER_PORT = 6561;
|
const int SYSTEM_PEER_PORT = 6561;
|
||||||
|
|
||||||
enum SizedItemName
|
enum SizedItemName
|
||||||
|
|||||||
@@ -217,70 +217,6 @@ parseAddresses (OutputSequence& out, InputIterator first, InputIterator last,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
//
|
|
||||||
// BasicConfig
|
|
||||||
//
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
bool
|
|
||||||
BasicConfig::exists (std::string const& name) const
|
|
||||||
{
|
|
||||||
return map_.find (name) != map_.end();
|
|
||||||
}
|
|
||||||
|
|
||||||
Section const&
|
|
||||||
BasicConfig::section (std::string const& name) const
|
|
||||||
{
|
|
||||||
static Section none;
|
|
||||||
auto const iter = map_.find (name);
|
|
||||||
if (iter == map_.end())
|
|
||||||
return none;
|
|
||||||
return iter->second;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
BasicConfig::remap (std::string const& legacy_section,
|
|
||||||
std::string const& key, std::string const& new_section)
|
|
||||||
{
|
|
||||||
auto const iter = map_.find (legacy_section);
|
|
||||||
if (iter == map_.end())
|
|
||||||
return;
|
|
||||||
if (iter->second.keys() != 0)
|
|
||||||
return;
|
|
||||||
if (iter->second.lines().size() != 1)
|
|
||||||
return;
|
|
||||||
auto& s = map_[new_section];
|
|
||||||
s.append (iter->second.lines().front());
|
|
||||||
s.set (key, iter->second.lines().front());
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
BasicConfig::overwrite (std::string const& section, std::string const& key,
|
|
||||||
std::string const& value)
|
|
||||||
{
|
|
||||||
auto const result = map_.emplace (section, Section{});
|
|
||||||
result.first->second.set (key, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
BasicConfig::build (IniFileSections const& ifs)
|
|
||||||
{
|
|
||||||
for (auto const& entry : ifs)
|
|
||||||
{
|
|
||||||
auto const result = map_.emplace (entry.first, Section{});
|
|
||||||
result.first->second.append (entry.second);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
std::ostream&
|
|
||||||
operator<< (std::ostream& ss, BasicConfig const& c)
|
|
||||||
{
|
|
||||||
for (auto const& s : c.map_)
|
|
||||||
ss << "[" << s.first << "]\n" << s.second;
|
|
||||||
return ss;
|
|
||||||
}
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// Config (DEPRECATED)
|
// Config (DEPRECATED)
|
||||||
|
|||||||
@@ -20,9 +20,8 @@
|
|||||||
#ifndef RIPPLE_SITEFILES_SITEFILE_H_INCLUDED
|
#ifndef RIPPLE_SITEFILES_SITEFILE_H_INCLUDED
|
||||||
#define RIPPLE_SITEFILES_SITEFILE_H_INCLUDED
|
#define RIPPLE_SITEFILES_SITEFILE_H_INCLUDED
|
||||||
|
|
||||||
#include <ripple/sitefiles/api/Section.h>
|
|
||||||
#include <ripple/common/UnorderedContainers.h>
|
#include <ripple/common/UnorderedContainers.h>
|
||||||
|
#include <ripple/sitefiles/api/Section.h>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
namespace ripple {
|
namespace ripple {
|
||||||
|
|||||||
@@ -17,6 +17,8 @@
|
|||||||
*/
|
*/
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
|
|
||||||
|
#include <ripple/sitefiles/api/Section.h>
|
||||||
|
|
||||||
namespace ripple {
|
namespace ripple {
|
||||||
namespace SiteFiles {
|
namespace SiteFiles {
|
||||||
|
|
||||||
|
|||||||
@@ -17,6 +17,8 @@
|
|||||||
*/
|
*/
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
|
|
||||||
|
#include <ripple/sitefiles/api/Section.h>
|
||||||
|
|
||||||
namespace ripple {
|
namespace ripple {
|
||||||
namespace SiteFiles {
|
namespace SiteFiles {
|
||||||
|
|
||||||
|
|||||||
@@ -19,11 +19,12 @@
|
|||||||
|
|
||||||
#include <BeastConfig.h>
|
#include <BeastConfig.h>
|
||||||
|
|
||||||
#include <ripple/basics/impl/RangeSet.cpp>
|
#include <ripple/basics/impl/BasicConfig.cpp>
|
||||||
#include <ripple/basics/impl/Log.cpp>
|
|
||||||
#include <ripple/basics/impl/CheckLibraryVersions.cpp>
|
#include <ripple/basics/impl/CheckLibraryVersions.cpp>
|
||||||
#include <ripple/basics/impl/CountedObject.cpp>
|
#include <ripple/basics/impl/CountedObject.cpp>
|
||||||
|
#include <ripple/basics/impl/Log.cpp>
|
||||||
#include <ripple/basics/impl/StringUtilities.cpp>
|
#include <ripple/basics/impl/StringUtilities.cpp>
|
||||||
|
#include <ripple/basics/impl/RangeSet.cpp>
|
||||||
#include <ripple/basics/impl/Sustain.cpp>
|
#include <ripple/basics/impl/Sustain.cpp>
|
||||||
#include <ripple/basics/impl/ThreadName.cpp>
|
#include <ripple/basics/impl/ThreadName.cpp>
|
||||||
#include <ripple/basics/impl/Time.cpp>
|
#include <ripple/basics/impl/Time.cpp>
|
||||||
|
|||||||
@@ -25,4 +25,3 @@
|
|||||||
#include <ripple/core/impl/LoadMonitor.cpp>
|
#include <ripple/core/impl/LoadMonitor.cpp>
|
||||||
#include <ripple/core/impl/Job.cpp>
|
#include <ripple/core/impl/Job.cpp>
|
||||||
#include <ripple/core/impl/JobQueue.cpp>
|
#include <ripple/core/impl/JobQueue.cpp>
|
||||||
#include <ripple/core/impl/Section.cpp>
|
|
||||||
|
|||||||
@@ -20,12 +20,6 @@
|
|||||||
#ifndef RIPPLE_SITEFILES_H_INCLUDED
|
#ifndef RIPPLE_SITEFILES_H_INCLUDED
|
||||||
#define RIPPLE_SITEFILES_H_INCLUDED
|
#define RIPPLE_SITEFILES_H_INCLUDED
|
||||||
|
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
#include <beast/http/URL.h>
|
|
||||||
#include <beast/Threads.h>
|
|
||||||
|
|
||||||
#include <ripple/sitefiles/api/Section.h>
|
|
||||||
#include <ripple/sitefiles/api/SiteFile.h>
|
#include <ripple/sitefiles/api/SiteFile.h>
|
||||||
#include <ripple/sitefiles/api/Listener.h>
|
#include <ripple/sitefiles/api/Listener.h>
|
||||||
#include <ripple/sitefiles/api/Manager.h>
|
#include <ripple/sitefiles/api/Manager.h>
|
||||||
|
|||||||
Reference in New Issue
Block a user