Elaztek Developer Hub
Blamite Game Engine - Strings  00386.06.16.23.0646.blamite
A library containing general purpose utilities and classes for use in multiple projects.
BlamConfigurationSection Class Reference

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...
 
BlamColorGetColor (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...
 

Detailed Description

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

Constructor & Destructor Documentation

◆ BlamConfigurationSection()

BlamConfigurationSection::BlamConfigurationSection ( std::string  _name,
std::string  _filename 
)

Prepares a new configuration section.

Parameters
_name- The name of the configuration section.
_filename- The filename that this section belongs to.

◆ ~BlamConfigurationSection()

BlamConfigurationSection::~BlamConfigurationSection ( )

Destructor.

Deletes any and all settings stored within the section.

Member Function Documentation

◆ AddNewDefaultSetting()

void BlamConfigurationSection::AddNewDefaultSetting ( BlamConfigurationSetting new_setting)

Adds a new default configuration setting to the section.

Parameters
new_setting- Pointer to the new default setting to add to this section.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ AddNewSetting()

void BlamConfigurationSection::AddNewSetting ( BlamConfigurationSetting new_setting)

Adds a new configuration setting to the section.

Parameters
new_setting- Pointer to the new setting to add to this section.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetBool()

bool * BlamConfigurationSection::GetBool ( std::string  option)

Retrieves a configuration setting as a bool.

Parameters
option- The option to retrieve.
Returns
Pointer to the setting value if it exists, otherwise returns nullptr. If the setting exists but cannot be interpreted as a bool, then will also return nullptr.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetColor()

BlamColor * BlamConfigurationSection::GetColor ( std::string  option)

Retrieves a configuration setting as a color.

Parameters
option- The option to retrieve.
Returns
Pointer to the setting value if it exists, otherwise returns nullptr. If the setting exists but cannot be interpreted as a color, then will also return nullptr.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetDisplayNameString()

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.

Returns
A string representing the display name for the section.
+ Here is the call graph for this function:

◆ GetFloat()

float * BlamConfigurationSection::GetFloat ( std::string  option)

Retrieves a configuration setting as a float.

Parameters
option- The option to retrieve.
Returns
Pointer to the setting value if it exists, otherwise returns nullptr. If the setting exists but cannot be interpreted as a float, then will also return nullptr.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetInt()

int * BlamConfigurationSection::GetInt ( std::string  option)

Retrieves a configuration setting as an int.

Parameters
option- The option to retrieve.
Returns
Pointer to the setting value if it exists, otherwise returns nullptr. If the setting exists but cannot be interpreted as an int, then will also return nullptr.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetString()

std::string * BlamConfigurationSection::GetString ( std::string  option)

Retrieves a configuration setting as a string.

Parameters
option- The option to retrieve.
Returns
Pointer to the setting value if it exists, otherwise returns nullptr. If the setting exists but is not listed as a string, then will also return nullptr.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ HasOption()

bool BlamConfigurationSection::HasOption ( std::string  option)

Checks whether or not a given configuration setting exists in this section.

Parameters
option- The setting to look for.
Returns
true if the option exists, otherwise returns false.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ RestoreDefaultSettings()

void BlamConfigurationSection::RestoreDefaultSettings ( )

Restores all settings to their default values.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ default_settings

std::map<std::string, BlamConfigurationSetting*> BlamConfigurationSection::default_settings

The list of default settings within this section.

◆ name

std::string BlamConfigurationSection::name

The name of this configuration section.

◆ settings

std::map<std::string, BlamConfigurationSetting*> BlamConfigurationSection::settings

The list of configuration settings within this section.


The documentation for this class was generated from the following files: