|
| Setting (const std::string &name, const T &value, const std::string &doc_string) |
| Creates a new setting with the passed name, initial value, and documentation string. More...
|
|
| Setting (const SettingGroup *group, const std::string &name, const T &value, const std::string &doc_string) |
| Same as above, but places the setting in the passed group. More...
|
|
| Setting (const std::string &name, const T &value) |
| Convenience constructor that does not require a documentation string. More...
|
|
| Setting (const SettingGroup *group, const std::string &name, const T &value) |
| Same as above, but places the setting in the passed group. More...
|
|
| ~Setting () override |
|
const std::string | ToString () const override |
| Returns a string version of this setting. More...
|
|
bool | FromString (const std::string &str) override |
| Parses the passed string to set the value of this and returns whether the parsing was successful. More...
|
|
T * | GetMutableValue () |
| Direct value mutators. More...
|
|
const T & | GetValue () const |
|
void | SetValue (const T &value) |
|
| operator T () const |
|
void | operator= (const T &value) |
|
bool | operator== (const T &value) const |
| Equality testers. More...
|
|
const std::string & | GetName () const |
| Returns the name associated with this. More...
|
|
const std::string & | GetDocString () const |
| Returns the documentation string associated with this. More...
|
|
void | SetTypeDescriptor (const std::string &desc) |
| Sets/returns a string containing information about the Setting's type. More...
|
|
const std::string & | GetTypeDescriptor () const |
|
void | RegisterListener (const std::string &key, const Listener &listener) |
| Adds a function that will be called when this setting's value changes. More...
|
|
void | EnableListener (const std::string &key, bool enable) |
| Enables or disables the listener identified by key, if one exists. More...
|
|
void | UnregisterListener (const std::string &key) |
| Removes the listener identified by key, if one exists. More...
|
|
void | NotifyListeners () |
| Notify listeners that this setting has changed. More...
|
|
template<typename T>
class ion::base::Setting< T >
Forward references.
A Setting holds a value of type T, and supports listeners that are notified when the setting's value changes.
The only restrictions on T are that it must have a default constructor and support the insertion and extraction operators (<< and >>). POD types, strings, and most STL containers are supported through Ion's StringToValue and ValueToString serialization routines.
Every setting creates an entry in the global SettingManager, from which they can be retrieved and modified. This is particularly useful for editing them at runtime, for example through a configuration file, scripting interface, or remote tweak interface. A setting might, for example, control what rendering algorithm to use based on the local CPU or GPU speed, or selectively enable or disable certain features for testing or localization.
Definition at line 138 of file setting.h.