26#ifndef TGUI_THEME_LOADER_HPP
27#define TGUI_THEME_LOADER_HPP
30#include <TGUI/Config.hpp>
31#include <SFML/System/String.hpp>
59 virtual void preload(
const std::string& primary);
72 virtual const std::map<sf::String, sf::String>&
load(
const std::string& primary,
const std::string& secondary) = 0;
85 virtual bool canLoad(
const std::string& primary,
const std::string& secondary) = 0;
111 void preload(
const std::string& filename)
override;
125 const std::map<sf::String, sf::String>&
load(
const std::string& filename,
const std::string& section)
override;
136 bool canLoad(
const std::string& filename,
const std::string& section)
override;
158 virtual void readFile(
const std::string& filename, std::stringstream& contents)
const;
163 static std::map<std::string, std::map<std::string, std::map<sf::String, sf::String>>> m_propertiesCache;
165 friend struct DefaultThemeLoaderTest;
Base class for theme loader implementations.
Definition: ThemeLoader.hpp:45
virtual void preload(const std::string &primary)
Optionally already do some work when only the primary parameter is known yet.
virtual const std::map< sf::String, sf::String > & load(const std::string &primary, const std::string &secondary)=0
Loads the property-value pairs from the theme.
virtual ~BaseThemeLoader()=default
Virtual destructor.
virtual bool canLoad(const std::string &primary, const std::string &secondary)=0
Check if the requested property-value pairs are available.
Default implementation for theme loading.
Definition: ThemeLoader.hpp:101
bool canLoad(const std::string &filename, const std::string §ion) override
Check if the requested property-value pairs are available.
void preload(const std::string &filename) override
Loads the theme file in cache.
static void flushCache(const std::string &filename="")
Empties the caches and force files to be reloaded.
virtual void readFile(const std::string &filename, std::stringstream &contents) const
Reads and return the contents of the entire file.
const std::map< sf::String, sf::String > & load(const std::string &filename, const std::string §ion) override
Loads the property-value pairs from the theme file.
Namespace that contains all TGUI functions and classes.
Definition: AbsoluteOrRelativeValue.hpp:37