7#include <unordered_map>
10#include "gsl/pointers"
69 gsl::not_null<TextFormatter *> format, std::vector<std::unique_ptr<ConfigProvider>> &&providers)
70 : format_{format}, providers_{std::move(providers)}
87 providers_{std::move(providers)}
150 [[nodiscard]] std::string
dump()
const;
162 void warmup_cache(
const std::vector<std::string> &tileset_names)
const;
165 std::unique_ptr<TextFormatter> owned_format_;
168 std::vector<std::unique_ptr<ConfigProvider>> providers_;
171 mutable std::map<std::string, std::any> cache_;
173 mutable std::unordered_map<std::string, std::string> cache_value_strings_;
176 mutable std::unordered_map<std::string, std::string> source_;
177 mutable std::unordered_map<std::string, std::vector<std::string>> source_details_;
187 template <
typename T>
Interface that defines a complete app layer configuration.
A result type that maintains a chainable sequence of errors for debugging and error reporting.
An interface which config implementations can use to load config values.
Interface that defines a complete domain layer configuration.
Interface that defines a complete infra layer configuration.
A Config implementation that lazily pulls a config value by consulting multiple priority-ordered back...
ChainableResult< ConfigValue< std::size_t > > num_tiles_total_raw(const std::string &tileset) const override
ChainableResult< ConfigValue< Rgba32 > > extrinsic_transparency_raw(const std::string &tileset) const override
ChainableResult< ConfigValue< TilesPalMode > > tiles_pal_mode_raw(const std::string &tileset) const override
ChainableResult< ConfigValue< std::size_t > > num_tiles_per_metatile_raw(const std::string &tileset) const override
ChainableResult< ConfigValue< std::size_t > > num_metatiles_total_raw(const std::string &tileset) const override
LazyLayeredConfig(std::vector< std::unique_ptr< ConfigProvider > > &&providers)
Constructs a LazyLayeredConfig with a default PlainTextFormatter.
ChainableResult< ConfigValue< bool > > patch_build_enabled_raw(const std::string &tileset) const override
ChainableResult< ConfigValue< std::size_t > > max_map_data_size_raw(const std::string &tileset) const override
ChainableResult< ConfigValue< std::size_t > > num_tiles_primary_raw(const std::string &tileset) const override
std::string dump() const
Dumps the current state of the config for debugging purposes.
LazyLayeredConfig(gsl::not_null< TextFormatter * > format, std::vector< std::unique_ptr< ConfigProvider > > &&providers)
Constructs a LazyLayeredConfig with a list of ConfigProviders in priority order, highest to lowest.
ChainableResult< ConfigValue< std::size_t > > num_metatiles_primary_raw(const std::string &tileset) const override
ChainableResult< ConfigValue< std::size_t > > num_pals_primary_raw(const std::string &tileset) const override
void warmup_cache(const std::vector< std::string > &tileset_names) const
Forces all configuration values to be cached immediately for all known tilesets.
ChainableResult< ConfigValue< std::size_t > > num_pals_total_raw(const std::string &tileset) const override
TextFormatter implementation that strips all styling from text.
Abstract base class for applying text styling with context-aware formatting.
A small container that holds an optional-wrapped value, validation state, and metadata about the valu...