rippled
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Private Attributes | Friends | List of all members
ripple::BasicConfig Class Reference

Holds unparsed configuration information. More...

#include <BasicConfig.h>

Inheritance diagram for ripple::BasicConfig:
Inheritance graph
[legend]
Collaboration diagram for ripple::BasicConfig:
Collaboration graph
[legend]

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 had_trailing_comments () 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 217 of file BasicConfig.h.

Member Function Documentation

◆ exists()

bool ripple::BasicConfig::exists ( std::string const &  name) const

Returns true if a section with the given name exists.

Definition at line 130 of file BasicConfig.cpp.

◆ section() [1/2]

Section & ripple::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 136 of file BasicConfig.cpp.

◆ section() [2/2]

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

Definition at line 142 of file BasicConfig.cpp.

◆ operator[]() [1/2]

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

Definition at line 238 of file BasicConfig.h.

◆ operator[]() [2/2]

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

Definition at line 244 of file BasicConfig.h.

◆ overwrite()

void ripple::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 152 of file BasicConfig.cpp.

◆ deprecatedClearSection()

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

Remove all the key/value pairs from the section.

Definition at line 165 of file BasicConfig.cpp.

◆ legacy() [1/2]

void ripple::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 173 of file BasicConfig.cpp.

◆ legacy() [2/2]

std::string ripple::BasicConfig::legacy ( std::string const &  sectionName) const

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 179 of file BasicConfig.cpp.

◆ had_trailing_comments()

bool ripple::BasicConfig::had_trailing_comments ( ) const

Definition at line 294 of file BasicConfig.h.

◆ build()

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

Definition at line 185 of file BasicConfig.cpp.

Friends And Related Symbol Documentation

◆ operator<<

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

Definition at line 197 of file BasicConfig.cpp.

Member Data Documentation

◆ map_

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

Definition at line 220 of file BasicConfig.h.