Porytiles
Loading...
Searching...
No Matches
porytiles::MetatileAttributeSchemaResolver Class Reference

Resolves the invocation's metatile attribute schema: fetch config, scan, infer, reconcile. More...

#include <metatile_attribute_schema_resolver.hpp>

Public Member Functions

 MetatileAttributeSchemaResolver (std::filesystem::path project_root, gsl::not_null< const InfraConfig * > config, gsl::not_null< const TextFormatter * > format, gsl::not_null< const UserDiagnostics * > diag)
 
ChainableResult< LoadedMetatileAttributeSchemaresolve (const std::string &tileset_name) const
 Resolves the metatile attribute schema for the invocation.
 

Detailed Description

Resolves the invocation's metatile attribute schema: fetch config, scan, infer, reconcile.

This is a thin infra-layer orchestrator over four pieces, in order:

  1. Fetch the five attribute config values (fields, overrides, layer mask, size, declaration size) from the layered config. These are pure user inputs: the CLI, YAML, and defaults chain never derives a value, so an unset override knob arrives here as nullopt meaning exactly "the user did not pin this".
  2. Scan the project's fieldmap sources for raw facts (MetatileAttributeScanner).
  3. Run the pure domain inference over the facts (infer_metatile_attribute_candidates). It runs on whatever the scan gathered, including nothing at all, which is what lets a fieldmap file that exists but could not be read be reported as unreadable rather than as a project that declares no masks.
  4. Reconcile the inference with the user inputs (reconcile_metatile_attribute_schema), which decides the width, the field set, the layer mask, and the declaration width, and reports how.

Each step emits its own non-fatal diagnostics directly. The scan emits under the "metatile-attribute-inference" tag, and the reconciler under "metatile-attribute-schema". Inference itself emits nothing: facts it cannot settle travel as conflict records on the candidate sets, and the reconciler turns each one fatal unless an override speaks to it. Its one advisory output, the list of METATILE_ATTR_ prefixed defines whose spelling it has no rule for, is warned about here between steps 3 and 4, under the scan's tag and before any reconciliation error can end the run. Emitting at the point of detection means anything decided before a later fatal still reaches the user. The caller supplies the filtered sink, so the non-fatal diagnostics respect the user's diagnostic include/exclude patterns.

Definition at line 39 of file metatile_attribute_schema_resolver.hpp.

Constructor & Destructor Documentation

◆ MetatileAttributeSchemaResolver()

porytiles::MetatileAttributeSchemaResolver::MetatileAttributeSchemaResolver ( std::filesystem::path  project_root,
gsl::not_null< const InfraConfig * >  config,
gsl::not_null< const TextFormatter * >  format,
gsl::not_null< const UserDiagnostics * >  diag 
)

Definition at line 13 of file metatile_attribute_schema_resolver.cpp.

Member Function Documentation

◆ resolve()

ChainableResult< LoadedMetatileAttributeSchema > porytiles::MetatileAttributeSchemaResolver::resolve ( const std::string &  tileset_name) const

Resolves the metatile attribute schema for the invocation.

The result is invocation-global: the attribute layout is one-per-project, so every tileset a command touches shares the schema resolved here. The tileset name parameter is the YAML config scope key (a per-tileset config.yaml can technically answer the fieldmap keys; the values are documented as project-level).

Parameters
tileset_nameThe command's target tileset, used as the config scope.
Returns
The resolved schema, or a hard error (dual-layout ambiguity, selection failure, or invalid fields).

Definition at line 23 of file metatile_attribute_schema_resolver.cpp.


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