Configuration section.
More...
#include <config_parser.h>
|
const std::string | name |
|
const std::string | key |
|
|
std::string | do_replace (const std::string &value, int depth=0) const |
|
std::pair< OptionMap::const_iterator, bool > | do_locate (std::string_view option) const noexcept |
|
Configuration section.
A named configuration file section with a zero or more configuration file options.
◆ OptionMap
◆ OptionRange
◆ ConfigSection() [1/3]
mysql_harness::ConfigSection::ConfigSection |
( |
const std::string & |
name_arg, |
|
|
const std::string & |
key_arg, |
|
|
const std::shared_ptr< const ConfigSection > & |
defaults |
|
) |
| |
◆ ConfigSection() [2/3]
mysql_harness::ConfigSection::ConfigSection |
( |
const ConfigSection & |
other, |
|
|
const std::shared_ptr< const ConfigSection > & |
defaults |
|
) |
| |
◆ ConfigSection() [3/3]
mysql_harness::ConfigSection::ConfigSection |
( |
const ConfigSection & |
| ) |
|
|
default |
◆ add()
void mysql_harness::ConfigSection::add |
( |
const std::string & |
option, |
|
|
const std::string & |
value |
|
) |
| |
◆ assert_default()
bool mysql_harness::ConfigSection::assert_default |
( |
const ConfigSection * |
def | ) |
const |
|
inline |
◆ clear()
void mysql_harness::ConfigSection::clear |
( |
| ) |
|
Clear the options in the section.
This will remove options from the configuration section.
◆ do_locate()
std::pair< ConfigSection::OptionMap::const_iterator, bool > mysql_harness::ConfigSection::do_locate |
( |
std::string_view |
option | ) |
const |
|
privatenoexcept |
◆ do_replace()
std::string mysql_harness::ConfigSection::do_replace |
( |
const std::string & |
value, |
|
|
int |
depth = 0 |
|
) |
| const |
|
private |
◆ get()
std::string mysql_harness::ConfigSection::get |
( |
std::string_view |
option | ) |
const |
◆ get_options()
OptionRange mysql_harness::ConfigSection::get_options |
( |
| ) |
const |
|
inline |
Range for options in section.
Typical usage is:
for (auto elem: section.get_options())
std::cout << "Option " << elem.first
<< " has value " << elem.second
<< std::endl;
- Returns
- a range of options each consisting of a pair option-value.
◆ get_section_name() [1/2]
std::string mysql_harness::ConfigSection::get_section_name |
( |
| ) |
const |
◆ get_section_name() [2/2]
std::string mysql_harness::ConfigSection::get_section_name |
( |
std::string_view |
option | ) |
const |
◆ has()
bool mysql_harness::ConfigSection::has |
( |
std::string_view |
option | ) |
const |
◆ operator=()
◆ set()
void mysql_harness::ConfigSection::set |
( |
std::string_view |
option, |
|
|
const std::string & |
value |
|
) |
| |
◆ update()
void mysql_harness::ConfigSection::update |
( |
const ConfigSection & |
other | ) |
|
Update section with contents of another section.
The configuration section will be updated with the contents of the other section. For any options that exist in the section, the value will be overwritten by the values in the other
section. If the option do not exist, a new option will be created and the value set to the value of the option in the other
section.
- Note
- The section name and key have to match for the update to be done.
- Exceptions
-
bad_section | Thrown if the section name or section key do not match. |
- Parameters
-
other | Section to copy options and values from. |
◆ defaults_
const std::shared_ptr<const ConfigSection> mysql_harness::ConfigSection::defaults_ |
|
private |
◆ key
const std::string mysql_harness::ConfigSection::key |
◆ kMaxInterpolationDepth
const int mysql_harness::ConfigSection::kMaxInterpolationDepth = 10 |
|
private |
◆ name
const std::string mysql_harness::ConfigSection::name |
◆ options_
OptionMap mysql_harness::ConfigSection::options_ |
|
private |
The documentation for this class was generated from the following files: