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 <optional>
7
8#include "gsl/pointers"
9
18
19namespace porytiles {
20
46 public:
61 gsl::not_null<const TextFormatter *> format,
62 gsl::not_null<const BehaviorMapProvider *> behavior_map,
63 std::optional<BaseGame> base_game = std::nullopt,
64 const TerrainTypeMapProvider *terrain_map = nullptr,
65 const EncounterTypeMapProvider *encounter_map = nullptr)
66 : format_{format}, behavior_map_{behavior_map}, base_game_{base_game}, terrain_map_{terrain_map},
67 encounter_map_{encounter_map}, file_printer_{std::make_unique<FileHighlightPrinter>(format)}
68 {
69 }
70
85 load(const std::filesystem::path &path) const;
86
87 private:
88 const TextFormatter *format_;
89 const BehaviorMapProvider *behavior_map_;
90 std::optional<BaseGame> base_game_;
91 const TerrainTypeMapProvider *terrain_map_;
92 const EncounterTypeMapProvider *encounter_map_;
93 const std::unique_ptr<FileHighlightPrinter> file_printer_;
94};
95
96} // namespace porytiles
A service that loads metatile attributes from a CSV file.
AttributesCsvLoader(gsl::not_null< const TextFormatter * > format, gsl::not_null< const BehaviorMapProvider * > behavior_map, std::optional< BaseGame > base_game=std::nullopt, const TerrainTypeMapProvider *terrain_map=nullptr, const EncounterTypeMapProvider *encounter_map=nullptr)
Constructs an AttributesCsvLoader with required dependencies.
ChainableResult< std::map< std::size_t, MetatileAttribute > > load(const std::filesystem::path &path) const
Loads metatile attributes from a CSV file.
Abstract interface for providing two-way metatile behavior mappings.
A result type that maintains a chainable sequence of errors for debugging and error reporting.
Abstract interface for providing two-way metatile encounter type mappings.
A service for printing file lines with highlighted lines and line numbers.
Abstract interface for providing two-way metatile terrain type mappings.
Abstract base class for applying text styling with context-aware formatting.