Interface for converting between an application and a configuration file.
More...
|
|
| config_t (const config_t &)=default |
|
| config_t (config_t &&)=default |
|
auto | operator= (const config_t &) -> config_t &=default |
|
auto | operator= (config_t &&) -> config_t &=default |
| virtual auto | to_config (const app_t *app, bool default_also, bool write_description, std::string prefix) const -> std::string=0 |
| | Writes an application out as configuration text.
|
| virtual auto | to_config (const app_t *app, config_output_mode_t mode, bool write_description, std::string prefix) const -> std::string |
| | Writes an application out as configuration text.
|
| virtual auto | from_config (std::istream &input) const -> std::vector< config_item_t >=0 |
| | Reads configuration text into a list of entries.
|
| virtual auto | to_flag (const config_item_t &item) const -> std::string |
| | Reduces an entry to a single flag value.
|
| auto | from_file (const std::string &name) const -> std::vector< config_item_t > |
| | Reads a configuration file into a list of entries.
|
|
|
std::vector< config_item_t > | items {} |
| | Entries accumulated while reading.
|
Interface for converting between an application and a configuration file.
◆ from_config()
| virtual auto cli::config_t::from_config |
( |
std::istream & | input | ) |
const -> std::vector< config_item_t > |
|
nodiscardpure virtual |
Reads configuration text into a list of entries.
- Parameters
-
| input | The stream to read from. |
- Returns
- The entries that were read.
Implemented in cli::config_base_t.
◆ from_file()
| auto cli::config_t::from_file |
( |
const std::string & | name | ) |
const -> std::vector< config_item_t > |
|
inlinenodiscard |
Reads a configuration file into a list of entries.
- Parameters
-
- Returns
- The entries that were read.
- Exceptions
-
| cli::file_error_t | If the file cannot be opened. |
| cli::config_error_t | If the contents cannot be parsed. |
◆ to_config() [1/2]
| virtual auto cli::config_t::to_config |
( |
const app_t * | app, |
|
|
bool | default_also, |
|
|
bool | write_description, |
|
|
std::string | prefix ) const -> std::string |
|
nodiscardpure virtual |
Writes an application out as configuration text.
- Parameters
-
| app | The application to describe. |
| default_also | Include options left at their defaults. |
| write_description | Include descriptions as comments. |
| prefix | Section prefix to write entries under. |
- Returns
- The configuration text.
Implemented in cli::config_base_t.
◆ to_config() [2/2]
| virtual auto cli::config_t::to_config |
( |
const app_t * | app, |
|
|
config_output_mode_t | mode, |
|
|
bool | write_description, |
|
|
std::string | prefix ) const -> std::string |
|
inlinenodiscardvirtual |
Writes an application out as configuration text.
- Parameters
-
| app | The application to describe. |
| mode | How much of the application to write. |
| write_description | Include descriptions as comments. |
| prefix | Section prefix to write entries under. |
- Returns
- The configuration text.
Reimplemented in cli::config_base_t.
◆ to_flag()
| virtual auto cli::config_t::to_flag |
( |
const config_item_t & | item | ) |
const -> std::string |
|
inlinenodiscardvirtual |
Reduces an entry to a single flag value.
- Parameters
-
- Returns
- The single value, or "{}" if the entry has none.
- Exceptions
-
| cli::conversion_error_t | If the entry has more than one value. |
The documentation for this class was generated from the following file: