INI file section.
More...
#include <section.hpp>
INI file section.
INI file section description
- Author
- Vincent Lachenal
- Since
- 0.1
◆ Section() [1/3]
| anch::ini::Section::Section |
( |
| ) |
|
◆ Section() [2/3]
| anch::ini::Section::Section |
( |
const Section & | section | ) |
|
Section copy constructor
- Parameters
-
◆ Section() [3/3]
| anch::ini::Section::Section |
( |
Section && | section | ) |
|
Section move constructor
- Parameters
-
◆ ~Section()
| virtual anch::ini::Section::~Section |
( |
| ) |
|
|
virtual |
◆ debug()
| std::string anch::ini::Section::debug |
( |
| ) |
const |
Print section for debug
- Returns
- the section as string
◆ getSections()
| const std::map< std::string, Section > & anch::ini::Section::getSections |
( |
| ) |
const |
Subsections getter
- Returns
- the sections
◆ getValue() [1/3]
template<typename T>
| std::optional< T > anch::ini::Section::getValue |
( |
const std::string & | key | ) |
const |
Get value and cast it into T
- Parameters
-
- Returns
- empty optional value when not found, the value otherwise
- Exceptions
-
ref std::bad_cast exception on cast error
◆ getValue() [2/3]
template<typename T>
| T anch::ini::Section::getValue |
( |
const std::string & | key, |
|
|
const T & | defaultValue ) const |
Get value and cast it into T
- Parameters
-
| key | the value's key |
| defaultValue | default value when not found |
- Returns
- default value when not found, the value otherwise
- Exceptions
-
ref std::bad_cast exception on cast error
◆ getValue() [3/3]
| std::optional< std::string > anch::ini::Section::getValue |
( |
const std::string & | path, |
|
|
const Section & | section ) |
|
static |
Get value from path.
Path is composed by (sub)sections delimited by '.' and key as last token.
- Parameters
-
| path | the key's path to search |
| section | the current section |
- Returns
- the
std::string value when found, empty otherwise
◆ getValues()
| const std::map< std::string, std::string > & anch::ini::Section::getValues |
( |
| ) |
const |
Values getter
- Returns
- the values
◆ operator=()
Simple assignment operator
- Parameters
-
- Returns
this
◆ putValue()
| Section & anch::ini::Section::putValue |
( |
const std::string & | key, |
|
|
const std::string & | value ) |
Put value referenced by key into current section.
It will override existiing value.
- Parameters
-
| key | the key |
| value | the value |
- Returns
this
◆ section()
| Section & anch::ini::Section::section |
( |
const std::string & | key | ) |
|
The documentation for this class was generated from the following file: