Loading...
Searching...
No Matches
Manifest.h
Go to the documentation of this file.
1//
2// Created by Dave Smith on 10/3/25.
3//
4
5#ifndef MANIFEST_H
6#define MANIFEST_H
7
8#include <unordered_map>
9#include <string>
10#include <type_traits>
12
13namespace ml
14{
81 {
82 public:
93 template<typename Asset>
94 static const std::string& getFilepath(const Asset& asset);
95
109 template<typename ConfigType, typename ValueType>
110 static const ValueType& getConfig(ConfigType config);
111
112 protected:
123 template<typename EnumType>
124 static void set(EnumType key, const char* filepath);
125
137 template<typename EnumType>
138 static void set(EnumType key, std::string value);
139
152 template<typename EnumType, typename ValueType>
153 static std::enable_if_t<
154 !std::is_same_v<std::decay_t<ValueType>, const char*> &&
155 !std::is_same_v<std::decay_t<ValueType>, std::string>
156 >
157 set(EnumType key, ValueType&& value);
158
174 template<typename E, typename V, typename... Args>
175 static void set(E key, V&& value, Args&&... args);
176
177 private:
178 template<typename Asset>
179 static std::unordered_map<Asset, std::string, EnumClassHash>& getFilePaths();
180
181 template<typename ConfigType, typename ValueType>
182 static auto& getConfigs();
183 };
184
185} // namespace ml
186
187#include "../../../src/Manifests/Manifest.tpp"
188#endif // MANIFEST_H
Base class for all Malena manifests.
Definition Manifest.h:81
static std::enable_if_t< !std::is_same_v< std::decay_t< ValueType >, const char * > &&!std::is_same_v< std::decay_t< ValueType >, std::string > > set(EnumType key, ValueType &&value)
Register a typed configuration value (int, float, bool, etc.).
static const ValueType & getConfig(ConfigType config)
Retrieve a typed configuration value by enum key.
static void set(EnumType key, std::string value)
Register a string configuration value.
static const std::string & getFilepath(const Asset &asset)
Retrieve the file path registered for an asset enum value.
static void set(E key, V &&value, Args &&... args)
Register multiple key-value pairs in one call.
static void set(EnumType key, const char *filepath)
Register an asset file path.
Definition Component.h:18