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
18enum class ConfigScopeType {
24 tileset,
25
33 layout
34};
35
46[[nodiscard]] inline std::string to_string(ConfigScopeType type)
47{
48 switch (type) {
50 return "tileset";
52 return "layout";
53 }
54 // Should never reach here with valid enum value
55 return "unknown";
56}
57
69[[nodiscard]] inline std::optional<ConfigScopeType> from_string(const std::string &str)
70{
71 if (str == "tileset") {
73 }
74 if (str == "layout") {
76 }
77 return std::nullopt;
78}
79
80} // 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.