Blamite Game Engine - blam!  00272.10.26.20.0001.blamite
The core library for the Blamite Game Engine.
Blam::Config Namespace Reference

Namespace to contain anything related to Configuration files. More...

Classes

class  ConfigFile
 Class to contain data related to a Config file. More...
 
struct  ConfigOption
 Structure to contain data for an option within a Config file. More...
 

Functions

BLAM int CheckDefaultConfig ()
 Checks if the default engine configuration file exists. More...
 
BLAM bool IsDefaultConfigReady ()
 
BLAM int LoadConfig (std::string filename)
 Loads a configuration file from the specified path. More...
 
BLAM int LoadConfig (std::string filename, bool load_defaults)
 Loads a configuration file from the specified path. More...
 
BLAM int LoadConfig (std::string filename, bool load_defaults, int defaults_resource_id)
 Loads a configuration file from the specified path. More...
 
BLAM int LoadConfig (std::string filename, bool load_defaults, int defaults_resource_id, const char *defaults_res_type)
 Loads a configuration file from the specified path. More...
 
BLAM int LoadConfig ()
 Loads the default engine configuration file (engine.cfg) More...
 
BLAM ConfigFileGetConfig (std::string filename)
 Retrieves the specified configuration file. More...
 
BLAM ConfigFileGetConfig ()
 Retrieves the default engine configuration file. More...
 
BLAM void ApplyPlaceholdersToAllConfigFiles ()
 Applies placeholder values to all configuration files. More...
 
BLAM void ExpandConfigOptionPlaceholders ()
 Expands all placeholders, and converts them to their evaluated values. More...
 
BLAM void InsertConfigFile (ConfigFile config)
 Inserts a loaded ConfigFile into the map of loaded configuration files. More...
 
BLAM ConfigFileGetConfigData (std::string filename)
 Retrieves the specified configuration file. More...
 

Detailed Description

Namespace to contain anything related to Configuration files.

Todo:
move documentation comments into header
Deprecated:
Will be replaced in favor of the new configuration system. See Blam::Settings::Config for details.

Function Documentation

◆ ApplyPlaceholdersToAllConfigFiles()

void Blam::Config::ApplyPlaceholdersToAllConfigFiles ( )

Applies placeholder values to all configuration files.

◆ CheckDefaultConfig()

int Blam::Config::CheckDefaultConfig ( )

Checks if the default engine configuration file exists.

If the file doesn't exist, the default file is created.

Returns
0 if the file already exists, 1 if the file did not exist but was created, or -1 if the file does not exist and a new one could not be created.
Todo:
Set up with new error code system (TBA).

◆ ExpandConfigOptionPlaceholders()

void Blam::Config::ExpandConfigOptionPlaceholders ( )

Expands all placeholders, and converts them to their evaluated values.

◆ GetConfig() [1/2]

Blam::Config::ConfigFile * Blam::Config::GetConfig ( )

Retrieves the default engine configuration file.

◆ GetConfig() [2/2]

Blam::Config::ConfigFile * Blam::Config::GetConfig ( std::string  filename)

Retrieves the specified configuration file.

Parameters
filename- The configuration file path. Should be the same as what was passed into LoadConfig()

◆ GetConfigData()

Blam::Config::ConfigFile * Blam::Config::GetConfigData ( std::string  filename)

Retrieves the specified configuration file.

◆ InsertConfigFile()

void Blam::Config::InsertConfigFile ( ConfigFile  config)

Inserts a loaded ConfigFile into the map of loaded configuration files.

◆ IsDefaultConfigReady()

bool Blam::Config::IsDefaultConfigReady ( )

◆ LoadConfig() [1/5]

int Blam::Config::LoadConfig ( )

Loads the default engine configuration file (engine.cfg)

Returns
0 if file was loaded without error, otherwise returns -1
Todo:
Migrate into new error code system (TBA).

◆ LoadConfig() [2/5]

int Blam::Config::LoadConfig ( std::string  filename)

Loads a configuration file from the specified path.

Parameters
filename- The path to the configuration file
Returns
- Will return negative if the file failed to load, will return 0 if file was loaded without error.

◆ LoadConfig() [3/5]

int Blam::Config::LoadConfig ( std::string  filename,
bool  load_defaults 
)

Loads a configuration file from the specified path.

Resource type is assumed to be "CFG", and resource ID is set to 0. Will error if load_defaults is set to true.

TODO: Remove this shit

Parameters
filename- The path to the configuration file
load_defaults- Whether or not to load defaults from an embedded resource.
Returns
- Will return negative if the file failed to load, will return 0 if file was loaded without error.

◆ LoadConfig() [4/5]

int Blam::Config::LoadConfig ( std::string  filename,
bool  load_defaults,
int  defaults_resource_id 
)

Loads a configuration file from the specified path.

Resource type is assumed to be "CFG".

Parameters
filename- The path to the configuration file
load_defaults- Whether or not to load defaults from an embedded resource.
defaults_resource_id- The resource ID that refers to the file containing the default configuration file contents.
Returns
- Will return negative if the file failed to load, will return 0 if file was loaded without error.

◆ LoadConfig() [5/5]

int Blam::Config::LoadConfig ( std::string  filename,
bool  load_defaults,
int  defaults_resource_id,
const char *  defaults_res_type 
)

Loads a configuration file from the specified path.

Parameters
filename- The path to the configuration file
load_defaults- Whether or not to load defaults from an embedded resource.
defaults_resource_id- The resource ID that refers to the file containing the default configuration file contents.
defaults_res_type- The type of resource that the default configuration file is stored in. Should almost always be "CFG"
Returns
- Will return negative if the file failed to load, will return 0 if file was loaded without error.