Property management class using CYIString names and values.
This class will allow easy storage and retrieval of name/value properties via a properties file. If any changes are made to this file, it will automatically reload the configuration and signal any clients that the configuration has changed.
#include <utility/YiPreferences.h>

Public Attributes | |
| CYISignal< CYIPreferences > | PropFileChanged |
| CYISignal< CYIPreferences > | PropFileCreated |
| CYISignal< CYIPreferences > | PropFileDeleted |
| CYIPreferences::CYIPreferences | ( | ) |
Default constructor.
| CYIPreferences::CYIPreferences | ( | const CYIString & | path, |
| bool | bWatchFile = false |
||
| ) |
Constructor taking the path to the settings file. Set the bWatchFile to true if you want the preferences file to be watched. Passing nullptr as a value for path results in an empty preferences object.
| CYIPreferences::CYIPreferences | ( | const CYIPreferences & | prefs | ) |
Copy constructor. Any watched configuration files will not be copied.
|
virtual |
Destructor.
| void CYIPreferences::Clear | ( | ) |
Removes all values from the preferences object.
Returns the corresponding value for the specified name. Returns an empty string object if the property name could not be found. If a pointer is provided for pFound, it will be set to true if the property name is found.
| std::vector<CYIString> CYIPreferences::GetNames | ( | ) | const |
Return the names used for each property
|
inline |
Returns the properites file path being used.
| bool CYIPreferences::IsWatchingFile | ( | ) | const |
Returns whether we have a file to monitor or not, which will be if bWatchFile was true when constructed, and there is a file path set.
|
finalvirtual |
Loads the preferences file. Returns false if the properties file could not be accessed.
| CYIPreferences& CYIPreferences::operator= | ( | const CYIPreferences & | rhs | ) |
Assignment operator which consumes the supplied preferences object. Signal objects are not copied.
|
virtual |
Saves the current property name/value configuration using the current path, or using the new path if specified. Returns false if the properties file could not be saved.
Sets a property name with the corresponding value.
|
inline |
Sets the current properties configuration path.
| void CYIPreferences::UpdateFileMonitor | ( | ) |
This method must be called by the main loop in your application, if you want file monitoring for the preferences file.
| CYISignal<CYIPreferences> CYIPreferences::PropFileChanged |
This signal is emitted when the properties file has been modfied.
| CYISignal<CYIPreferences> CYIPreferences::PropFileCreated |
This signal is emitted when the properties file has been created.
| CYISignal<CYIPreferences> CYIPreferences::PropFileDeleted |
This signal is emitted when the properties file has been deleted.