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

#include <config.h>

Public Member Functions

 BlamConfigurationFile (std::string _filename, std::string _comment_delimeter)
 Prepares a new configuration file to be loaded. More...
 
BlamResult LoadDefaults (HMODULE dll_handle, int resource_id, const char *resource_type)
 Load the list of default sections. More...
 
BlamResult Load ()
 Loads the configuration file from disk. More...
 
BlamResult Reload ()
 Cleans up old data and reloads the configuration file from disk. More...
 
void Save ()
 Saves the configuration file back to disk. More...
 
bool IsLoaded ()
 Whether or not this configuration file has been loaded. More...
 
void AddNewSection (BlamConfigurationSection *section)
 Adds a new configuration section to the file. More...
 
bool HasConfigurationSection (std::string section_name)
 Checks whether or not a given configuration section exists in the file. More...
 
BlamConfigurationSectionGetConfigurationSection (std::string section_name)
 Retrieves a configuration section from the configuration file. More...
 

Public Attributes

std::map< std::string, BlamConfigurationSection * > sections
 The list of configuration sections contained within the file. More...
 
std::string filename = ""
 The name of the configuration file. More...
 
std::string comment_delimeter = ""
 The character or string used to indicate a comment within the file. More...
 

Constructor & Destructor Documentation

◆ BlamConfigurationFile()

BlamConfigurationFile::BlamConfigurationFile ( std::string  _filename,
std::string  _comment_delimeter 
)

Prepares a new configuration file to be loaded.

Parameters
_filename- The path to the configuration file.
_comment_delimeter- The prefix to use when checking if a line is a comment.

Member Function Documentation

◆ AddNewSection()

void BlamConfigurationFile::AddNewSection ( BlamConfigurationSection section)

Adds a new configuration section to the file.

◆ GetConfigurationSection()

BlamConfigurationSection * BlamConfigurationFile::GetConfigurationSection ( std::string  section_name)

Retrieves a configuration section from the configuration file.

Returns
The specified configuration section if it exists, otherwise returns NULL.

◆ HasConfigurationSection()

bool BlamConfigurationFile::HasConfigurationSection ( std::string  section_name)

Checks whether or not a given configuration section exists in the file.

Parameters
section_name- The name of the section to look for.
Returns
true if the section exists, otherwise returns false.

◆ IsLoaded()

bool BlamConfigurationFile::IsLoaded ( )

Whether or not this configuration file has been loaded.

Returns
Whether or not this configuration file has been loaded.

◆ Load()

BlamResult BlamConfigurationFile::Load ( )

Loads the configuration file from disk.

Returns
#BlamResult::Success_OK if the file was loaded successfully, otherwise returns an error code.

◆ LoadDefaults()

BlamResult BlamConfigurationFile::LoadDefaults ( HMODULE  dll_handle,
int  resource_id,
const char *  resource_type 
)

Load the list of default sections.

Parameters
dll_handle- The handle to the module that the resource is stored in.
resource_id- The resource ID for the default configuration values.
resource_type- The type of resource that the default configuration data is stored in.

◆ Reload()

BlamResult BlamConfigurationFile::Reload ( )

Cleans up old data and reloads the configuration file from disk.

Returns
#BlamResult::Success_OK if the file was loaded successfully, otherwise returns an error code.

◆ Save()

void BlamConfigurationFile::Save ( )

Saves the configuration file back to disk.

Returns
#BlamResult::Success_OK if the file was saved successfully, otherwise returns an error code.

Member Data Documentation

◆ comment_delimeter

std::string BlamConfigurationFile::comment_delimeter = ""

The character or string used to indicate a comment within the file.

◆ filename

std::string BlamConfigurationFile::filename = ""

The name of the configuration file.

◆ sections

std::map<std::string, BlamConfigurationSection*> BlamConfigurationFile::sections

The list of configuration sections contained within the file.


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