Porytiles
Loading...
Searching...
No Matches
header_define_provider.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <filesystem>
4#include <memory>
5#include <optional>
6#include <string>
7
8#include "gsl/pointers"
9
14
15namespace porytiles {
16
17/*
18 * NOTE: DO NOT EDIT THIS FILE DIRECTLY. It is AUTO-GENERATED from config_schema.yaml.
19 * To add new config values or make other changes, edit config_schema.yaml and regenerate via:
20 *
21 * uv run scripts/generate_config.py
22 */
23
41 public:
54 std::filesystem::path project_root,
55 std::filesystem::path header_relative_path,
56 gsl::not_null<const TextFormatter *> format)
57 : format_{format}, project_root_{std::move(project_root)},
58 header_relative_path_{std::move(header_relative_path)}
59 {
60 // CParserFacade is lazily initialized on first define lookup
61 }
62
74 explicit HeaderDefineProvider(std::filesystem::path project_root, std::filesystem::path header_relative_path)
75 : owned_format_{std::make_unique<PlainTextFormatter>()}, format_{owned_format_.get()},
76 project_root_{std::move(project_root)}, header_relative_path_{std::move(header_relative_path)}
77 {
78 // CParserFacade is lazily initialized on first define lookup
79 }
80
86 [[nodiscard]] std::string name() const override;
87
88 [[nodiscard]] LayerValue<std::size_t> num_tiles_in_primary(ConfigScopeType type, const std::string &scope) const override;
89
90 [[nodiscard]] LayerValue<std::size_t> num_tiles_total(ConfigScopeType type, const std::string &scope) const override;
91
92 [[nodiscard]] LayerValue<std::size_t> num_metatiles_in_primary(ConfigScopeType type, const std::string &scope) const override;
93
94 [[nodiscard]] LayerValue<std::size_t> num_metatiles_total(ConfigScopeType type, const std::string &scope) const override;
95
96 [[nodiscard]] LayerValue<std::size_t> num_pals_in_primary(ConfigScopeType type, const std::string &scope) const override;
97
98 [[nodiscard]] LayerValue<std::size_t> num_pals_total(ConfigScopeType type, const std::string &scope) const override;
99
100 [[nodiscard]] LayerValue<std::size_t> max_map_data_size(ConfigScopeType type, const std::string &scope) const override;
101
102 [[nodiscard]] LayerValue<std::size_t> num_tiles_per_metatile(ConfigScopeType type, const std::string &scope) const override;
103
104 [[nodiscard]] LayerValue<Rgba32> extrinsic_transparency(ConfigScopeType type, const std::string &scope) const override;
105
106 [[nodiscard]] LayerValue<ArtifactEditMode> tiles_edit_mode(ConfigScopeType type, const std::string &scope) const override;
107
108 [[nodiscard]] LayerValue<ArtifactEditMode> pals_edit_mode(ConfigScopeType type, const std::string &scope) const override;
109
110 [[nodiscard]] LayerValue<bool> pal_hints_enabled(ConfigScopeType type, const std::string &scope) const override;
111
112 [[nodiscard]] LayerValue<std::vector<PaletteHint>> pal_hints(ConfigScopeType type, const std::string &scope) const override;
113
114 [[nodiscard]] LayerValue<PackingStrategyType> packing_strategy(ConfigScopeType type, const std::string &scope) const override;
115
116 [[nodiscard]] LayerValue<PackingStrategyParams> packing_strategy_params(ConfigScopeType type, const std::string &scope) const override;
117
118 [[nodiscard]] LayerValue<TileSharingPacking> tile_sharing_packing(ConfigScopeType type, const std::string &scope) const override;
119
120 [[nodiscard]] LayerValue<TileSharingAlignment> tile_sharing_alignment(ConfigScopeType type, const std::string &scope) const override;
121
122 [[nodiscard]] LayerValue<TilesPalMode> tiles_pal_mode(ConfigScopeType type, const std::string &scope) const override;
123
124 [[nodiscard]] LayerValue<AnimPalResolutionStrategy> global_anim_pal_resolution_strategy(ConfigScopeType type, const std::string &scope) const override;
125
126 [[nodiscard]] LayerValue<AnimKeyFrameResolutionStrategy> global_anim_key_frame_resolution_strategy(ConfigScopeType type, const std::string &scope) const override;
127
129
130 [[nodiscard]] LayerValue<FrameLinking> global_frame_linking(ConfigScopeType type, const std::string &scope) const override;
131
132 [[nodiscard]] LayerValue<PerAnimOverrides> per_anim_overrides(ConfigScopeType type, const std::string &scope) const override;
133
134 [[nodiscard]] LayerValue<bool> cross_tileset_anim_linking(ConfigScopeType type, const std::string &scope) const override;
135
136 [[nodiscard]] LayerValue<bool> verify_checksums(ConfigScopeType type, const std::string &scope) const override;
137
138 [[nodiscard]] LayerValue<PrimaryPairingMode> primary_pairing_mode(ConfigScopeType type, const std::string &scope) const override;
139
140 [[nodiscard]] LayerValue<std::vector<std::string>> primary_pairing_partners(ConfigScopeType type, const std::string &scope) const override;
141
142 [[nodiscard]] LayerValue<std::vector<std::string>> diagnostic_warnings_exclude(ConfigScopeType type, const std::string &scope) const override;
143
144 [[nodiscard]] LayerValue<std::vector<std::string>> diagnostic_warnings_include(ConfigScopeType type, const std::string &scope) const override;
145
146 [[nodiscard]] LayerValue<std::vector<std::string>> diagnostic_remarks_exclude(ConfigScopeType type, const std::string &scope) const override;
147
148 [[nodiscard]] LayerValue<std::vector<std::string>> diagnostic_remarks_include(ConfigScopeType type, const std::string &scope) const override;
149
150 [[nodiscard]] LayerValue<std::string> tileset_paths_primary_src(ConfigScopeType type, const std::string &scope) const override;
151
152 [[nodiscard]] LayerValue<std::string> tileset_paths_primary_bin(ConfigScopeType type, const std::string &scope) const override;
153
154 [[nodiscard]] LayerValue<std::string> tileset_paths_secondary_src(ConfigScopeType type, const std::string &scope) const override;
155
156 [[nodiscard]] LayerValue<std::string> tileset_paths_secondary_bin(ConfigScopeType type, const std::string &scope) const override;
157
158 [[nodiscard]] LayerValue<std::size_t> metatile_attr_size(ConfigScopeType type, const std::string &scope) const override;
159
160 [[nodiscard]] LayerValue<bool> tileset_animations_wire_anim_code(ConfigScopeType type, const std::string &scope) const override;
161
162 private:
163 std::unique_ptr<TextFormatter> owned_format_; // Optional owned formatter (when using default ctor)
164 const TextFormatter *format_; // Non-owning pointer to formatter
165 std::filesystem::path project_root_;
166 std::filesystem::path header_relative_path_;
167 mutable std::optional<CParserFacade> parser_driver_; // Lazy-initialized C parser
168};
169
170} // namespace porytiles
An interface which config implementations can use to load config values.
A ConfigProvider implementation that reads configuration values from #define directives in a header f...
LayerValue< ArtifactEditMode > tiles_edit_mode(ConfigScopeType type, const std::string &scope) const override
LayerValue< Rgba32 > extrinsic_transparency(ConfigScopeType type, const std::string &scope) const override
LayerValue< TileSharingPacking > tile_sharing_packing(ConfigScopeType type, const std::string &scope) const override
LayerValue< TileSharingAlignment > tile_sharing_alignment(ConfigScopeType type, const std::string &scope) const override
LayerValue< FrameLinking > global_frame_linking(ConfigScopeType type, const std::string &scope) const override
LayerValue< bool > verify_checksums(ConfigScopeType type, const std::string &scope) const override
LayerValue< PerAnimOverrides > per_anim_overrides(ConfigScopeType type, const std::string &scope) const override
LayerValue< TilesPalMode > tiles_pal_mode(ConfigScopeType type, const std::string &scope) const override
LayerValue< std::size_t > num_pals_in_primary(ConfigScopeType type, const std::string &scope) const override
LayerValue< std::size_t > num_tiles_in_primary(ConfigScopeType type, const std::string &scope) const override
LayerValue< AnimKeyFrameResolutionStrategy > global_anim_key_frame_resolution_strategy(ConfigScopeType type, const std::string &scope) const override
LayerValue< std::size_t > num_metatiles_in_primary(ConfigScopeType type, const std::string &scope) const override
LayerValue< std::string > tileset_paths_secondary_src(ConfigScopeType type, const std::string &scope) const override
HeaderDefineProvider(std::filesystem::path project_root, std::filesystem::path header_relative_path)
Constructs a HeaderDefineProvider with a default PlainTextFormatter.
HeaderDefineProvider(std::filesystem::path project_root, std::filesystem::path header_relative_path, gsl::not_null< const TextFormatter * > format)
Constructs a HeaderDefineProvider that reads #define values from a header file.
LayerValue< AnimPalResolutionStrategy > global_anim_pal_resolution_strategy(ConfigScopeType type, const std::string &scope) const override
LayerValue< AnimMultiPalSubtileResolutionStrategy > global_anim_multi_pal_subtile_resolution_strategy(ConfigScopeType type, const std::string &scope) const override
LayerValue< std::vector< std::string > > diagnostic_warnings_include(ConfigScopeType type, const std::string &scope) const override
LayerValue< std::string > tileset_paths_primary_src(ConfigScopeType type, const std::string &scope) const override
LayerValue< std::vector< std::string > > primary_pairing_partners(ConfigScopeType type, const std::string &scope) const override
LayerValue< std::string > tileset_paths_primary_bin(ConfigScopeType type, const std::string &scope) const override
LayerValue< std::size_t > metatile_attr_size(ConfigScopeType type, const std::string &scope) const override
LayerValue< std::vector< PaletteHint > > pal_hints(ConfigScopeType type, const std::string &scope) const override
LayerValue< PrimaryPairingMode > primary_pairing_mode(ConfigScopeType type, const std::string &scope) const override
LayerValue< std::size_t > num_metatiles_total(ConfigScopeType type, const std::string &scope) const override
LayerValue< std::vector< std::string > > diagnostic_remarks_exclude(ConfigScopeType type, const std::string &scope) const override
LayerValue< std::size_t > num_tiles_total(ConfigScopeType type, const std::string &scope) const override
LayerValue< PackingStrategyType > packing_strategy(ConfigScopeType type, const std::string &scope) const override
std::string name() const override
Gets the name of this config layer.
LayerValue< std::size_t > num_tiles_per_metatile(ConfigScopeType type, const std::string &scope) const override
LayerValue< std::size_t > max_map_data_size(ConfigScopeType type, const std::string &scope) const override
LayerValue< ArtifactEditMode > pals_edit_mode(ConfigScopeType type, const std::string &scope) const override
LayerValue< bool > tileset_animations_wire_anim_code(ConfigScopeType type, const std::string &scope) const override
LayerValue< bool > pal_hints_enabled(ConfigScopeType type, const std::string &scope) const override
LayerValue< std::size_t > num_pals_total(ConfigScopeType type, const std::string &scope) const override
LayerValue< std::vector< std::string > > diagnostic_remarks_include(ConfigScopeType type, const std::string &scope) const override
LayerValue< PackingStrategyParams > packing_strategy_params(ConfigScopeType type, const std::string &scope) const override
LayerValue< std::vector< std::string > > diagnostic_warnings_exclude(ConfigScopeType type, const std::string &scope) const override
LayerValue< std::string > tileset_paths_secondary_bin(ConfigScopeType type, const std::string &scope) const override
LayerValue< bool > cross_tileset_anim_linking(ConfigScopeType type, const std::string &scope) const override
TextFormatter implementation that strips all styling from text.
Abstract base class for applying text styling with context-aware formatting.
ConfigScopeType
Specifies the scope type for configuration value lookups.
A small container that holds an optional-wrapped value, validation state, and metadata about the valu...