25#ifndef TGUI_THEME_LOADER_HPP
26#define TGUI_THEME_LOADER_HPP
28#include <TGUI/String.hpp>
29#include <TGUI/Loading/DataIO.hpp>
81 TGUI_NODISCARD
virtual const std::map<String, String>&
load(
const String& primary,
const String& secondary) = 0;
101 void injectThemePath(
const std::unique_ptr<DataIO::Node>& node,
const String& path)
const;
106 void resolveReferences(std::map<
String, std::reference_wrapper<
const std::unique_ptr<DataIO::Node>>>& sections,
107 const std::map<String, String>& globalProperties,
108 const std::unique_ptr<DataIO::Node>& node)
const;
154 TGUI_NODISCARD
const std::map<String, String>&
load(
const String& filename,
const String& section)
override;
187 TGUI_NODISCARD
virtual std::unique_ptr<DataIO::Node>
readFile(
const String& filename)
const;
191 static std::map<String, std::map<String, std::map<String, String>>> m_propertiesCache;
192 static std::map<String, std::map<String, String>> m_globalPropertiesCache;
Base class for theme loader implementations.
Definition ThemeLoader.hpp:45
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:122
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:94
Namespace that contains all TGUI functions and classes.
Definition AbsoluteOrRelativeValue.hpp:36