25#ifndef TGUI_THEME_LOADER_HPP
26#define TGUI_THEME_LOADER_HPP
28#include <TGUI/String.hpp>
29#include <TGUI/Loading/DataIO.hpp>
31#if !TGUI_EXPERIMENTAL_USE_STD_MODULE
41TGUI_MODULE_EXPORT
namespace tgui
83 TGUI_NODISCARD
virtual const std::map<String, String>&
load(
const String& primary,
const String& secondary) = 0;
103 void injectThemePath(
const std::unique_ptr<DataIO::Node>& node,
const String& path)
const;
108 void resolveReferences(std::map<
String, std::reference_wrapper<
const std::unique_ptr<DataIO::Node>>>& sections,
109 const std::map<String, String>& globalProperties,
110 const std::unique_ptr<DataIO::Node>& node)
const;
156 TGUI_NODISCARD
const std::map<String, String>&
load(
const String& filename,
const String& section)
override;
189 TGUI_NODISCARD
virtual std::unique_ptr<DataIO::Node>
readFile(
const String& filename)
const;
193 static std::map<String, std::map<String, std::map<String, String>>> m_propertiesCache;
194 static std::map<String, std::map<String, String>> m_globalPropertiesCache;
Base class for theme loader implementations.
Definition ThemeLoader.hpp:47
virtual bool canLoad(const String &primary, const String &secondary)=0
Check if the requested property-value pairs are available.
virtual void preload(const String &primary)
Optionally already do some work when only the primary parameter is known yet.
virtual std::map< String, String > getGlobalProperties(const String &primary)
Loads the global property-value pairs from the theme.
virtual const std::map< String, String > & load(const String &primary, const String &secondary)=0
Loads the property-value pairs from the theme.
virtual ~BaseThemeLoader()=default
Virtual destructor.
Default implementation for theme loading.
Definition ThemeLoader.hpp:124
static void flushCache(const String &filename="")
Empties the caches and force files to be reloaded.
bool canLoad(const String &filename, const String §ion) override
Check if the requested property-value pairs are available.
std::map< String, String > getGlobalProperties(const String &filename) override
Loads the global property-value pairs from the theme.
const std::map< String, String > & load(const String &filename, const String §ion) override
Loads the property-value pairs from the theme file.
virtual std::unique_ptr< DataIO::Node > readFile(const String &filename) const
Reads and return the contents of the entire file.
void preload(const String &filename) override
Loads the theme file in cache.
Wrapper class to store strings.
Definition String.hpp:96
Namespace that contains all TGUI functions and classes.
Definition AbsoluteOrRelativeValue.hpp:38