20#ifndef ORES_UTILITY_GENERATION_GENERATION_ENVIRONMENT_HPP
21#define ORES_UTILITY_GENERATION_GENERATION_ENVIRONMENT_HPP
27#include <unordered_map>
29namespace ores::utility::generation {
39 using entries = std::unordered_map<std::string, std::string>;
50 std::shared_ptr<const generation_environment>
parent,
56 std::optional<std::string>
get(std::string_view key)
const;
61 std::string
get_or(std::string_view key,
62 const std::string& default_value)
const;
67 bool has(std::string_view key)
const;
72 std::shared_ptr<const generation_environment>
parent()
const {
77 std::shared_ptr<const generation_environment> parent_;
Scoped key-value store for generation context data.
Definition generation_environment.hpp:37
bool has(std::string_view key) const
Checks if a key exists in this environment or parents.
Definition generation_environment.cpp:51
std::optional< std::string > get(std::string_view key) const
Gets a value by key, searching parent chain.
Definition generation_environment.cpp:34
std::shared_ptr< const generation_environment > parent() const
Returns the parent environment, if any.
Definition generation_environment.hpp:72
std::string get_or(std::string_view key, const std::string &default_value) const
Gets a value by key, returning default if not found.
Definition generation_environment.cpp:45