Photon 0.0.2 Simple Open Source 2D Game API |
ConfigFileConfigFile class, for reading/writing INI-style config files. File format is fairly flexible, whitespace and comments beginning with # or ; are ignored & left intact. Use []’s to denote sections. Variables are defined in var=val format. Summary
ConfigFile
Constructor for ConfigFile, calls open. Parameters
setVariable
Template function for setting variables in the config file. WARNING: Do not try to use this with user-defined types, numeric types and strings work fine, and this is all that should be contained in an INI. Parameters
getVariable
Template function for getting values from the config file. Supports returning a default value if the desired variable was not found. WARNING: Do not try to use this with user-defined types, numeric types and strings work fine, and this is all that should be contained in an INI. Parameters
ReturnsValue of variable within config file or defVal if value was not found. |
Default constructor for ConfigFile.
ConfigFile()
open a file, processing it as an INI-like config file.
void open( const std:: string & filename )
Calls close upon the ConfigFile.
virtual ~ConfigFile()
Flushes the data written to the config file to disk, generally needs not be called.
void flush()
Flushes the data and closes, open must be called again before using same ConfigFile.
void close()
Template function for setting variables in the config file.
template<class varType> void setVariable( const std:: string & sec, const std:: string & var, varType value )
Template function for getting values from the config file.
template<class varType> varType getVariable( const std:: string & sec, const std:: string & var, varType defVal ) const