Porytiles
Loading...
Searching...
No Matches
infra_config.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <memory>
4#include <string>
5
12
13namespace porytiles {
14
15// NOTE: DO NOT EDIT THIS FILE DIRECTLY. It is AUTO-GENERATED from config_schema.yaml.
16// To add new config values or make other changes, edit config_schema.yaml and regenerate via:
17//
18// uv run scripts/generate_config.py
19
20class ConfigProvider; // forward declaration; full type is in infra/config/config_provider.hpp
21
24 public:
25 virtual ~InfraConfig() = default;
26
35 virtual void add_provider(std::unique_ptr<ConfigProvider> provider) = 0;
36
37 // Public method with cross-field validation only (Tier 3)
39 tileset_paths_primary_src(ConfigScopeType type, const std::string &scope) const
40 {
41 auto validated_val = tileset_paths_primary_src_validated(type, scope);
42 return validated_val;
43 }
44
45 // Public method with cross-field validation only (Tier 3)
47 tileset_paths_primary_bin(ConfigScopeType type, const std::string &scope) const
48 {
49 auto validated_val = tileset_paths_primary_bin_validated(type, scope);
50 return validated_val;
51 }
52
53 // Public method with cross-field validation only (Tier 3)
55 tileset_paths_secondary_src(ConfigScopeType type, const std::string &scope) const
56 {
57 auto validated_val = tileset_paths_secondary_src_validated(type, scope);
58 return validated_val;
59 }
60
61 // Public method with cross-field validation only (Tier 3)
63 tileset_paths_secondary_bin(ConfigScopeType type, const std::string &scope) const
64 {
65 auto validated_val = tileset_paths_secondary_bin_validated(type, scope);
66 return validated_val;
67 }
68
69 // Public method with cross-field validation only (Tier 3)
71 metatile_attribute_size(ConfigScopeType type, const std::string &scope) const
72 {
73 auto validated_val = metatile_attribute_size_validated(type, scope);
74 return validated_val;
75 }
76
77 // Public method with cross-field validation only (Tier 3)
79 metatile_attribute_declaration_size(ConfigScopeType type, const std::string &scope) const
80 {
81 auto validated_val = metatile_attribute_declaration_size_validated(type, scope);
82 return validated_val;
83 }
84
85 // Public method with cross-field validation only (Tier 3)
87 metatile_attribute_fields(ConfigScopeType type, const std::string &scope) const
88 {
89 auto validated_val = metatile_attribute_fields_validated(type, scope);
90 return validated_val;
91 }
92
93 // Public method with cross-field validation only (Tier 3)
95 metatile_attribute_field_overrides(ConfigScopeType type, const std::string &scope) const
96 {
97 auto validated_val = metatile_attribute_field_overrides_validated(type, scope);
98 return validated_val;
99 }
100
101 // Public method with cross-field validation only (Tier 3)
103 role_pins(ConfigScopeType type, const std::string &scope) const
104 {
105 auto validated_val = role_pins_validated(type, scope);
106 return validated_val;
107 }
108
109 // Public method with cross-field validation only (Tier 3)
111 tileset_animations_wire_anim_code(ConfigScopeType type, const std::string &scope) const
112 {
113 auto validated_val = tileset_animations_wire_anim_code_validated(type, scope);
114 return validated_val;
115 }
116
117 protected:
118 // Protected method with single-value validation only (Tier 2)
119 [[nodiscard]] virtual ChainableResult<ConfigValue<std::string>>
120 tileset_paths_primary_src_validated(ConfigScopeType type, const std::string &scope) const
121 {
122 auto raw_val = tileset_paths_primary_src_raw(type, scope);
123 return raw_val;
124 }
125
126 // Protected virtual method that fetches raw value from provider (Tier 1)
127 [[nodiscard]] virtual ChainableResult<ConfigValue<std::string>>
128 tileset_paths_primary_src_raw(ConfigScopeType type, const std::string &scope) const = 0;
129
130 // Protected method with single-value validation only (Tier 2)
131 [[nodiscard]] virtual ChainableResult<ConfigValue<std::string>>
132 tileset_paths_primary_bin_validated(ConfigScopeType type, const std::string &scope) const
133 {
134 auto raw_val = tileset_paths_primary_bin_raw(type, scope);
135 return raw_val;
136 }
137
138 // Protected virtual method that fetches raw value from provider (Tier 1)
139 [[nodiscard]] virtual ChainableResult<ConfigValue<std::string>>
140 tileset_paths_primary_bin_raw(ConfigScopeType type, const std::string &scope) const = 0;
141
142 // Protected method with single-value validation only (Tier 2)
143 [[nodiscard]] virtual ChainableResult<ConfigValue<std::string>>
144 tileset_paths_secondary_src_validated(ConfigScopeType type, const std::string &scope) const
145 {
146 auto raw_val = tileset_paths_secondary_src_raw(type, scope);
147 return raw_val;
148 }
149
150 // Protected virtual method that fetches raw value from provider (Tier 1)
151 [[nodiscard]] virtual ChainableResult<ConfigValue<std::string>>
152 tileset_paths_secondary_src_raw(ConfigScopeType type, const std::string &scope) const = 0;
153
154 // Protected method with single-value validation only (Tier 2)
155 [[nodiscard]] virtual ChainableResult<ConfigValue<std::string>>
156 tileset_paths_secondary_bin_validated(ConfigScopeType type, const std::string &scope) const
157 {
158 auto raw_val = tileset_paths_secondary_bin_raw(type, scope);
159 return raw_val;
160 }
161
162 // Protected virtual method that fetches raw value from provider (Tier 1)
163 [[nodiscard]] virtual ChainableResult<ConfigValue<std::string>>
164 tileset_paths_secondary_bin_raw(ConfigScopeType type, const std::string &scope) const = 0;
165
166 // Protected method with single-value validation only (Tier 2)
168 metatile_attribute_size_validated(ConfigScopeType type, const std::string &scope) const
169 {
170 auto raw_val = metatile_attribute_size_raw(type, scope);
171 // Apply validators in sequence
172 if (raw_val.has_value()) {
173 raw_val = optional_size_t_val_one_two_or_four(raw_val.value());
174 }
175 return raw_val;
176 }
177
178 // Protected virtual method that fetches raw value from provider (Tier 1)
180 metatile_attribute_size_raw(ConfigScopeType type, const std::string &scope) const = 0;
181
182 // Protected method with single-value validation only (Tier 2)
185 {
186 auto raw_val = metatile_attribute_declaration_size_raw(type, scope);
187 // Apply validators in sequence
188 if (raw_val.has_value()) {
189 raw_val = optional_size_t_val_one_two_or_four(raw_val.value());
190 }
191 return raw_val;
192 }
193
194 // Protected virtual method that fetches raw value from provider (Tier 1)
196 metatile_attribute_declaration_size_raw(ConfigScopeType type, const std::string &scope) const = 0;
197
198 // Protected method with single-value validation only (Tier 2)
200 metatile_attribute_fields_validated(ConfigScopeType type, const std::string &scope) const
201 {
202 auto raw_val = metatile_attribute_fields_raw(type, scope);
203 return raw_val;
204 }
205
206 // Protected virtual method that fetches raw value from provider (Tier 1)
208 metatile_attribute_fields_raw(ConfigScopeType type, const std::string &scope) const = 0;
209
210 // Protected method with single-value validation only (Tier 2)
213 {
214 auto raw_val = metatile_attribute_field_overrides_raw(type, scope);
215 return raw_val;
216 }
217
218 // Protected virtual method that fetches raw value from provider (Tier 1)
220 metatile_attribute_field_overrides_raw(ConfigScopeType type, const std::string &scope) const = 0;
221
222 // Protected method with single-value validation only (Tier 2)
224 role_pins_validated(ConfigScopeType type, const std::string &scope) const
225 {
226 auto raw_val = role_pins_raw(type, scope);
227 return raw_val;
228 }
229
230 // Protected virtual method that fetches raw value from provider (Tier 1)
232 role_pins_raw(ConfigScopeType type, const std::string &scope) const = 0;
233
234 // Protected method with single-value validation only (Tier 2)
235 [[nodiscard]] virtual ChainableResult<ConfigValue<bool>>
237 {
238 auto raw_val = tileset_animations_wire_anim_code_raw(type, scope);
239 return raw_val;
240 }
241
242 // Protected virtual method that fetches raw value from provider (Tier 1)
243 [[nodiscard]] virtual ChainableResult<ConfigValue<bool>>
244 tileset_animations_wire_anim_code_raw(ConfigScopeType type, const std::string &scope) const = 0;
245};
246
247} // namespace porytiles
A result type that maintains a chainable sequence of errors for debugging and error reporting.
Interface that defines a complete infra layer configuration.
ChainableResult< ConfigValue< std::string > > tileset_paths_secondary_bin(ConfigScopeType type, const std::string &scope) const
virtual void add_provider(std::unique_ptr< ConfigProvider > provider)=0
Prepends a ConfigProvider to the provider chain at highest priority.
virtual ChainableResult< ConfigValue< std::optional< std::size_t > > > metatile_attribute_size_raw(ConfigScopeType type, const std::string &scope) const =0
ChainableResult< ConfigValue< MetatileAttributeFieldOverrides > > metatile_attribute_field_overrides(ConfigScopeType type, const std::string &scope) const
virtual ChainableResult< ConfigValue< RolePinDefinitions > > role_pins_raw(ConfigScopeType type, const std::string &scope) const =0
virtual ChainableResult< ConfigValue< bool > > tileset_animations_wire_anim_code_raw(ConfigScopeType type, const std::string &scope) const =0
ChainableResult< ConfigValue< std::optional< std::size_t > > > metatile_attribute_size(ConfigScopeType type, const std::string &scope) const
virtual ChainableResult< ConfigValue< MetatileAttributeFieldDefinitions > > metatile_attribute_fields_raw(ConfigScopeType type, const std::string &scope) const =0
virtual ChainableResult< ConfigValue< std::optional< std::size_t > > > metatile_attribute_declaration_size_validated(ConfigScopeType type, const std::string &scope) const
virtual ChainableResult< ConfigValue< std::string > > tileset_paths_primary_bin_validated(ConfigScopeType type, const std::string &scope) const
virtual ChainableResult< ConfigValue< std::string > > tileset_paths_primary_src_raw(ConfigScopeType type, const std::string &scope) const =0
virtual ChainableResult< ConfigValue< std::string > > tileset_paths_primary_src_validated(ConfigScopeType type, const std::string &scope) const
virtual ChainableResult< ConfigValue< std::string > > tileset_paths_secondary_src_validated(ConfigScopeType type, const std::string &scope) const
virtual ~InfraConfig()=default
virtual ChainableResult< ConfigValue< std::string > > tileset_paths_secondary_src_raw(ConfigScopeType type, const std::string &scope) const =0
virtual ChainableResult< ConfigValue< bool > > tileset_animations_wire_anim_code_validated(ConfigScopeType type, const std::string &scope) const
ChainableResult< ConfigValue< std::string > > tileset_paths_primary_bin(ConfigScopeType type, const std::string &scope) const
virtual ChainableResult< ConfigValue< RolePinDefinitions > > role_pins_validated(ConfigScopeType type, const std::string &scope) const
virtual ChainableResult< ConfigValue< std::optional< std::size_t > > > metatile_attribute_declaration_size_raw(ConfigScopeType type, const std::string &scope) const =0
virtual ChainableResult< ConfigValue< std::string > > tileset_paths_secondary_bin_validated(ConfigScopeType type, const std::string &scope) const
ChainableResult< ConfigValue< std::string > > tileset_paths_primary_src(ConfigScopeType type, const std::string &scope) const
virtual ChainableResult< ConfigValue< MetatileAttributeFieldDefinitions > > metatile_attribute_fields_validated(ConfigScopeType type, const std::string &scope) const
ChainableResult< ConfigValue< bool > > tileset_animations_wire_anim_code(ConfigScopeType type, const std::string &scope) const
virtual ChainableResult< ConfigValue< MetatileAttributeFieldOverrides > > metatile_attribute_field_overrides_validated(ConfigScopeType type, const std::string &scope) const
virtual ChainableResult< ConfigValue< MetatileAttributeFieldOverrides > > metatile_attribute_field_overrides_raw(ConfigScopeType type, const std::string &scope) const =0
virtual ChainableResult< ConfigValue< std::string > > tileset_paths_primary_bin_raw(ConfigScopeType type, const std::string &scope) const =0
ChainableResult< ConfigValue< std::string > > tileset_paths_secondary_src(ConfigScopeType type, const std::string &scope) const
ChainableResult< ConfigValue< RolePinDefinitions > > role_pins(ConfigScopeType type, const std::string &scope) const
virtual ChainableResult< ConfigValue< std::optional< std::size_t > > > metatile_attribute_size_validated(ConfigScopeType type, const std::string &scope) const
ChainableResult< ConfigValue< std::optional< std::size_t > > > metatile_attribute_declaration_size(ConfigScopeType type, const std::string &scope) const
ChainableResult< ConfigValue< MetatileAttributeFieldDefinitions > > metatile_attribute_fields(ConfigScopeType type, const std::string &scope) const
virtual ChainableResult< ConfigValue< std::string > > tileset_paths_secondary_bin_raw(ConfigScopeType type, const std::string &scope) const =0
std::optional< ProviderDefinition > provider
ChainableResult< ConfigValue< std::optional< std::size_t > > > optional_size_t_val_one_two_or_four(const ConfigValue< std::optional< std::size_t > > &val)
Validates that an optional size_t config value, when set, is 1, 2, or 4.
ConfigScopeType
Specifies the scope type for configuration value lookups.
Cross-cutting configuration validators shared across all architectural layers.