Porytiles
Loading...
Searching...
No Matches
attributes_csv_loader.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <filesystem>
4#include <map>
5#include <memory>
6#include <string>
7
8#include "gsl/pointers"
9
18
19namespace porytiles {
20
30 std::map<std::size_t, MetatileAttribute> attributes;
31 std::map<FieldRole, bool> active_pin_column_present;
32};
33
52 public:
59 gsl::not_null<const TextFormatter *> format,
60 gsl::not_null<const InfraConfig *> config,
61 gsl::not_null<const UserDiagnostics *> diag)
62 : format_{format}, config_{config}, diag_{diag}, file_printer_{std::make_unique<FileHighlightPrinter>(format)}
63 {
64 }
65
85 const std::filesystem::path &path,
86 const Schema &schema,
87 const ProviderMap &providers,
88 const std::string &tileset_name) const;
89
90 private:
91 const TextFormatter *format_;
92 const InfraConfig *config_;
93 const UserDiagnostics *diag_;
94 const std::unique_ptr<FileHighlightPrinter> file_printer_;
95};
96
97} // namespace porytiles
A service that loads metatile attributes from a CSV file.
AttributesCsvLoader(gsl::not_null< const TextFormatter * > format, gsl::not_null< const InfraConfig * > config, gsl::not_null< const UserDiagnostics * > diag)
Constructs an AttributesCsvLoader with required dependencies.
ChainableResult< AttributesCsvLoadResult > load(const std::filesystem::path &path, const Schema &schema, const ProviderMap &providers, const std::string &tileset_name) const
Loads metatile attributes from a CSV file.
A result type that maintains a chainable sequence of errors for debugging and error reporting.
A service for printing file lines with highlighted lines and line numbers.
Interface that defines a complete infra layer configuration.
A validated metatile attribute layout: an ordered set of non-overlapping fields.
Abstract base class for applying text styling with context-aware formatting.
Abstract class for structured error reporting and diagnostic output.
std::map< std::string, std::unique_ptr< EnumMapProvider >, std::less<> > ProviderMap
Maps schema field names to the provider that names that field's values.
The result of loading an attributes CSV: the per-metatile attributes plus the per-role pin-column.
std::map< FieldRole, bool > active_pin_column_present
std::map< std::size_t, MetatileAttribute > attributes