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.
BlamConfigurationSetting Class Reference

Class representing a configuration setting. More...

#include <config.h>

Public Member Functions

 BlamConfigurationSetting (std::string line, int line_number, std::string comment_delimeter, std::string _filename)
 Prepares a new configuration setting. More...
 
bool IsValid ()
 Whether or not the provided file line was able to be interpreted as a valid setting. More...
 
std::string * AsString ()
 Retrieves the setting value as a string. More...
 
bool * AsBool ()
 Retrieves the setting value as a bool. More...
 
float * AsFloat ()
 Retrieves the setting value as a float. More...
 
int * AsInt ()
 Retrieves the setting value as an int. More...
 
BlamColorAsColor ()
 Retrieves the setting value as a color. More...
 
std::string ConvertRawValueToString ()
 Converts the raw setting value to a string, with no placeholders expanded. More...
 
void UpdateValue (std::string new_value)
 Updates the configuration setting with a new value. More...
 
std::string * GetRawValue ()
 Retrieves the raw value of the setting, with no placeholders expanded. More...
 

Public Attributes

std::string id
 The name of the setting. More...
 
BlamConfigurationSettingType type
 The type of setting that's being stored. More...
 

Detailed Description

Class representing a configuration setting.

Constructor & Destructor Documentation

◆ BlamConfigurationSetting()

BlamConfigurationSetting::BlamConfigurationSetting ( std::string  line,
int  line_number,
std::string  comment_delimeter,
std::string  _filename 
)

Prepares a new configuration setting.

This method will create new setting data, as well as convert the setting value to the appropriate type.

Parameters
line- The line in the file to interpret as a configuration setting.
comment_delimeter- The prefix to use when checking if the line is a comment.
_filename- The name of the configuration file this setting belongs to.

Member Function Documentation

◆ AsBool()

bool * BlamConfigurationSetting::AsBool ( )

Retrieves the setting value as a bool.

Returns
Pointer to the setting value as a bool. If the value could not be converted to a bool, then nullptr will be returned instead.

◆ AsColor()

BlamColor * BlamConfigurationSetting::AsColor ( )

Retrieves the setting value as a color.

Returns
Pointer to the setting value as a color. If the value could not be converted to a color, then nullptr will be returned instead.

◆ AsFloat()

float * BlamConfigurationSetting::AsFloat ( )

Retrieves the setting value as a float.

Returns
Pointer to the setting value as a float. If the value could not be converted to a float, then nullptr will be returned instead.

◆ AsInt()

int * BlamConfigurationSetting::AsInt ( )

Retrieves the setting value as an int.

Returns
Pointer to the setting value as an int. If the value could not be converted to an int, then nullptr will be returned instead.

◆ AsString()

std::string * BlamConfigurationSetting::AsString ( )

Retrieves the setting value as a string.

Returns
Pointer to the setting value as a string.

◆ ConvertRawValueToString()

std::string BlamConfigurationSetting::ConvertRawValueToString ( )

Converts the raw setting value to a string, with no placeholders expanded.

Returns
The configuration setting as a string.

◆ GetRawValue()

std::string * BlamConfigurationSetting::GetRawValue ( )

Retrieves the raw value of the setting, with no placeholders expanded.

◆ IsValid()

bool BlamConfigurationSetting::IsValid ( )

Whether or not the provided file line was able to be interpreted as a valid setting.

Returns
true if the setting is valid, otherwise returns false.

◆ UpdateValue()

void BlamConfigurationSetting::UpdateValue ( std::string  new_value)

Updates the configuration setting with a new value.

Member Data Documentation

◆ id

std::string BlamConfigurationSetting::id

The name of the setting.

◆ type

BlamConfigurationSettingType BlamConfigurationSetting::type

The type of setting that's being stored.


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