Porytiles
Loading...
Searching...
No Matches
porytiles::YamlFileProvider Class Referencefinal

A ConfigProvider implementation that reads configuration values from multiple YAML files with priority. More...

#include <yaml_file_provider.hpp>

Inheritance diagram for porytiles::YamlFileProvider:
[legend]
Collaboration diagram for porytiles::YamlFileProvider:
[legend]

Public Member Functions

 YamlFileProvider (gsl::not_null< const TextFormatter * > format, const UserDiagnostics *diagnostics, const std::filesystem::path &project_root)
 Constructs a YamlFileProvider that searches for configuration across multiple YAML files.
 
 YamlFileProvider (const UserDiagnostics *diagnostics, const std::filesystem::path &project_root)
 Constructs a YamlFileProvider with a default PlainTextFormatter.
 
std::string name () const override
 Gets the name of this config layer.
 
bool preload_and_validate (ConfigScopeType type, const std::string &scope) const
 Eagerly loads all YAML config files and validates them for unknown keys.
 
LayerValue< std::size_t > num_tiles_in_primary (ConfigScopeType type, const std::string &scope) const override
 
LayerValue< std::size_t > num_tiles_total (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::size_t > num_metatiles_total (ConfigScopeType type, const std::string &scope) const override
 
LayerValue< std::size_t > num_palettes_in_primary (ConfigScopeType type, const std::string &scope) const override
 
LayerValue< std::size_t > num_palettes_total (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< std::size_t > num_tiles_per_metatile (ConfigScopeType type, const std::string &scope) const override
 
LayerValue< Rgba32extrinsic_transparency (ConfigScopeType type, const std::string &scope) const override
 
LayerValue< bool > ignore_triple_layer_content (ConfigScopeType type, const std::string &scope) const override
 
LayerValue< ArtifactEditModetiles_edit_mode (ConfigScopeType type, const std::string &scope) const override
 
LayerValue< ArtifactEditModepalettes_edit_mode (ConfigScopeType type, const std::string &scope) const override
 
LayerValue< bool > palette_hints_enabled (ConfigScopeType type, const std::string &scope) const override
 
LayerValue< std::vector< PaletteHint > > palette_hints (ConfigScopeType type, const std::string &scope) const override
 
LayerValue< PackingStrategyTypepacking_strategy (ConfigScopeType type, const std::string &scope) const override
 
LayerValue< PackingStrategyParamspacking_strategy_params (ConfigScopeType type, const std::string &scope) const override
 
LayerValue< TileSharingPackingtile_sharing_packing (ConfigScopeType type, const std::string &scope) const override
 
LayerValue< TileSharingAlignmenttile_sharing_alignment (ConfigScopeType type, const std::string &scope) const override
 
LayerValue< TilesPaletteModetiles_palette_mode (ConfigScopeType type, const std::string &scope) const override
 
LayerValue< AnimPaletteResolutionStrategyglobal_anim_palette_resolution_strategy (ConfigScopeType type, const std::string &scope) const override
 
LayerValue< AnimKeyFrameResolutionStrategyglobal_anim_key_frame_resolution_strategy (ConfigScopeType type, const std::string &scope) const override
 
LayerValue< AnimMultiPaletteSubtileResolutionStrategyglobal_anim_multi_palette_subtile_resolution_strategy (ConfigScopeType type, const std::string &scope) const override
 
LayerValue< FrameLinkingglobal_frame_linking (ConfigScopeType type, const std::string &scope) const override
 
LayerValue< PerAnimOverridesper_anim_overrides (ConfigScopeType type, const std::string &scope) const override
 
LayerValue< bool > cross_tileset_anim_linking (ConfigScopeType type, const std::string &scope) const override
 
LayerValue< bool > verify_checksums (ConfigScopeType type, const std::string &scope) const override
 
LayerValue< PrimaryPairingModeprimary_pairing_mode (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::vector< std::string > > diagnostic_warnings_exclude (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::vector< std::string > > diagnostic_remarks_exclude (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< std::string > tileset_paths_primary_src (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::string > tileset_paths_secondary_src (ConfigScopeType type, const std::string &scope) const override
 
LayerValue< std::string > tileset_paths_secondary_bin (ConfigScopeType type, const std::string &scope) const override
 
LayerValue< std::optional< std::size_t > > metatile_attribute_size (ConfigScopeType type, const std::string &scope) const override
 
LayerValue< std::optional< std::size_t > > metatile_attribute_declaration_size (ConfigScopeType type, const std::string &scope) const override
 
LayerValue< MetatileAttributeFieldDefinitionsmetatile_attribute_fields (ConfigScopeType type, const std::string &scope) const override
 
LayerValue< MetatileAttributeFieldOverridesmetatile_attribute_field_overrides (ConfigScopeType type, const std::string &scope) const override
 
LayerValue< RolePinDefinitionsrole_pins (ConfigScopeType type, const std::string &scope) const override
 
LayerValue< bool > tileset_animations_wire_anim_code (ConfigScopeType type, const std::string &scope) const override
 
- Public Member Functions inherited from porytiles::ConfigProvider
virtual ~ConfigProvider ()=default
 

Detailed Description

A ConfigProvider implementation that reads configuration values from multiple YAML files with priority.

YamlFileProvider loads YAML configuration files from multiple locations and provides access to configuration values defined within them. Config files are searched in priority order:

  1. porytiles/tilesets/{tileset_name}/config.local.yaml (highest priority)
  2. porytiles/tilesets/{tileset_name}/config.yaml
  3. porytiles/config.local.yaml
  4. porytiles/config.yaml (lowest priority)

Files are loaded lazily and cached for performance. If no config files exist or a key is not found, methods return LayerValue::not_provided(), allowing graceful fallback to other providers in a layered configuration system.

Definition at line 32 of file yaml_file_provider.hpp.

Constructor & Destructor Documentation

◆ YamlFileProvider() [1/2]

porytiles::YamlFileProvider::YamlFileProvider ( gsl::not_null< const TextFormatter * >  format,
const UserDiagnostics diagnostics,
const std::filesystem::path &  project_root 
)
explicit

Constructs a YamlFileProvider that searches for configuration across multiple YAML files.

This constructor sets up the provider to search for configuration values across multiple config files in priority order. Config files are loaded lazily when first accessed and cached for subsequent lookups. Unknown YAML keys will be reported as errors via the diagnostics interface.

Parameters
formatA pointer to the TextFormatter to use
diagnosticsA pointer to UserDiagnostics for emitting errors about unknown keys
project_rootThe root directory of the project

Definition at line 23 of file yaml_file_provider.cpp.

◆ YamlFileProvider() [2/2]

porytiles::YamlFileProvider::YamlFileProvider ( const UserDiagnostics diagnostics,
const std::filesystem::path &  project_root 
)
explicit

Constructs a YamlFileProvider with a default PlainTextFormatter.

This constructor creates an internally owned PlainTextFormatter instance and uses it for formatting. The YamlFileProvider will search for configuration values across multiple config files in priority order. Config files are loaded lazily when first accessed and cached for subsequent lookups. Unknown YAML keys will be reported as errors via the diagnostics interface.

Parameters
diagnosticsA pointer to UserDiagnostics for emitting errors about unknown keys
project_rootThe root directory of the project

Definition at line 32 of file yaml_file_provider.cpp.

Member Function Documentation

◆ cross_tileset_anim_linking()

LayerValue< bool > porytiles::YamlFileProvider::cross_tileset_anim_linking ( ConfigScopeType  type,
const std::string &  scope 
) const
overridevirtual

Reimplemented from porytiles::ConfigProvider.

Definition at line 462 of file yaml_file_provider.cpp.

◆ diagnostic_remarks_exclude()

LayerValue< std::vector< std::string > > porytiles::YamlFileProvider::diagnostic_remarks_exclude ( ConfigScopeType  type,
const std::string &  scope 
) const
overridevirtual

Reimplemented from porytiles::ConfigProvider.

Definition at line 567 of file yaml_file_provider.cpp.

◆ diagnostic_remarks_include()

LayerValue< std::vector< std::string > > porytiles::YamlFileProvider::diagnostic_remarks_include ( ConfigScopeType  type,
const std::string &  scope 
) const
overridevirtual

Reimplemented from porytiles::ConfigProvider.

Definition at line 585 of file yaml_file_provider.cpp.

◆ diagnostic_warnings_exclude()

LayerValue< std::vector< std::string > > porytiles::YamlFileProvider::diagnostic_warnings_exclude ( ConfigScopeType  type,
const std::string &  scope 
) const
overridevirtual

Reimplemented from porytiles::ConfigProvider.

Definition at line 531 of file yaml_file_provider.cpp.

◆ diagnostic_warnings_include()

LayerValue< std::vector< std::string > > porytiles::YamlFileProvider::diagnostic_warnings_include ( ConfigScopeType  type,
const std::string &  scope 
) const
overridevirtual

Reimplemented from porytiles::ConfigProvider.

Definition at line 549 of file yaml_file_provider.cpp.

◆ extrinsic_transparency()

LayerValue< Rgba32 > porytiles::YamlFileProvider::extrinsic_transparency ( ConfigScopeType  type,
const std::string &  scope 
) const
overridevirtual

Reimplemented from porytiles::ConfigProvider.

Definition at line 185 of file yaml_file_provider.cpp.

◆ global_anim_key_frame_resolution_strategy()

LayerValue< AnimKeyFrameResolutionStrategy > porytiles::YamlFileProvider::global_anim_key_frame_resolution_strategy ( ConfigScopeType  type,
const std::string &  scope 
) const
overridevirtual

Reimplemented from porytiles::ConfigProvider.

Definition at line 392 of file yaml_file_provider.cpp.

◆ global_anim_multi_palette_subtile_resolution_strategy()

LayerValue< AnimMultiPaletteSubtileResolutionStrategy > porytiles::YamlFileProvider::global_anim_multi_palette_subtile_resolution_strategy ( ConfigScopeType  type,
const std::string &  scope 
) const
overridevirtual

Reimplemented from porytiles::ConfigProvider.

Definition at line 410 of file yaml_file_provider.cpp.

◆ global_anim_palette_resolution_strategy()

LayerValue< AnimPaletteResolutionStrategy > porytiles::YamlFileProvider::global_anim_palette_resolution_strategy ( ConfigScopeType  type,
const std::string &  scope 
) const
overridevirtual

Reimplemented from porytiles::ConfigProvider.

Definition at line 374 of file yaml_file_provider.cpp.

◆ global_frame_linking()

LayerValue< FrameLinking > porytiles::YamlFileProvider::global_frame_linking ( ConfigScopeType  type,
const std::string &  scope 
) const
overridevirtual

Reimplemented from porytiles::ConfigProvider.

Definition at line 428 of file yaml_file_provider.cpp.

◆ ignore_triple_layer_content()

LayerValue< bool > porytiles::YamlFileProvider::ignore_triple_layer_content ( ConfigScopeType  type,
const std::string &  scope 
) const
overridevirtual

Reimplemented from porytiles::ConfigProvider.

Definition at line 201 of file yaml_file_provider.cpp.

◆ max_map_data_size()

LayerValue< std::size_t > porytiles::YamlFileProvider::max_map_data_size ( ConfigScopeType  type,
const std::string &  scope 
) const
overridevirtual

Reimplemented from porytiles::ConfigProvider.

Definition at line 151 of file yaml_file_provider.cpp.

◆ metatile_attribute_declaration_size()

LayerValue< std::optional< std::size_t > > porytiles::YamlFileProvider::metatile_attribute_declaration_size ( ConfigScopeType  type,
const std::string &  scope 
) const
overridevirtual

Reimplemented from porytiles::ConfigProvider.

Definition at line 693 of file yaml_file_provider.cpp.

◆ metatile_attribute_field_overrides()

LayerValue< MetatileAttributeFieldOverrides > porytiles::YamlFileProvider::metatile_attribute_field_overrides ( ConfigScopeType  type,
const std::string &  scope 
) const
overridevirtual

Reimplemented from porytiles::ConfigProvider.

Definition at line 729 of file yaml_file_provider.cpp.

◆ metatile_attribute_fields()

LayerValue< MetatileAttributeFieldDefinitions > porytiles::YamlFileProvider::metatile_attribute_fields ( ConfigScopeType  type,
const std::string &  scope 
) const
overridevirtual

Reimplemented from porytiles::ConfigProvider.

Definition at line 711 of file yaml_file_provider.cpp.

◆ metatile_attribute_size()

LayerValue< std::optional< std::size_t > > porytiles::YamlFileProvider::metatile_attribute_size ( ConfigScopeType  type,
const std::string &  scope 
) const
overridevirtual

Reimplemented from porytiles::ConfigProvider.

Definition at line 675 of file yaml_file_provider.cpp.

◆ name()

std::string porytiles::YamlFileProvider::name ( ) const
overridevirtual

Gets the name of this config layer.

Returns
The name "YamlFileProvider"

Implements porytiles::ConfigProvider.

Definition at line 39 of file yaml_file_provider.cpp.

◆ num_metatiles_in_primary()

LayerValue< std::size_t > porytiles::YamlFileProvider::num_metatiles_in_primary ( ConfigScopeType  type,
const std::string &  scope 
) const
overridevirtual

Reimplemented from porytiles::ConfigProvider.

Definition at line 83 of file yaml_file_provider.cpp.

◆ num_metatiles_total()

LayerValue< std::size_t > porytiles::YamlFileProvider::num_metatiles_total ( ConfigScopeType  type,
const std::string &  scope 
) const
overridevirtual

Reimplemented from porytiles::ConfigProvider.

Definition at line 100 of file yaml_file_provider.cpp.

◆ num_palettes_in_primary()

LayerValue< std::size_t > porytiles::YamlFileProvider::num_palettes_in_primary ( ConfigScopeType  type,
const std::string &  scope 
) const
overridevirtual

Reimplemented from porytiles::ConfigProvider.

Definition at line 117 of file yaml_file_provider.cpp.

◆ num_palettes_total()

LayerValue< std::size_t > porytiles::YamlFileProvider::num_palettes_total ( ConfigScopeType  type,
const std::string &  scope 
) const
overridevirtual

Reimplemented from porytiles::ConfigProvider.

Definition at line 134 of file yaml_file_provider.cpp.

◆ num_tiles_in_primary()

LayerValue< std::size_t > porytiles::YamlFileProvider::num_tiles_in_primary ( ConfigScopeType  type,
const std::string &  scope 
) const
overridevirtual

Reimplemented from porytiles::ConfigProvider.

Definition at line 49 of file yaml_file_provider.cpp.

◆ num_tiles_per_metatile()

LayerValue< std::size_t > porytiles::YamlFileProvider::num_tiles_per_metatile ( ConfigScopeType  type,
const std::string &  scope 
) const
overridevirtual

Reimplemented from porytiles::ConfigProvider.

Definition at line 168 of file yaml_file_provider.cpp.

◆ num_tiles_total()

LayerValue< std::size_t > porytiles::YamlFileProvider::num_tiles_total ( ConfigScopeType  type,
const std::string &  scope 
) const
overridevirtual

Reimplemented from porytiles::ConfigProvider.

Definition at line 66 of file yaml_file_provider.cpp.

◆ packing_strategy()

LayerValue< PackingStrategyType > porytiles::YamlFileProvider::packing_strategy ( ConfigScopeType  type,
const std::string &  scope 
) const
overridevirtual

Reimplemented from porytiles::ConfigProvider.

Definition at line 285 of file yaml_file_provider.cpp.

◆ packing_strategy_params()

LayerValue< PackingStrategyParams > porytiles::YamlFileProvider::packing_strategy_params ( ConfigScopeType  type,
const std::string &  scope 
) const
overridevirtual

Reimplemented from porytiles::ConfigProvider.

Definition at line 303 of file yaml_file_provider.cpp.

◆ palette_hints()

LayerValue< std::vector< PaletteHint > > porytiles::YamlFileProvider::palette_hints ( ConfigScopeType  type,
const std::string &  scope 
) const
overridevirtual

Reimplemented from porytiles::ConfigProvider.

Definition at line 268 of file yaml_file_provider.cpp.

◆ palette_hints_enabled()

LayerValue< bool > porytiles::YamlFileProvider::palette_hints_enabled ( ConfigScopeType  type,
const std::string &  scope 
) const
overridevirtual

Reimplemented from porytiles::ConfigProvider.

Definition at line 251 of file yaml_file_provider.cpp.

◆ palettes_edit_mode()

LayerValue< ArtifactEditMode > porytiles::YamlFileProvider::palettes_edit_mode ( ConfigScopeType  type,
const std::string &  scope 
) const
overridevirtual

Reimplemented from porytiles::ConfigProvider.

Definition at line 234 of file yaml_file_provider.cpp.

◆ per_anim_overrides()

LayerValue< PerAnimOverrides > porytiles::YamlFileProvider::per_anim_overrides ( ConfigScopeType  type,
const std::string &  scope 
) const
overridevirtual

Reimplemented from porytiles::ConfigProvider.

Definition at line 445 of file yaml_file_provider.cpp.

◆ preload_and_validate()

bool porytiles::YamlFileProvider::preload_and_validate ( ConfigScopeType  type,
const std::string &  scope 
) const

Eagerly loads all YAML config files and validates them for unknown keys.

Forces loading and validation of all YAML config files in the priority chain for the given scope. If any files contain unknown configuration keys, errors are emitted via the diagnostics interface and this method returns true to indicate the caller should terminate.

Parameters
typeThe configuration scope type
scopeThe scope name (e.g., tileset name)
Returns
true if unknown keys were found (caller should terminate), false otherwise.

Definition at line 44 of file yaml_file_provider.cpp.

◆ primary_pairing_mode()

LayerValue< PrimaryPairingMode > porytiles::YamlFileProvider::primary_pairing_mode ( ConfigScopeType  type,
const std::string &  scope 
) const
overridevirtual

Reimplemented from porytiles::ConfigProvider.

Definition at line 495 of file yaml_file_provider.cpp.

◆ primary_pairing_partners()

LayerValue< std::vector< std::string > > porytiles::YamlFileProvider::primary_pairing_partners ( ConfigScopeType  type,
const std::string &  scope 
) const
overridevirtual

Reimplemented from porytiles::ConfigProvider.

Definition at line 513 of file yaml_file_provider.cpp.

◆ role_pins()

LayerValue< RolePinDefinitions > porytiles::YamlFileProvider::role_pins ( ConfigScopeType  type,
const std::string &  scope 
) const
overridevirtual

Reimplemented from porytiles::ConfigProvider.

Definition at line 746 of file yaml_file_provider.cpp.

◆ tile_sharing_alignment()

LayerValue< TileSharingAlignment > porytiles::YamlFileProvider::tile_sharing_alignment ( ConfigScopeType  type,
const std::string &  scope 
) const
overridevirtual

Reimplemented from porytiles::ConfigProvider.

Definition at line 339 of file yaml_file_provider.cpp.

◆ tile_sharing_packing()

LayerValue< TileSharingPacking > porytiles::YamlFileProvider::tile_sharing_packing ( ConfigScopeType  type,
const std::string &  scope 
) const
overridevirtual

Reimplemented from porytiles::ConfigProvider.

Definition at line 321 of file yaml_file_provider.cpp.

◆ tiles_edit_mode()

LayerValue< ArtifactEditMode > porytiles::YamlFileProvider::tiles_edit_mode ( ConfigScopeType  type,
const std::string &  scope 
) const
overridevirtual

Reimplemented from porytiles::ConfigProvider.

Definition at line 217 of file yaml_file_provider.cpp.

◆ tiles_palette_mode()

LayerValue< TilesPaletteMode > porytiles::YamlFileProvider::tiles_palette_mode ( ConfigScopeType  type,
const std::string &  scope 
) const
overridevirtual

Reimplemented from porytiles::ConfigProvider.

Definition at line 356 of file yaml_file_provider.cpp.

◆ tileset_animations_wire_anim_code()

LayerValue< bool > porytiles::YamlFileProvider::tileset_animations_wire_anim_code ( ConfigScopeType  type,
const std::string &  scope 
) const
overridevirtual

Reimplemented from porytiles::ConfigProvider.

Definition at line 764 of file yaml_file_provider.cpp.

◆ tileset_paths_primary_bin()

LayerValue< std::string > porytiles::YamlFileProvider::tileset_paths_primary_bin ( ConfigScopeType  type,
const std::string &  scope 
) const
overridevirtual

Reimplemented from porytiles::ConfigProvider.

Definition at line 621 of file yaml_file_provider.cpp.

◆ tileset_paths_primary_src()

LayerValue< std::string > porytiles::YamlFileProvider::tileset_paths_primary_src ( ConfigScopeType  type,
const std::string &  scope 
) const
overridevirtual

Reimplemented from porytiles::ConfigProvider.

Definition at line 603 of file yaml_file_provider.cpp.

◆ tileset_paths_secondary_bin()

LayerValue< std::string > porytiles::YamlFileProvider::tileset_paths_secondary_bin ( ConfigScopeType  type,
const std::string &  scope 
) const
overridevirtual

Reimplemented from porytiles::ConfigProvider.

Definition at line 657 of file yaml_file_provider.cpp.

◆ tileset_paths_secondary_src()

LayerValue< std::string > porytiles::YamlFileProvider::tileset_paths_secondary_src ( ConfigScopeType  type,
const std::string &  scope 
) const
overridevirtual

Reimplemented from porytiles::ConfigProvider.

Definition at line 639 of file yaml_file_provider.cpp.

◆ verify_checksums()

LayerValue< bool > porytiles::YamlFileProvider::verify_checksums ( ConfigScopeType  type,
const std::string &  scope 
) const
overridevirtual

Reimplemented from porytiles::ConfigProvider.

Definition at line 478 of file yaml_file_provider.cpp.


The documentation for this class was generated from the following files: