![]() |
Blamite Game Engine - Strings
00333.08.11.21.2016.blamite
A library containing general purpose utilities and classes for use in multiple projects.
|
Structure representing a configuration section. More...
#include <config.h>
Public Member Functions | |
| BlamConfigurationSection (std::string _name, std::string _filename) | |
| Prepares a new configuration section. More... | |
| ~BlamConfigurationSection () | |
| Destructor. More... | |
| void | AddNewSetting (BlamConfigurationSetting *new_setting) |
| Adds a new configuration setting to the section. More... | |
| void | AddNewDefaultSetting (BlamConfigurationSetting *new_setting) |
| Adds a new default configuration setting to the section. More... | |
| bool | HasOption (std::string option) |
| Checks whether or not a given configuration setting exists in this section. More... | |
| std::string * | GetString (std::string option) |
| Retrieves a configuration setting as a string. More... | |
| bool * | GetBool (std::string option) |
| Retrieves a configuration setting as a bool. More... | |
| float * | GetFloat (std::string option) |
| Retrieves a configuration setting as a float. More... | |
| int * | GetInt (std::string option) |
| Retrieves a configuration setting as an int. More... | |
| BlamColor * | GetColor (std::string option) |
| Retrieves a configuration setting as a color. More... | |
| std::string | GetDisplayNameString () |
| Generates a display name for the configuration section for use in a user-friendly settings dialog. More... | |
| void | RestoreDefaultSettings () |
| Restores all settings to their default values. More... | |
Public Attributes | |
| std::map< std::string, BlamConfigurationSetting * > | settings |
| The list of configuration settings within this section. More... | |
| std::map< std::string, BlamConfigurationSetting * > | default_settings |
| The list of default settings within this section. More... | |
| std::string | name |
| The name of this configuration section. More... | |
Structure representing a configuration section.
Unlike the old configuration file setup, configuration files are broken up into sections, similar to an INI file. These can be used to group similar settings
| BlamConfigurationSection::BlamConfigurationSection | ( | std::string | _name, |
| std::string | _filename | ||
| ) |
Prepares a new configuration section.
| _name | - The name of the configuration section. |
| _filename | - The filename that this section belongs to. |
| BlamConfigurationSection::~BlamConfigurationSection | ( | ) |
Destructor.
Deletes any and all settings stored within the section.
| void BlamConfigurationSection::AddNewDefaultSetting | ( | BlamConfigurationSetting * | new_setting | ) |
Adds a new default configuration setting to the section.
| new_setting | - Pointer to the new default setting to add to this section. |
| void BlamConfigurationSection::AddNewSetting | ( | BlamConfigurationSetting * | new_setting | ) |
Adds a new configuration setting to the section.
| new_setting | - Pointer to the new setting to add to this section. |
| bool * BlamConfigurationSection::GetBool | ( | std::string | option | ) |
Retrieves a configuration setting as a bool.
| option | - The option to retrieve. |
nullptr. If the setting exists but cannot be interpreted as a bool, then will also return nullptr. | BlamColor * BlamConfigurationSection::GetColor | ( | std::string | option | ) |
Retrieves a configuration setting as a color.
| option | - The option to retrieve. |
nullptr. If the setting exists but cannot be interpreted as a color, then will also return nullptr. | std::string BlamConfigurationSection::GetDisplayNameString | ( | ) |
Generates a display name for the configuration section for use in a user-friendly settings dialog.
This will attempt to check the string database for a matching configuration string entry. By default, these are stored in config_strings.xml, though the specific file is largely irrelevant. The format for a display name string is as follows:
config_{0}_section_{1}_name
{0}represents the file name of the configuration file, with no extension or other path information.{1}represents the section ID as it appears in the configuration file.
If no matching string is found, then this will simply return the ID of the section.
| float * BlamConfigurationSection::GetFloat | ( | std::string | option | ) |
Retrieves a configuration setting as a float.
| option | - The option to retrieve. |
nullptr. If the setting exists but cannot be interpreted as a float, then will also return nullptr. | int * BlamConfigurationSection::GetInt | ( | std::string | option | ) |
Retrieves a configuration setting as an int.
| option | - The option to retrieve. |
nullptr. If the setting exists but cannot be interpreted as an int, then will also return nullptr. | std::string * BlamConfigurationSection::GetString | ( | std::string | option | ) |
Retrieves a configuration setting as a string.
| option | - The option to retrieve. |
nullptr. If the setting exists but is not listed as a string, then will also return nullptr. | bool BlamConfigurationSection::HasOption | ( | std::string | option | ) |
Checks whether or not a given configuration setting exists in this section.
| option | - The setting to look for. |
true if the option exists, otherwise returns false. | void BlamConfigurationSection::RestoreDefaultSettings | ( | ) |
Restores all settings to their default values.
| std::map<std::string, BlamConfigurationSetting*> BlamConfigurationSection::default_settings |
The list of default settings within this section.
| std::string BlamConfigurationSection::name |
The name of this configuration section.
| std::map<std::string, BlamConfigurationSetting*> BlamConfigurationSection::settings |
The list of configuration settings within this section.