|
HikoGUI
A low latency retained GUI
|
#include <ttauri/preferences.hpp>
Public Member Functions | |
| preferences (URL location) noexcept | |
| preferences (preferences const &)=delete | |
| preferences (preferences &&)=delete | |
| preferences & | operator= (preferences const &)=delete |
| preferences & | operator= (preferences &&)=delete |
| virtual void | reset () noexcept |
| Reset data members to their default value. | |
| void | save () const noexcept |
| Save the preferences. | |
| void | load () noexcept |
| Load the preferences. | |
| virtual datum | serialize () const noexcept |
| Serialize the preferences data. | |
| virtual void | deserialize (datum const &data) noexcept |
| Deserialize the preferences. | |
Data Fields | |
| std::recursive_mutex | mutex |
user preferences.
User preferences are kept in an instance of the preferences subclass.
This class will automatically load preferences from the location given in its constructor and save the preferences when they are modified.
The saving if preferences is delayed to combine multiple modification into a single save. By locking the mutex external to the preferences multiple modifications can be stored atomically.
|
inlinevirtualnoexcept |
Deserialize the preferences.
The deserialize method is called when the preferences are loaded. A subclass should implement the deserialize() to read the data and rebuild its members. It should ignore any data it does not know about.
It is recommended to call super::deserialize() from subclass implementations.
|
noexcept |
Load the preferences.
|
inlinevirtualnoexcept |
Reset data members to their default value.
|
noexcept |
Save the preferences.
|
inlinevirtualnoexcept |
Serialize the preferences data.
The serialize method is called when the preferences need to be saved. A subclass should implement serialize() to serialize all the members of its class.
It is recommended to call super::serialize() from subclass implementations.