52 operator const T &()
const &
66 return std::move(value_);
69 [[nodiscard]]
const T &
value() const &
76 return std::move(value_);
81 return canonical_name_;
89 [[nodiscard]]
const std::string &
source()
const
96 return source_details_;
111 template <
typename U>
118 override.source_info.empty() ?
source() :
override.source_info,
119 override.source_details.empty() ?
source_details() :
override.source_details};
146 [[nodiscard]] std::pair<std::vector<std::string>, std::vector<std::vector<FormatParam>>>
format_data()
const
152 std::vector<std::string> err_text{};
153 std::vector<std::vector<FormatParam>> params{};
155 err_text.emplace_back(
"{} = {}");
160 err_text.emplace_back(
"Source: {}");
165 err_text.emplace_back(
"");
166 params.emplace_back();
169 params.emplace_back();
173 return {err_text, params};
203 const auto [format_strings, param_vectors] =
format_data();
205 std::vector<std::string> result;
206 result.reserve(format_strings.size());
208 for (
const auto &[text, params] : std::views::zip(format_strings, param_vectors)) {
209 result.push_back(formatter.
format(text, params));
217 std::string canonical_name_;
218 std::string source_key_;
220 std::vector<std::string> source_details_;
A container that wraps a configuration value with its name and source information.
const std::vector< std::string > & source_details() const
ConfigValue< U > derive(const ConfigPODField< U > &override) const
Creates a child ConfigValue from a ConfigPODField, inheriting this value's source provenance.
const std::string & source() const
const std::string & source_key() const
std::pair< std::vector< std::string >, std::vector< std::vector< FormatParam > > > format_data() const
Generates formatted text data for displaying this configuration value.
const std::string & canonical_name() const
const T & value() const &
std::vector< std::string > prettify(const TextFormatter &formatter) const
Generates a prettified, styled readout of this configuration value.
ConfigValue(T value, std::string canonical_name, std::string source_key, std::string source, const std::vector< std::string > &source_details)
Constructs a ConfigValue with a value, names, and source information.
static const Style italic
Italic text formatting.
static const Style yellow
Yellow foreground color.
static const Style bold
Bold text formatting.
Abstract base class for applying text styling with context-aware formatting.
virtual std::string format(const std::string &format_str, const std::vector< FormatParam > ¶ms) const
Formats a string with styled parameters using fmtlib syntax.
A lightweight wrapper for per-field configuration values with source metadata.