TGUI  0.7.8

Default implementation for theme loading. More...

#include <TGUI/Loading/ThemeLoader.hpp>

Inheritance diagram for tgui::DefaultThemeLoader:
tgui::BaseThemeLoader

Public Member Functions

std::string load (const std::string &filename, const std::string &className, PropertyValuePairs &properties) override
 Load the property-value pairs from the theme file. More...
 
- Public Member Functions inherited from tgui::BaseThemeLoader
virtual ~BaseThemeLoader ()=default
 Virtual destructor.
 

Static Public Member Functions

static void flushCache (const std::string &filename="")
 Empty the caches and force files to be reloaded. More...
 

Protected Member Functions

virtual void readFile (const std::string &filename, std::stringstream &contents) const
 Reads and return the contents of the entire file. More...
 

Detailed Description

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.

Member Function Documentation

◆ flushCache()

static void tgui::DefaultThemeLoader::flushCache ( const std::string &  filename = "")
static

Empty the caches and force files to be reloaded.

Parameters
filenameFile to remove from cache. If no filename is given, the entire cache is cleared.

◆ load()

std::string tgui::DefaultThemeLoader::load ( const std::string &  filename,
const std::string &  className,
PropertyValuePairs &  properties 
)
overridevirtual

Load the property-value pairs from the theme file.

Parameters
filenameFilename of the theme file
classNameName of the class inside the theme file (equals widget type when no class is given)
propertiesEmpty map op property-value pairs that will be filled by this function
Returns
Type of the widget
Exceptions
Exceptionwhen finding syntax errors in the file
Exceptionwhen file did not contain requested class name

Implements tgui::BaseThemeLoader.

◆ readFile()

virtual void tgui::DefaultThemeLoader::readFile ( const std::string &  filename,
std::stringstream &  contents 
) const
protectedvirtual

Reads and return the contents of the entire file.

Parameters
filenameFilename of the file to read
contentsReference to a stringstream that should be filled with the contents of the file by this function

The documentation for this class was generated from the following file: