26#ifndef TGUI_THEME_LOADER_HPP
27#define TGUI_THEME_LOADER_HPP
30#include <TGUI/String.hpp>
31#include <TGUI/Loading/DataIO.hpp>
33#if !TGUI_EXPERIMENTAL_USE_STD_MODULE
43TGUI_MODULE_EXPORT
namespace tgui
88 TGUI_NODISCARD
virtual const std::map<String, String>&
load(
const String& primary,
const String& secondary) = 0;
111 void injectThemePath(
const std::unique_ptr<DataIO::Node>& node,
const String& path)
const;
117 void resolveReferences(std::map<
String, std::reference_wrapper<
const std::unique_ptr<DataIO::Node>>>& sections,
118 const std::map<String, String>& globalProperties,
119 const std::unique_ptr<DataIO::Node>& node)
const;
169 TGUI_NODISCARD
const std::map<String, String>&
load(
const String& filename,
const String& section)
override;
205 TGUI_NODISCARD
virtual std::unique_ptr<DataIO::Node>
readFile(
const String& filename)
const;
210 static std::map<String, std::map<String, std::map<String, String>>> m_propertiesCache;
211 static std::map<String, std::map<String, String>> m_globalPropertiesCache;
Base class for theme loader implementations.
Definition ThemeLoader.hpp:49
virtual TGUI_NODISCARD const std::map< String, String > & load(const String &primary, const String &secondary)=0
Loads the property-value pairs from the theme.
virtual void preload(const String &primary)
Optionally already do some work when only the primary parameter is known yet.
virtual TGUI_NODISCARD bool canLoad(const String &primary, const String &secondary)=0
Check if the requested property-value pairs are available.
virtual ~BaseThemeLoader()=default
Virtual destructor.
virtual TGUI_NODISCARD std::map< String, String > getGlobalProperties(const String &primary)
Loads the global property-value pairs from the theme.
Default implementation for theme loading.
Definition ThemeLoader.hpp:135
static void flushCache(const String &filename="")
Empties the caches and force files to be reloaded.
TGUI_NODISCARD const std::map< String, String > & load(const String &filename, const String §ion) override
Loads the property-value pairs from the theme file.
TGUI_NODISCARD std::map< String, String > getGlobalProperties(const String &filename) override
Loads the global property-value pairs from the theme.
virtual TGUI_NODISCARD std::unique_ptr< DataIO::Node > readFile(const String &filename) const
Reads and return the contents of the entire file.
TGUI_NODISCARD bool canLoad(const String &filename, const String §ion) override
Check if the requested property-value pairs are available.
void preload(const String &filename) override
Loads the theme file in cache.
Wrapper class to store strings.
Definition String.hpp:101
Namespace that contains all TGUI functions and classes.
Definition AbsoluteOrRelativeValue.hpp:39