TGUI
1.5
|
Default implementation for theme loading. More...
#include <TGUI/Loading/ThemeLoader.hpp>
Public Member Functions | |
void | preload (const String &filename) override |
Loads the theme file in cache. | |
TGUI_NODISCARD std::map< String, String > | getGlobalProperties (const String &filename) override |
Loads the global property-value pairs from the theme. | |
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 bool | canLoad (const String &filename, const String §ion) override |
Check if the requested property-value pairs are available. | |
Public Member Functions inherited from tgui::BaseThemeLoader | |
virtual | ~BaseThemeLoader ()=default |
Virtual destructor. | |
Static Public Member Functions | |
static void | flushCache (const String &filename="") |
Empties the caches and force files to be reloaded. | |
Protected Member Functions | |
virtual TGUI_NODISCARD std::unique_ptr< DataIO::Node > | readFile (const String &filename) const |
Reads and return the contents of the entire file. | |
Protected Member Functions inherited from tgui::BaseThemeLoader | |
void | injectThemePath (const std::unique_ptr< DataIO::Node > &node, const String &path) const |
void | resolveReferences (std::map< String, std::reference_wrapper< const std::unique_ptr< DataIO::Node > > > §ions, const std::map< String, String > &globalProperties, const std::unique_ptr< DataIO::Node > &node) const |
Static Protected Attributes | |
static std::map< String, std::map< String, std::map< String, String > > > | m_propertiesCache |
static std::map< String, std::map< String, String > > | m_globalPropertiesCache |
Default implementation for theme loading.
Themes are stored on disk in files which contain sections with a syntax similar to CSS. This loader will be able to extract the data from these files.
On first access, the entire file will be cached, the next times the cached map is simply returned.
|
overridevirtual |
Check if the requested property-value pairs are available.
filename | Filename of the theme file |
section | Name of the section inside the theme file |
Implements tgui::BaseThemeLoader.
|
static |
Empties the caches and force files to be reloaded.
filename | File to remove from cache. If no filename is given, the entire cache is cleared. |
The first time a filename is loaded, its contents is fully cached. If this function isn't called then loading the same file will only read the cache instead of reading the file from disk again.
|
overridevirtual |
Loads the global property-value pairs from the theme.
filename | Filename of the theme file to load |
Reimplemented from tgui::BaseThemeLoader.
|
overridevirtual |
Loads the property-value pairs from the theme file.
filename | Filename of the theme file |
section | Name of the section inside the theme file |
Exception | when finding syntax errors in the file |
Exception | when file did not contain requested class name |
Implements tgui::BaseThemeLoader.
|
overridevirtual |
Loads the theme file in cache.
filename | Filename of the theme file to load |
Exception | when finding syntax errors in the file |
Reimplemented from tgui::BaseThemeLoader.
|
protectedvirtual |
Reads and return the contents of the entire file.
filename | Filename of the file to read |