xrpld
Loading...
Searching...
No Matches
xrpl::BasicConfig Class Reference

Holds unparsed configuration information. More...

#include <BasicConfig.h>

Inheritance diagram for xrpl::BasicConfig:
Collaboration diagram for xrpl::BasicConfig:

Public Member Functions

bool exists (std::string const &name) const
 Returns true if a section with the given name exists.
void overwrite (std::string const &section, std::string const &key, std::string const &value)
 Overwrite a key/value pair with a command line argument If the section does not exist it is created.
void deprecatedClearSection (std::string const &section)
 Remove all the key/value pairs from the section.
void legacy (std::string const &section, std::string value)
 Set a value that is not a key/value pair.
std::string legacy (std::string const &sectionName) const
 Get the legacy value of a section.
bool hadTrailingComments () const
Sectionsection (std::string const &name)
 Returns the section with the given name.
Section const & section (std::string const &name) const
Section const & operator[] (std::string const &name) const
Sectionoperator[] (std::string const &name)

Protected Member Functions

void build (IniFileSections const &ifs)

Private Attributes

std::unordered_map< std::string, Sectionmap_

Friends

std::ostreamoperator<< (std::ostream &ss, BasicConfig const &c)

Detailed Description

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.

Definition at line 202 of file BasicConfig.h.

Member Function Documentation

◆ exists()

bool xrpl::BasicConfig::exists ( std::string const & name) const
nodiscard

Returns true if a section with the given name exists.

Definition at line 115 of file BasicConfig.cpp.

◆ section() [1/2]

Section & xrpl::BasicConfig::section ( std::string const & name)

Returns the section with the given name.

If the section does not exist, an empty section is returned.

Definition at line 121 of file BasicConfig.cpp.

◆ section() [2/2]

Section const & xrpl::BasicConfig::section ( std::string const & name) const
nodiscard

Definition at line 127 of file BasicConfig.cpp.

◆ operator[]() [1/2]

Section const & xrpl::BasicConfig::operator[] ( std::string const & name) const

Definition at line 223 of file BasicConfig.h.

◆ operator[]() [2/2]

Section & xrpl::BasicConfig::operator[] ( std::string const & name)

Definition at line 229 of file BasicConfig.h.

◆ overwrite()

void xrpl::BasicConfig::overwrite ( std::string const & section,
std::string const & key,
std::string const & value )

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.

Definition at line 137 of file BasicConfig.cpp.

◆ deprecatedClearSection()

void xrpl::BasicConfig::deprecatedClearSection ( std::string const & section)

Remove all the key/value pairs from the section.

Definition at line 145 of file BasicConfig.cpp.

◆ legacy() [1/2]

void xrpl::BasicConfig::legacy ( std::string const & section,
std::string value )

Set a value that is not a key/value pair.

The value is stored as the section's first value and may be retrieved through section::legacy.

Parameters
sectionName of the section to modify.
valueContents of the legacy value.

Definition at line 153 of file BasicConfig.cpp.

◆ legacy() [2/2]

std::string xrpl::BasicConfig::legacy ( std::string const & sectionName) const
nodiscard

Get the legacy value of a section.

A section with a single-line value may be retrieved as a legacy value.

Parameters
sectionNameRetrieve the contents of this section's legacy value.
Returns
Contents of the legacy value.

Definition at line 159 of file BasicConfig.cpp.

◆ hadTrailingComments()

bool xrpl::BasicConfig::hadTrailingComments ( ) const
nodiscard

Definition at line 276 of file BasicConfig.h.

◆ build()

void xrpl::BasicConfig::build ( IniFileSections const & ifs)
protected

Definition at line 165 of file BasicConfig.cpp.

◆ operator<<

std::ostream & operator<< ( std::ostream & ss,
BasicConfig const & c )
friend

Definition at line 175 of file BasicConfig.cpp.

Member Data Documentation

◆ map_

std::unordered_map<std::string, Section> xrpl::BasicConfig::map_
private

Definition at line 205 of file BasicConfig.h.