Porytiles
Loading...
Searching...
No Matches
metatiles_header_provider.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <cstddef>
4#include <filesystem>
5#include <optional>
6#include <string>
7
8#include "gsl/pointers"
9
13
14namespace porytiles {
15
30 public:
37 explicit MetatilesHeaderProvider(std::filesystem::path project_root, gsl::not_null<const TextFormatter *> format)
38 : project_root_{std::move(project_root)}, format_{format}
39 {
40 }
41
42 [[nodiscard]] std::string name() const override;
43
44 [[nodiscard]] LayerValue<std::size_t>
45 metatile_attr_size(ConfigScopeType type, const std::string &scope) const override;
46
47 private:
48 std::filesystem::path project_root_;
49 const TextFormatter *format_;
50 mutable std::optional<LayerValue<std::size_t>> cached_result_;
51};
52
53} // namespace porytiles
An interface which config implementations can use to load config values.
A ConfigProvider that auto-detects metatile attribute size from metatiles.h declarations.
MetatilesHeaderProvider(std::filesystem::path project_root, gsl::not_null< const TextFormatter * > format)
Constructs a MetatilesHeaderProvider.
LayerValue< std::size_t > metatile_attr_size(ConfigScopeType type, const std::string &scope) const override
std::string name() const override
Gets the name of this ConfigProvider, useful for diagnostic purposes.
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...