Wrapper for ALLEGRO_CONFIG More...
#include <ConfigPlus.h>
Public Member Functions | |
ConfigPlus (bool createEmpty=false) | |
Constructor. | |
ConfigPlus (const char *filename) | |
Constructor. | |
ConfigPlus (const std::string &filename) | |
Constructor. | |
~ConfigPlus () | |
Destructor. | |
void | Empty () |
Resets to an empty configuration file | |
void | Load (const char *filename) |
Loads a configuration from the specified filename. | |
void | Load (const std::string &filename) |
Loads a configuration from the specified filename. | |
void | Load (ALLEGRO_FILE *file) |
Loads a configuration from an allegro file. | |
void | Save (const char *filename) const |
Saves the configuration to the specified filename. | |
void | Save (const std::string &filename) const |
Saves the configuration to the specified filename. | |
void | Save (ALLEGRO_FILE *file) const |
Saves the configuration to the specified filename. | |
void | AddSection (const char *name) |
Adds a section to the configuration. | |
void | AddSection (const std::string &name) |
Adds a section to the configuration. | |
void | AddComment (const char *section, const char *comment) |
Adds a comment to the specified section. | |
void | AddComment (const std::string §ion, const std::string &comment) |
Adds a comment to the specified section. | |
const char * | GetValueDirect (const char *section, const char *key) const |
Gets a value directly from the allegro config. Will have to convert the value if non-string type is desired. | |
void | SetValueDirect (const char *section, const char *key, const char *value) |
Sets a value to the allegro config. Will have to convert the value to string if non-string type. | |
void | MergeConfig (const ConfigPlus &with, ConfigPlus &to) const |
Merges this configuation and the passed configuration into the specified configuration. | |
void | MergeConfigInto (const ConfigPlus &with) |
Merges the passed configuration into this configuration. | |
template<typename T > | |
T | GetValue (const char *section, const char *key) const |
Gets a value from the allegro config. This will handle converting to the desired type. | |
template<typename T > | |
T | GetValue (const std::string §ion, const std::string &key) const |
Gets a value from the allegro config. This will handle converting to the desired type. | |
template<typename T > | |
void | SetValue (const char *section, const char *key, const T &value) |
Sets a value to the allegro config. This will handle converting to the desired type. | |
template<typename T > | |
void | SetValue (const std::string §ion, const std::string &key, const T &value) |
Sets a value to the allegro config. This will handle converting to the desired type. |
Wrapper for ALLEGRO_CONFIG
Allegro::ConfigPlus::ConfigPlus | ( | bool | createEmpty = false | ) |
Constructor.
createEmpty | true: create an empty/blank configuration file, false: don't create |
Allegro::ConfigPlus::ConfigPlus | ( | const char * | filename | ) |
Constructor.
filename | The filename to load. |
Allegro::ConfigPlus::ConfigPlus | ( | const std::string & | filename | ) |
Constructor.
filename | The filename to load. |
Allegro::ConfigPlus::~ConfigPlus | ( | ) |
Destructor.
void Allegro::ConfigPlus::AddComment | ( | const char * | section, |
const char * | comment | ||
) |
Adds a comment to the specified section.
section | The section. |
comment | The comment. |
void Allegro::ConfigPlus::AddComment | ( | const std::string & | section, |
const std::string & | comment | ||
) |
Adds a comment to the specified section.
section | The section. |
comment | The comment. |
void Allegro::ConfigPlus::AddSection | ( | const char * | name | ) |
Adds a section to the configuration.
name | The name of the section. |
void Allegro::ConfigPlus::AddSection | ( | const std::string & | name | ) |
Adds a section to the configuration.
name | The name of the section. |
void Allegro::ConfigPlus::Empty | ( | ) |
Resets to an empty configuration file
|
inline |
Gets a value from the allegro config. This will handle converting to the desired type.
section | The section. |
key | The key. |
|
inline |
Gets a value from the allegro config. This will handle converting to the desired type.
section | The section. |
key | The key. |
const char * Allegro::ConfigPlus::GetValueDirect | ( | const char * | section, |
const char * | key | ||
) | const |
Gets a value directly from the allegro config. Will have to convert the value if non-string type is desired.
section | The section. |
key | The key. |
See GetValue<T> for retriving values direct to type
void Allegro::ConfigPlus::Load | ( | const char * | filename | ) |
Loads a configuration from the specified filename.
filename | The filename to load. |
void Allegro::ConfigPlus::Load | ( | const std::string & | filename | ) |
Loads a configuration from the specified filename.
filename | The filename to load. |
void Allegro::ConfigPlus::Load | ( | ALLEGRO_FILE * | file | ) |
Loads a configuration from an allegro file.
file | If non-null, the file to load. |
void Allegro::ConfigPlus::MergeConfig | ( | const ConfigPlus & | with, |
ConfigPlus & | to | ||
) | const |
Merges this configuation and the passed configuration into the specified configuration.
with | The configuration to merge this one with. |
to | The destination configuration to combine them into. |
void Allegro::ConfigPlus::MergeConfigInto | ( | const ConfigPlus & | with | ) |
Merges the passed configuration into this configuration.
with | The configuration to merge this configuration with. |
void Allegro::ConfigPlus::Save | ( | const char * | filename | ) | const |
Saves the configuration to the specified filename.
filename | The filename to save to. |
void Allegro::ConfigPlus::Save | ( | const std::string & | filename | ) | const |
Saves the configuration to the specified filename.
filename | The filename to save to. |
void Allegro::ConfigPlus::Save | ( | ALLEGRO_FILE * | file | ) | const |
Saves the configuration to the specified filename.
file | If non-null, the allegro file to save to. |
|
inline |
Sets a value to the allegro config. This will handle converting to the desired type.
section | The section. |
key | The key. |
|
inline |
Sets a value to the allegro config. This will handle converting to the desired type.
section | The section. |
key | The key. |
void Allegro::ConfigPlus::SetValueDirect | ( | const char * | section, |
const char * | key, | ||
const char * | value | ||
) |
Sets a value to the allegro config. Will have to convert the value to string if non-string type.
section | The section. |
key | The key. |
See SetValue<T> for setting values direct from type