An abstract class for other classes that manage groups of settings. More...
#include <objectsettings.h>
Public Types | |
typedef SettingFilesContainer::const_iterator | ConstSettingFilesIterator |
Const Iterator type for ObjectSettingGroup instances stored by this class. | |
typedef SettingGroupContainer::const_iterator | ConstSettingGroupIterator |
Const Iterator type for ObjectSettingGroup instances stored by this class. | |
typedef std::map< String, ObjectSettingFile * > | SettingFilesContainer |
Basic container type for ObjectSettingFile storage by this class. | |
typedef SettingFilesContainer::iterator | SettingFilesIterator |
Iterator type for ObjectSettingGroup instances stored by this class. | |
typedef std::map< String, ObjectSettingGroup * > | SettingGroupContainer |
Basic container type for ObjectSettingGroup storage by this class. | |
typedef SettingGroupContainer::iterator | SettingGroupIterator |
Iterator type for ObjectSettingGroup instances stored by this class. | |
typedef std::vector< ObjectSettingGroup * > | SettingGroupVector |
Convenience typedef for Load method returns. | |
Public Member Functions | |
ObjectSettingsHandler () | |
Class constructor. | |
virtual | ~ObjectSettingsHandler () |
Class destructor. | |
void | AddGroupToFile (ObjectSettingGroup *Group, const String &FileName) |
Assigns a SettingGroup to a file name that will be used when settings are saved. More... | |
void | ApplySettingGroup (const String &GroupName) |
Applies all the settings (and their values) defined in a setting group. More... | |
ObjectSettingFile * | CreateSettingFile (const String &FileName) |
Creates a new Setting file that will track which groups are a part of it. More... | |
ObjectSettingGroup * | CreateSettingGroup (const String &Name) |
Creates a new blank setting group that can have it's settings populated. More... | |
void | DestroyAllSettingFiles () |
Destroys all Setting files in this handler. More... | |
void | DestroyAllSettingGroups () |
Destroys all setting groups stored in this handler. | |
void | DestroySettingFile (const String &FileName) |
Destroys a Setting file by name. More... | |
void | DestroySettingFile (ObjectSettingFile *ToBeDestroyed) |
Destroys a Setting file. More... | |
void | DestroySettingGroup (const String &Name) |
Destroys a setting group by name. More... | |
void | DestroySettingGroup (ObjectSettingGroup *ToBeDestroyed) |
Destroys a setting group. More... | |
Boole | GetAutoGenFiles () const |
Gets whether or not this object is currently allowed to create/update settings files upon initialization and destruction. More... | |
Boole | GetAutoGenPath () const |
Gets whether or not this object is currently allowed to create folders when saving. More... | |
ConstString & | GetCurrentSettingsSaveFile () const |
Gets the name of the file the "Current" setting group is saved to. More... | |
ObjectSettingFile * | GetSettingFile (const String &FileName) |
Gets a Setting file by name. More... | |
ObjectSettingGroup * | GetSettingGroup (const String &Name) const |
Gets a setting group by name. More... | |
const String & | GetSettingsFilePath () const |
Gets the currently set settings file path. More... | |
CountedPtr< SettingGroupVector > | LoadSettings (const String &FileName, const String &Path) |
Loads settings from a settings file. More... | |
CountedPtr< SettingGroupVector > | LoadSettings (const String &FileName) |
Loads settings from a settings file using the specified settings path. More... | |
CountedPtr< SettingGroupVector > | LoadSettingsFromGroup (const String &FileName, const String &Group) |
Loads settings from a settings file. More... | |
CountedPtr< SettingGroupVector > | LoadSettingsFromXML (XML::Node &RootSettings) |
Loads settings from an xml node. More... | |
void | ProtoDeSerialize (const XML::Node &SelfRoot) |
Take the data stored in an XML Node and overwrite this object with it. More... | |
void | ProtoSerialize (XML::Node &SelfRoot) const |
Convert this class to an XML::Node ready for serialization. More... | |
void | RemoveGroupFromFile (ObjectSettingGroup *Group, const String &FileName) |
Removes a previously assigned group from a save file name. More... | |
void | SaveAllSettings () |
Saves all settings that need saving. More... | |
void | SaveSettingGroups (StringVector &GroupNames, const String &FileName, const String &Path) |
Saves all settings to a settings file. More... | |
void | SaveSettingGroups (StringVector &GroupNames, const String &FileName) |
Saves all settings to a settings file using the specified settings path. More... | |
void | SaveSettingsByFile (const String &FileName, const String &Path) |
Saves all settings that have their optional filename set to the specified file. More... | |
void | SaveSettingsByFile (const String &FileName) |
Saves all settings that have their optional filename set to the specified file. More... | |
void | SaveSettingsToXML (XML::Node &RootSettings, Boole SaveCurrent=true) |
Saves all the current setting groups as children of the provided XML node. More... | |
void | SaveSettingsToXML (StringVector &GroupNames, XML::Node &RootSettings) |
Saves the named settings groups as children of the provided XML node. More... | |
void | SetAutoGenFiles (Boole Enable) |
Enables or disables the automatic creation of settings files on initialization and destruction of this object. More... | |
void | SetAutoGenPath (Boole Enable) |
Enables or disables the automatic creation of a directory path when saving. More... | |
void | SetCurrentSettingsSaveFile (const String &FileName) |
Sets the name of the file that will have this object's "current" settings saved to. More... | |
void | SetSettingsFilePath (const String &Path) |
Sets the path to be assumed when saving/loading settings to files. More... | |
Static Public Member Functions | |
static String | GetSerializableName () |
Get the name of the the XML tag the class will leave behind as its instances are serialized. More... | |
Protected Member Functions | |
virtual void | AppendCurrentSettings (XML::Node &CurrentNode)=0 |
Takes all the current settings of this handler and serializes them to an XML::Node. More... | |
virtual void | ApplySettingGroupImpl (ObjectSettingGroup *Group)=0 |
Applies all the settings stored by a ObjectSettingGroup. More... | |
virtual String | GetObjectRootNodeName () const =0 |
Gets the name to be given to a Node with this handlers serialized data. More... | |
void | LoadSettingSetFromXML (XML::Node &XMLNode, ObjectSettingSet *Set) |
Populates an ObjectSettingSet with settings stored in XML. More... | |
CountedPtr< SettingGroupVector > | LoadSettingsFromFile (const String &FileName, const String &Path) |
Loads all ObjectSettingGroup instances serialized to a XML file into usable ObjectSettingGroup instances. More... | |
void | SaveSettingSetToXML (XML::Node &XMLNode, ObjectSettingSet *Set) |
Saves an ObjectSettingSet to an XML node. More... | |
void | SaveSettingsToFile (StringVector &GroupNames, const String &FileName, const String &Path) |
Saves a collection of ObjectSettingGroups stored by this handler to a file as XML. More... | |
Protected Attributes | |
Boole | AutoGenFiles |
Stores whether or not this handler will attempt to automatically generate a file if it doesn't exist. More... | |
Boole | AutoGenPath |
Stores whether or not this handler will attempt to automatically generate a path to a file if it doesn't exist. More... | |
String | CurrentSettingsSaveFile |
Stores the name of the file where the "Current" settings group will be saved to. More... | |
SettingFilesContainer | SettingFiles |
A container storing all the file saving configuration used by this handler. More... | |
SettingGroupContainer | SettingGroups |
A container storing all the SettingGroups owned by this handler. More... | |
String | SettingsFilePath |
Stores the path to be used for file IO operations done by this handler. More... | |
An abstract class for other classes that manage groups of settings.
Definition at line 330 of file objectsettings.h.
void Mezzanine::ObjectSettingsHandler::AddGroupToFile | ( | ObjectSettingGroup * | Group, |
const String & | FileName | ||
) |
Assigns a SettingGroup to a file name that will be used when settings are saved.
Group | The setting group getting it's optional file name updated. |
FileName | The name of the file the provided group will be added to. |
Definition at line 508 of file objectsettings.cpp.
|
protectedpure virtual |
Takes all the current settings of this handler and serializes them to an XML::Node.
CurrentNode | The XML::Node to be populated with this handlers current settings. |
Implemented in Mezzanine::Graphics::GraphicsManager.
void Mezzanine::ObjectSettingsHandler::ApplySettingGroup | ( | const String & | GroupName | ) |
Applies all the settings (and their values) defined in a setting group.
GroupName | The name of the setting group to apply. |
Definition at line 417 of file objectsettings.cpp.
|
protectedpure virtual |
Applies all the settings stored by a ObjectSettingGroup.
Group | The ObjectSettingGroup to have all of it's settings applied. |
Implemented in Mezzanine::Graphics::GraphicsManager.
ObjectSettingFile * Mezzanine::ObjectSettingsHandler::CreateSettingFile | ( | const String & | FileName | ) |
Creates a new Setting file that will track which groups are a part of it.
FileName | The name of the file this instance cooresponds to. |
Definition at line 467 of file objectsettings.cpp.
ObjectSettingGroup * Mezzanine::ObjectSettingsHandler::CreateSettingGroup | ( | const String & | Name | ) |
Creates a new blank setting group that can have it's settings populated.
Name | The name to be given to the new settings group. |
Definition at line 427 of file objectsettings.cpp.
void Mezzanine::ObjectSettingsHandler::DestroyAllSettingFiles | ( | ) |
Destroys all Setting files in this handler.
Definition at line 497 of file objectsettings.cpp.
void Mezzanine::ObjectSettingsHandler::DestroySettingFile | ( | const String & | FileName | ) |
Destroys a Setting file by name.
FileName | The name of the setting file to be destroyed. |
Definition at line 481 of file objectsettings.cpp.
void Mezzanine::ObjectSettingsHandler::DestroySettingFile | ( | ObjectSettingFile * | ToBeDestroyed | ) |
Destroys a Setting file.
ToBeDestroyed | The setting file to be destroyed. |
Definition at line 492 of file objectsettings.cpp.
void Mezzanine::ObjectSettingsHandler::DestroySettingGroup | ( | const String & | Name | ) |
Destroys a setting group by name.
Name | The name of the setting group to destroy. |
Definition at line 441 of file objectsettings.cpp.
void Mezzanine::ObjectSettingsHandler::DestroySettingGroup | ( | ObjectSettingGroup * | ToBeDestroyed | ) |
Destroys a setting group.
ToBeDestroyed | A pointer to the group that will be destroyed. |
Definition at line 450 of file objectsettings.cpp.
Boole Mezzanine::ObjectSettingsHandler::GetAutoGenFiles | ( | ) | const |
Gets whether or not this object is currently allowed to create/update settings files upon initialization and destruction.
Definition at line 638 of file objectsettings.cpp.
Boole Mezzanine::ObjectSettingsHandler::GetAutoGenPath | ( | ) | const |
Gets whether or not this object is currently allowed to create folders when saving.
Definition at line 632 of file objectsettings.cpp.
ConstString & Mezzanine::ObjectSettingsHandler::GetCurrentSettingsSaveFile | ( | ) | const |
Gets the name of the file the "Current" setting group is saved to.
Definition at line 565 of file objectsettings.cpp.
|
protectedpure virtual |
Gets the name to be given to a Node with this handlers serialized data.
Implemented in Mezzanine::Graphics::GraphicsManager.
|
static |
Get the name of the the XML tag the class will leave behind as its instances are serialized.
Definition at line 841 of file objectsettings.cpp.
ObjectSettingFile * Mezzanine::ObjectSettingsHandler::GetSettingFile | ( | const String & | FileName | ) |
Gets a Setting file by name.
FileName | The name of the setting file to get. |
Definition at line 474 of file objectsettings.cpp.
ObjectSettingGroup * Mezzanine::ObjectSettingsHandler::GetSettingGroup | ( | const String & | Name | ) | const |
Gets a setting group by name.
Name | The name of the setting group to get. |
Definition at line 434 of file objectsettings.cpp.
const String & Mezzanine::ObjectSettingsHandler::GetSettingsFilePath | ( | ) | const |
Gets the currently set settings file path.
Definition at line 555 of file objectsettings.cpp.
CountedPtr< ObjectSettingsHandler::SettingGroupVector > Mezzanine::ObjectSettingsHandler::LoadSettings | ( | const String & | FileName, |
const String & | Path | ||
) |
Loads settings from a settings file.
FileName | The name of the file to load and parse. |
Path | The filesystem path where the file can be found. |
Definition at line 582 of file objectsettings.cpp.
CountedPtr< ObjectSettingsHandler::SettingGroupVector > Mezzanine::ObjectSettingsHandler::LoadSettings | ( | const String & | FileName | ) |
Loads settings from a settings file using the specified settings path.
FileName | The name of the file to load and parse. |
Definition at line 587 of file objectsettings.cpp.
|
protected |
Populates an ObjectSettingSet with settings stored in XML.
XMLNode | The XML node storing the serialized ObjectSettingSet. |
Set | The ObjectSettingSet to be populated with usable settings. |
Definition at line 384 of file objectsettings.cpp.
|
protected |
Loads all ObjectSettingGroup instances serialized to a XML file into usable ObjectSettingGroup instances.
FileName | The name of the file to be loaded. |
Path | The path to the file to be loaded. |
Definition at line 325 of file objectsettings.cpp.
CountedPtr< ObjectSettingsHandler::SettingGroupVector > Mezzanine::ObjectSettingsHandler::LoadSettingsFromGroup | ( | const String & | FileName, |
const String & | Group | ||
) |
Loads settings from a settings file.
FileName | The name of the file to load and parse. |
Group | The asset group where the file can be found. |
Definition at line 573 of file objectsettings.cpp.
CountedPtr< ObjectSettingsHandler::SettingGroupVector > Mezzanine::ObjectSettingsHandler::LoadSettingsFromXML | ( | XML::Node & | RootSettings | ) |
Loads settings from an xml node.
RootSettings | The node that reprsents the root of the settings group or groups. |
Definition at line 595 of file objectsettings.cpp.
void Mezzanine::ObjectSettingsHandler::ProtoDeSerialize | ( | const XML::Node & | SelfRoot | ) |
Take the data stored in an XML Node and overwrite this object with it.
SelfRoot | An XML::Node containing the data to populate this class with. |
Definition at line 781 of file objectsettings.cpp.
void Mezzanine::ObjectSettingsHandler::ProtoSerialize | ( | XML::Node & | SelfRoot | ) | const |
Convert this class to an XML::Node ready for serialization.
SelfRoot | The root node containing all the serialized data for this instance. |
Definition at line 762 of file objectsettings.cpp.
void Mezzanine::ObjectSettingsHandler::RemoveGroupFromFile | ( | ObjectSettingGroup * | Group, |
const String & | FileName | ||
) |
Removes a previously assigned group from a save file name.
Group | The setting group getting removed from it's current optional file name. |
FileName | The name of the file the provided group will be removed from. |
Definition at line 525 of file objectsettings.cpp.
void Mezzanine::ObjectSettingsHandler::SaveAllSettings | ( | ) |
Saves all settings that need saving.
Definition at line 641 of file objectsettings.cpp.
void Mezzanine::ObjectSettingsHandler::SaveSettingGroups | ( | StringVector & | GroupNames, |
const String & | FileName, | ||
const String & | Path | ||
) |
Saves all settings to a settings file.
GroupNames | A string vector containing the names for all the settings groups to save. |
Filename | The name of the file to save the current settings to. |
Path | The path to place the file being saved. |
Definition at line 709 of file objectsettings.cpp.
void Mezzanine::ObjectSettingsHandler::SaveSettingGroups | ( | StringVector & | GroupNames, |
const String & | FileName | ||
) |
Saves all settings to a settings file using the specified settings path.
GroupNames | A string vector containing the names for all the settings groups to save. |
Filename | The name of the file to save the current settings to. |
Definition at line 714 of file objectsettings.cpp.
void Mezzanine::ObjectSettingsHandler::SaveSettingsByFile | ( | const String & | FileName, |
const String & | Path | ||
) |
Saves all settings that have their optional filename set to the specified file.
Filename | The optional filename that will be used to determine which groups will be saved, and to what file. |
Path | The path to place the file being saved. |
Definition at line 667 of file objectsettings.cpp.
void Mezzanine::ObjectSettingsHandler::SaveSettingsByFile | ( | const String & | FileName | ) |
Saves all settings that have their optional filename set to the specified file.
Filename | The optional filename that will be used to determine which groups will be saved, and to what file. |
Definition at line 686 of file objectsettings.cpp.
|
protected |
Saves an ObjectSettingSet to an XML node.
XMLNode | The XML node to be written with the settings of the provided set. |
Set | The ObjectSettingSet to be written to XML. |
Definition at line 400 of file objectsettings.cpp.
|
protected |
Saves a collection of ObjectSettingGroups stored by this handler to a file as XML.
GroupNames | A container storing all the names of of the ObjectSettingGroup instances to be saved. |
FileName | The name of the file to be saved at. |
Path | The path to the file being saved. |
Definition at line 365 of file objectsettings.cpp.
void Mezzanine::ObjectSettingsHandler::SaveSettingsToXML | ( | XML::Node & | RootSettings, |
Boole | SaveCurrent = true |
||
) |
Saves all the current setting groups as children of the provided XML node.
SaveCurrent | Whether or not to also save the current settings to XML. |
RootSettings | The node to populate with all currently loaded settings groups. |
Definition at line 723 of file objectsettings.cpp.
void Mezzanine::ObjectSettingsHandler::SaveSettingsToXML | ( | StringVector & | GroupNames, |
XML::Node & | RootSettings | ||
) |
Saves the named settings groups as children of the provided XML node.
GroupNames | A string vector containing the names for all the settings groups to save. |
RootSettings | The node to populate with all currently loaded settings groups. |
Definition at line 737 of file objectsettings.cpp.
void Mezzanine::ObjectSettingsHandler::SetAutoGenFiles | ( | Boole | Enable | ) |
Enables or disables the automatic creation of settings files on initialization and destruction of this object.
Enable | True to allow this object to save it's settings sets to a file on initialization and destruction. |
Definition at line 635 of file objectsettings.cpp.
void Mezzanine::ObjectSettingsHandler::SetAutoGenPath | ( | Boole | Enable | ) |
Enables or disables the automatic creation of a directory path when saving.
Enable | True to allow this object to create folders in the intended save path allowing the path to be valid, false otherwise. |
Definition at line 629 of file objectsettings.cpp.
void Mezzanine::ObjectSettingsHandler::SetCurrentSettingsSaveFile | ( | const String & | FileName | ) |
Sets the name of the file that will have this object's "current" settings saved to.
Any group labeled "Current" (case sensative) will be used and immediately applied upon loading.
If this is enabled and no group specifiers are used, then the Current settings will automatically be saved any time the groups are saved. When using functions with group specifiers, you can include a string "Current" to save the current settings.
It's also important to note that the "Current" settings group, although it'll be present in saved files, is not a group traversible in code. It is solely intended to save the existing state at shutdown, and resume with that exact config.
FileName | Name of the file to save the current settings to. |
Definition at line 560 of file objectsettings.cpp.
void Mezzanine::ObjectSettingsHandler::SetSettingsFilePath | ( | const String & | Path | ) |
Sets the path to be assumed when saving/loading settings to files.
Path | The path to be assumed. |
Definition at line 538 of file objectsettings.cpp.
|
protected |
Stores whether or not this handler will attempt to automatically generate a file if it doesn't exist.
Definition at line 359 of file objectsettings.h.
|
protected |
Stores whether or not this handler will attempt to automatically generate a path to a file if it doesn't exist.
Definition at line 356 of file objectsettings.h.
|
protected |
Stores the name of the file where the "Current" settings group will be saved to.
Definition at line 365 of file objectsettings.h.
|
protected |
A container storing all the file saving configuration used by this handler.
Definition at line 353 of file objectsettings.h.
|
protected |
A container storing all the SettingGroups owned by this handler.
Definition at line 350 of file objectsettings.h.
|
protected |
Stores the path to be used for file IO operations done by this handler.
Definition at line 362 of file objectsettings.h.