58 operator const T &()
const &
74 return std::move(value_);
77 [[nodiscard]]
const T &
value() const &
84 return std::move(value_);
89 return canonical_name_;
97 [[nodiscard]]
const std::string &
source()
const
104 return source_details_;
121 template <
typename U>
128 override.source_info.empty() ?
source() :
override.source_info,
129 override.source_details.empty() ?
source_details() :
override.source_details};
158 [[nodiscard]] std::pair<std::vector<std::string>, std::vector<std::vector<FormatParam>>>
format_data()
const
164 std::vector<std::string> err_text{};
165 std::vector<std::vector<FormatParam>> params{};
167 err_text.emplace_back(
"{} = {}");
172 err_text.emplace_back(
"Source: {}");
177 err_text.emplace_back(
"");
178 params.emplace_back();
181 params.emplace_back();
185 return {err_text, params};
217 const auto [format_strings, param_vectors] =
format_data();
219 std::vector<std::string> result;
220 result.reserve(format_strings.size());
222 for (
const auto &[text, params] : std::views::zip(format_strings, param_vectors)) {
223 result.push_back(formatter.
format(text, params));
231 std::string canonical_name_;
232 std::string source_key_;
234 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.