Elaztek Developer Hub
Blamite Game Engine - Strings  00307.01.26.21.0804.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...
 
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...
 

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.

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.

◆ 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.

◆ 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.

◆ 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.

◆ 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.

◆ 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.

◆ 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.

◆ 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.

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: