|
Porytiles
|
A lightweight wrapper for per-field configuration values with source metadata. More...
#include <config_pod_field.hpp>
Public Member Functions | |
| ConfigPODField ()=default | |
| ConfigPODField (T val) | |
| Constructs a ConfigPODField with a value and no source metadata. | |
| ConfigPODField (std::nullopt_t) | |
| Constructs an empty ConfigPODField from std::nullopt. | |
| ConfigPODField (T val, std::string source_key, std::string canonical_name) | |
| Constructs a ConfigPODField with a value and full source metadata. | |
| ConfigPODField (T val, std::string source_key, std::string canonical_name, std::string source_info, std::vector< std::string > source_details) | |
| Constructs a ConfigPODField with a value, full source metadata, and per-entry source location. | |
| bool | has_value () const |
| Checks whether this field has a value set. | |
| const T & | operator* () const |
| Accesses the stored value. | |
Public Attributes | |
| std::optional< T > | value {std::nullopt} |
| std::string | source_key |
| std::string | canonical_name |
| std::string | source_info |
| std::vector< std::string > | source_details |
A lightweight wrapper for per-field configuration values with source metadata.
ConfigPODField replaces std::optional<T> in configuration POD structs where individual fields need to carry provider-specific source metadata (source_key, canonical_name). This metadata is set at parse time by the provider (e.g., YAML parser, CLI parser) and later used by ConfigValue::derive() to construct a child ConfigValue<T> with proper provenance.
Implicit constructors from T and std::nullopt_t preserve ergonomic usage in tests and initializer lists.
| T | The type of the field value |
Definition at line 24 of file config_pod_field.hpp.
|
default |
|
inline |
Constructs a ConfigPODField with a value and no source metadata.
Implicit conversion for test ergonomics, allowing direct assignment of a value without specifying metadata.
| val | The field value |
Definition at line 42 of file config_pod_field.hpp.
|
inline |
Constructs an empty ConfigPODField from std::nullopt.
Implicit conversion for initializer list ergonomics, allowing std::nullopt in vector initializer lists.
Definition at line 51 of file config_pod_field.hpp.
|
inline |
Constructs a ConfigPODField with a value and full source metadata.
Used by config providers to set provider-specific source metadata during parsing.
| val | The field value |
| source_key | The provider-specific identifier (e.g., YAML path, CLI flag) |
| canonical_name | Human-readable description of this field |
Definition at line 63 of file config_pod_field.hpp.
|
inline |
Constructs a ConfigPODField with a value, full source metadata, and per-entry source location.
Used by config providers to set provider-specific source metadata during parsing of map-type config values. The source_info and source_details fields allow each entry within a map to carry its own source location, so that ConfigValue::derive() can produce accurately located child values instead of inheriting the parent map's location.
| val | The field value |
| source_key | The provider-specific identifier (e.g., YAML path, CLI flag) |
| canonical_name | Human-readable description of this field |
| source_info | Source location string (e.g., "./porytiles.yaml:42") |
| source_details | Contextual highlight lines from the source file |
Definition at line 83 of file config_pod_field.hpp.
|
inline |
Checks whether this field has a value set.
true if a value is present Definition at line 99 of file config_pod_field.hpp.
|
inline |
Accesses the stored value.
true. Definition at line 110 of file config_pod_field.hpp.
| std::string porytiles::ConfigPODField< T >::canonical_name |
Definition at line 27 of file config_pod_field.hpp.
| std::vector<std::string> porytiles::ConfigPODField< T >::source_details |
Definition at line 29 of file config_pod_field.hpp.
| std::string porytiles::ConfigPODField< T >::source_info |
Definition at line 28 of file config_pod_field.hpp.
| std::string porytiles::ConfigPODField< T >::source_key |
Definition at line 26 of file config_pod_field.hpp.
| std::optional<T> porytiles::ConfigPODField< T >::value {std::nullopt} |
Definition at line 25 of file config_pod_field.hpp.