|
Porytiles
|
A container that wraps a configuration value with its name and source information. More...
#include <config_value.hpp>
Public Member Functions | |
| ConfigValue (T value, std::string name, std::string source, const std::vector< std::string > &source_details) | |
| Constructs a ConfigValue with a value, name, and source information. | |
| operator const T & () const & | |
| Implicit conversion to const reference of the underlying value. | |
| operator T&& () && | |
| Implicit conversion to rvalue reference of the underlying value. | |
| const T & | value () const & |
| Gets a const reference to the underlying value. | |
| T && | value () && |
| Gets an rvalue reference to the underlying value. | |
| const std::string & | name () const |
| Gets the name of this configuration value. | |
| const std::string & | source () const |
| Gets the source information for this configuration value. | |
| const std::vector< std::string > & | source_details () const |
| Gets the source details for this configuration value. | |
| std::pair< std::vector< std::string >, std::vector< std::vector< FormatParam > > > | format_data () const |
| Generates formatted text data for displaying this configuration value. | |
A container that wraps a configuration value with its name and source information.
ConfigValue provides transparent access to configuration values while also tracking the config value's name and where each value originated (e.g., which ConfigProvider supplied it). It supports implicit conversion to the underlying type for ergonomic usage.
| T | The type of the configuration value |
Definition at line 22 of file config_value.hpp.
|
inline |
Constructs a ConfigValue with a value, name, and source information.
| value | The configuration value |
| name | The name of the configuration value (e.g., "num_tiles_primary") |
| source | A string describing where this value came from |
| source_details | A vector of strings with the optional source details |
Definition at line 32 of file config_value.hpp.
|
inline |
Generates formatted text data for displaying this configuration value.
Creates a structured representation of the configuration value suitable for formatted output or error messages. The output includes the value name, its actual value, the source information, and any additional source details if available. The format follows the pattern:
Each format string in the returned pair contains placeholders ({}) that correspond to the FormatParam objects in the parallel vector, which provide both the text to insert and styling information.
Definition at line 155 of file config_value.hpp.
|
inline |
Gets the name of this configuration value.
The name identifies the configuration value, such as:
Definition at line 94 of file config_value.hpp.
|
inline |
Implicit conversion to const reference of the underlying value.
Allows ConfigValue to be used transparently where the underlying type is expected.
Definition at line 45 of file config_value.hpp.
|
inline |
Implicit conversion to rvalue reference of the underlying value.
Enables move semantics when the ConfigValue is an rvalue.
Definition at line 58 of file config_value.hpp.
|
inline |
Gets the source information for this configuration value.
The source string describes where this value originated, such as:
Definition at line 110 of file config_value.hpp.
|
inline |
Gets the source details for this configuration value.
The source details supplement the source string with additional context. For example, the YAML file provider may use the details string to supplement the file name and line number with a contextual view of the YAML file.
Definition at line 124 of file config_value.hpp.
|
inline |
Gets an rvalue reference to the underlying value.
Definition at line 78 of file config_value.hpp.
|
inline |
Gets a const reference to the underlying value.
Definition at line 68 of file config_value.hpp.