| 
    rippled
    
   | 
 
Holds a collection of configuration values. More...
#include <BasicConfig.h>

Public Member Functions | |
| Section (std::string const &name="") | |
| Create an empty section.   | |
| std::string const & | name () const | 
| Returns the name of this section.   | |
| std::vector< std::string > const & | lines () const | 
| Returns all the lines in the section.   | |
| std::vector< std::string > const & | values () const | 
| Returns all the values in the section.   | |
| void | legacy (std::string value) | 
| Set the legacy value for this section.   | |
| std::string | legacy () const | 
| Get the legacy value for this section.   | |
| void | set (std::string const &key, std::string const &value) | 
| Set a key/value pair.   | |
| void | append (std::vector< std::string > const &lines) | 
| Append a set of lines to this section.   | |
| void | append (std::string const &line) | 
| Append a line to this section.   | |
| bool | exists (std::string const &name) const | 
Returns true if a key with the given name exists.   | |
| template<class T = std::string> | |
| std::optional< T > | get (std::string const &name) const | 
| template<class T > | |
| T | value_or (std::string const &name, T const &other) const | 
| Returns a value if present, else another value.   | |
| bool | had_trailing_comments () const | 
| bool | empty () const | 
| std::size_t | size () const | 
| const_iterator | begin () const | 
| const_iterator | cbegin () const | 
| const_iterator | end () const | 
| const_iterator | cend () const | 
Private Types | |
| using | const_iterator = decltype(lookup_)::const_iterator | 
Private Attributes | |
| std::string | name_ | 
| std::unordered_map< std::string, std::string > | lookup_ | 
| std::vector< std::string > | lines_ | 
| std::vector< std::string > | values_ | 
| bool | had_trailing_comments_ = false | 
Friends | |
| std::ostream & | operator<< (std::ostream &, Section const §ion) | 
Holds a collection of configuration values.
A configuration file contains zero or more sections.
Definition at line 44 of file BasicConfig.h.
      
  | 
  private | 
Definition at line 53 of file BasicConfig.h.
      
  | 
  explicit | 
Create an empty section.
Definition at line 36 of file BasicConfig.cpp.
| std::string const & ripple::Section::name | ( | ) | const | 
Returns the name of this section.
Definition at line 61 of file BasicConfig.h.
| std::vector< std::string > const & ripple::Section::lines | ( | ) | const | 
Returns all the lines in the section.
This includes everything.
Definition at line 70 of file BasicConfig.h.
| std::vector< std::string > const & ripple::Section::values | ( | ) | const | 
Returns all the values in the section.
Values are non-empty lines which are not key/value pairs.
Definition at line 79 of file BasicConfig.h.
| void ripple::Section::legacy | ( | std::string | value | ) | 
Set the legacy value for this section.
Definition at line 88 of file BasicConfig.h.
| std::string ripple::Section::legacy | ( | ) | const | 
Get the legacy value for this section.
Definition at line 103 of file BasicConfig.h.
| void ripple::Section::set | ( | std::string const & | key, | 
| std::string const & | value | ||
| ) | 
Set a key/value pair.
The previous value is discarded.
Definition at line 41 of file BasicConfig.cpp.
| void ripple::Section::append | ( | std::vector< std::string > const & | lines | ) | 
Append a set of lines to this section.
Lines containing key/value pairs are added to the map, else they are added to the values list. Everything is added to the lines list.
Definition at line 47 of file BasicConfig.cpp.
| void ripple::Section::append | ( | std::string const & | line | ) | 
Append a line to this section.
Definition at line 129 of file BasicConfig.h.
| bool ripple::Section::exists | ( | std::string const & | name | ) | const | 
Returns true if a key with the given name exists. 
Definition at line 114 of file BasicConfig.cpp.
| std::optional< T > ripple::Section::get | ( | std::string const & | name | ) | const | 
Definition at line 140 of file BasicConfig.h.
| T ripple::Section::value_or | ( | std::string const & | name, | 
| T const & | other | ||
| ) | const | 
Returns a value if present, else another value.
Definition at line 151 of file BasicConfig.h.
| bool ripple::Section::had_trailing_comments | ( | ) | const | 
Definition at line 160 of file BasicConfig.h.
| bool ripple::Section::empty | ( | ) | const | 
Definition at line 170 of file BasicConfig.h.
| std::size_t ripple::Section::size | ( | ) | const | 
Definition at line 177 of file BasicConfig.h.
| const_iterator ripple::Section::begin | ( | ) | const | 
Definition at line 184 of file BasicConfig.h.
| const_iterator ripple::Section::cbegin | ( | ) | const | 
Definition at line 191 of file BasicConfig.h.
| const_iterator ripple::Section::end | ( | ) | const | 
Definition at line 198 of file BasicConfig.h.
| const_iterator ripple::Section::cend | ( | ) | const | 
Definition at line 205 of file BasicConfig.h.
      
  | 
  friend | 
Definition at line 119 of file BasicConfig.cpp.
      
  | 
  private | 
Definition at line 47 of file BasicConfig.h.
      
  | 
  private | 
Definition at line 48 of file BasicConfig.h.
      
  | 
  private | 
Definition at line 49 of file BasicConfig.h.
      
  | 
  private | 
Definition at line 50 of file BasicConfig.h.
      
  | 
  private | 
Definition at line 51 of file BasicConfig.h.