Loading...
Searching...
No Matches
ml::Manifest Class Reference

Base class for all Malena manifests. More...

#include <Malena/Manifests/Manifest.h>

Inherited by ml::ButtonToggleManifest, ml::CarouselManifest, ml::CheckboxGroupManifest, ml::CheckboxManifest, ml::DraggableManifest, ml::ListItemManifest, ml::ListManifest, ml::MenuBarManifest, ml::PanelManifest, ml::PillToggleManifest, ml::RadioButtonManifest, ml::RadioGroupManifest, ml::ScrollPaneManifest, ml::SegmentToggleManifest, ml::SelectManifest, ml::SideMenuManifest, ml::SplitPanelManifest, ml::TabbedPanelManifest, ml::TextInputManifest, ml::TextInputManifest, ml::ToggleGroupManifest, and ml::ToolbarManifest.

Static Public Member Functions

template<typename ConfigType, typename ValueType>
static const ValueType & getConfig (ConfigType config)
template<typename Asset>
static const std::string & getFilepath (const Asset &asset)
template<typename EnumType>
static const ThemeTaggetTheme (EnumType key)
 Retrieve a theme stored via set(key, ThemeDerived{}).

Static Protected Member Functions

template<typename E, typename V, typename... Args>
static void set (E key, V &&value, Args &&... args)
 Register multiple key-value pairs in one call.
template<typename EnumType>
static void set (EnumType key, const char *filepath)
 Register an asset file path.
template<typename EnumType>
static void set (EnumType key, std::string value)
 Register a string configuration value.
template<typename EnumType, typename T>
static std::enable_if_t< std::is_base_of_v< ThemeTag, std::decay_t< T > > > set (EnumType key, T &&value)
 Register a Theme-derived value.
template<typename EnumType, typename ValueType>
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 > &&!std::is_base_of_v< ThemeTag, std::decay_t< ValueType > > > set (EnumType key, ValueType &&value)
 Register a typed configuration value (int, float, struct, etc.).

Detailed Description

Base class for all Malena manifests.

A manifest is a static registry that maps enum keys to file paths or configuration values. Subclasses declare inner enum types and populate them via the protected set() methods in an inline static initializer.

Theme-derived values are stored polymorphically as shared_ptr<ThemeTag> and retrieved by ThemeManager::apply() — no manual casting required.

Usage

class MyManifest : public ml::Manifest
{
public:
enum class Themes { Dark, Neon };
enum class Images { Background };
enum class Ints { MaxPlayers };
inline static const auto _ = [](){
set(Themes::Dark, ml::DarkTheme());
set(Images::Background, "assets/bg.png");
set(Ints::MaxPlayers, 4);
return 0;
}();
};
Base class for all Malena manifests.
Definition Manifest.h:51
static void set(EnumType key, const char *filepath)
Register an asset file path.
See also
ThemeManager, AssetsManager, ConfigManager

Definition at line 50 of file Manifest.h.

Member Function Documentation

◆ getConfig()

template<typename ConfigType, typename ValueType>
const ValueType & ml::Manifest::getConfig ( ConfigType config)
static

◆ getFilepath()

template<typename Asset>
const std::string & ml::Manifest::getFilepath ( const Asset & asset)
static

◆ getTheme()

template<typename EnumType>
const ThemeTag & ml::Manifest::getTheme ( EnumType key)
static

Retrieve a theme stored via set(key, ThemeDerived{}).

Called internally by ThemeManager::apply(). Returns a reference to the stored theme cast to ThemeTagThemeManager casts to Theme& from there.

◆ set() [1/5]

template<typename E, typename V, typename... Args>
void ml::Manifest::set ( E key,
V && value,
Args &&... args )
staticprotected

Register multiple key-value pairs in one call.

◆ set() [2/5]

template<typename EnumType>
void ml::Manifest::set ( EnumType key,
const char * filepath )
staticprotected

Register an asset file path.

◆ set() [3/5]

template<typename EnumType>
void ml::Manifest::set ( EnumType key,
std::string value )
staticprotected

Register a string configuration value.

◆ set() [4/5]

template<typename EnumType, typename T>
std::enable_if_t< std::is_base_of_v< ThemeTag, std::decay_t< T > > > ml::Manifest::set ( EnumType key,
T && value )
staticprotected

Register a Theme-derived value.

Stored as shared_ptr<ThemeTag> so Theme.h is not needed in Manifest.tpp. ThemeManager::apply() casts back to Theme&.

◆ set() [5/5]

template<typename EnumType, typename ValueType>
std::enable_if_t< !std::is_same_v< std::decay_t< ValueType >, const char * > &&!std::is_same_v< std::decay_t< ValueType >, std::string > &&!std::is_base_of_v< ThemeTag, std::decay_t< ValueType > > > ml::Manifest::set ( EnumType key,
ValueType && value )
staticprotected

Register a typed configuration value (int, float, struct, etc.).

Excludes const char*, std::string, and ThemeTag-derived types — those are handled by their own overloads.


The documentation for this class was generated from the following file: