|
Porytiles
|
Cross-cutting configuration validators shared across all architectural layers. More...
#include <cstddef>#include <functional>#include <string>#include <vector>#include "porytiles/utilities/result/chainable_result.hpp"#include "porytiles/xcut/config/config_scope_type.hpp"#include "porytiles/xcut/config/config_value.hpp"Go to the source code of this file.
Namespaces | |
| namespace | porytiles |
| namespace | porytiles::details |
Functions | |
| ChainableResult< ConfigValue< std::size_t > > | porytiles::size_t_val_greater_than_zero (const ConfigValue< std::size_t > &val) |
| Validates that a size_t config value is greater than zero. | |
| ChainableResult< ConfigValue< std::size_t > > | porytiles::size_t_val_two_or_four (const ConfigValue< std::size_t > &val) |
| Validates that a size_t config value is either 2 or 4. | |
| ChainableResult< ConfigValue< std::size_t > > | porytiles::size_t_val_eight_or_twelve (const ConfigValue< std::size_t > &val) |
| Validates that a size_t config value is either 8 or 12. | |
| template<typename T , typename ConfigInterface , typename FetchFunc , typename Comparator > | |
| ChainableResult< ConfigValue< T > > | porytiles::details::compare_values (const ConfigValue< T > &val, const ConfigInterface &config, ConfigScopeType type, const std::string &scope, const std::string &other_field_name, FetchFunc fetch_other, Comparator comp, std::string_view error_message) |
| Generic comparison validator that compares the current value against another config value. | |
| template<typename T , typename ConfigInterface , typename FetchFunc > | |
| ChainableResult< ConfigValue< T > > | porytiles::compare_greater_than (const ConfigValue< T > &val, const ConfigInterface &config, ConfigScopeType type, const std::string &scope, const std::string &other_field_name, FetchFunc fetch_other) |
| Validates that the current value is greater than another config value. | |
| template<typename T , typename ConfigInterface , typename FetchFunc > | |
| ChainableResult< ConfigValue< T > > | porytiles::compare_less_than (const ConfigValue< T > &val, const ConfigInterface &config, ConfigScopeType type, const std::string &scope, const std::string &other_field_name, FetchFunc fetch_other) |
| Validates that the current value is less than another config value. | |
| template<typename T , typename ConfigInterface , typename FetchFunc > | |
| ChainableResult< ConfigValue< T > > | porytiles::compare_greater_equal (const ConfigValue< T > &val, const ConfigInterface &config, ConfigScopeType type, const std::string &scope, const std::string &other_field_name, FetchFunc fetch_other) |
| Validates that the current value is greater than or equal to another config value. | |
| template<typename T , typename ConfigInterface , typename FetchFunc > | |
| ChainableResult< ConfigValue< T > > | porytiles::compare_less_equal (const ConfigValue< T > &val, const ConfigInterface &config, ConfigScopeType type, const std::string &scope, const std::string &other_field_name, FetchFunc fetch_other) |
| Validates that the current value is less than or equal to another config value. | |
| template<typename T , typename ConfigInterface , typename FetchFunc > | |
| ChainableResult< ConfigValue< T > > | porytiles::compare_equal (const ConfigValue< T > &val, const ConfigInterface &config, const std::string &scope_param, const std::string &other_field_name, FetchFunc fetch_other) |
| Validates that the current value is equal to another config value. | |
| template<typename T , typename ConfigInterface , typename FetchFunc > | |
| ChainableResult< ConfigValue< T > > | porytiles::compare_not_equal (const ConfigValue< T > &val, const ConfigInterface &config, const std::string &scope_param, const std::string &other_field_name, FetchFunc fetch_other) |
| Validates that the current value is not equal to another config value. | |
Cross-cutting configuration validators shared across all architectural layers.
This file provides layer-agnostic configuration validators that can be used by DomainConfig, AppConfig, and InfraConfig without introducing circular dependencies. The validators are organized into two categories:
Validator Categories
Design Rationale: Why xcut Layer for Common Validators?
The xcut (cross-cutting) layer sits above the domain, app, and infra layers in the architectural hierarchy. By placing common validators here, we achieve several benefits:
Layer-Specific Validators: When and Why?
When a validator needs to reference layer-specific types (e.g., TilesPalMode from the infra layer), it cannot be defined here in xcut because that would require xcut to depend on a lower-level layer, creating a circular dependency. In these cases, the validator should be defined in a layer-specific header such as app_config_validators.hpp, domain_config_validators.hpp, or infra_config_validators.hpp.
The config generation system supports this pattern seamlessly because validators are referenced by name as strings in the YAML schema. During code generation, these validator function names are copy-pasted into the generated layer config files. The generation process is agnostic to where the validators are defined - it only cares that the function name matches. This allows each layer's config header to include both the common xcut validators and its own layer-specific validators without any dependency issues.
Definition in file xcut_config_validators.hpp.