Porytiles
Loading...
Searching...
No Matches
config_scope_type.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <optional>
4#include <string>
5
6namespace porytiles {
7
20enum class ConfigScopeType {
28 tileset,
29
39 layout
40};
41
54[[nodiscard]] inline std::string to_string(ConfigScopeType type)
55{
56 switch (type) {
58 return "tileset";
60 return "layout";
61 }
62 // Should never reach here with valid enum value
63 return "unknown";
64}
65
79[[nodiscard]] inline std::optional<ConfigScopeType> from_string(const std::string &str)
80{
81 if (str == "tileset") {
83 }
84 if (str == "layout") {
86 }
87 return std::nullopt;
88}
89
90} // namespace porytiles
std::optional< ConfigScopeType > from_string(const std::string &str)
Parses a string into a ConfigScopeType enum value.
ConfigScopeType
Specifies the scope type for configuration value lookups.
@ tileset
Configuration scoped to a specific tileset.
@ layout
Configuration scoped to a specific layout.
std::string to_string(const PrimaryPairingMode m)
Converts a PrimaryPairingMode to its canonical string representation.