Interface for all configuration classes. More...
#include <Config.h>
Public Member Functions | |
bool | Read (const tstring &key, tstring &result) const |
Basic read function. | |
template<typename T > | |
bool | Read (const tstring &key, T &result) const |
Extendable version of Read. More... | |
virtual bool | Remove (const tstring &key) |
Remove a single value. | |
virtual bool | RemoveEntireConfig () |
Removes all values in the config, but the config can still used afterwards. | |
void | RestoreWindowPosition (const tstring &key, HWND window) |
Convenience function for window position. | |
void | SaveWindowPosition (const tstring &key, HWND window) |
Convenience function for window position. | |
bool | Write (const tstring &key, const tstring &value) |
Basic write function. | |
template<typename T > | |
bool | Write (const tstring &key, const T &value) |
Extendable version of Write. More... | |
Protected Member Functions | |
virtual bool | _GetStringImp (const tstring &key, tstring &result) const =0 |
Every config value is internally saved as a string. | |
virtual bool | _SetStringImp (const tstring &key, const tstring &value)=0 |
Every config value is internally saved as a string. | |
Static Protected Member Functions | |
static tstring | FromUtf8 (const std::string &text) |
All config should be saved as UTF-8 for portability. | |
static std::string | ToUtf8 (const tstring &text) |
All config should be saved as UTF-8 for portability. | |
Interface for all configuration classes.
Some convenience methods are provided for the most common types. If a new data type should be saved, convert it to string. The convenience methods use this approach as well.
|
inline |
Extendable version of Read.
This function is templated make it possible to support any type. To do that, declare the following function:
Then the custom type can be read as if the config natively supported it:
|
inline |
Extendable version of Write.
This function is templated make it possible to support any type. To do that, declare the following function:
Then the custom type can be written as if the config natively supported it: