Config Class
This set of functions allows for reading values (settings) from the configuration file and writing back into it.
Notice
Config Class
Members
float getFloat (string name, float value)
Reads a float value of a given setting.Arguments
- string name - Name of the setting.
- float value - Custom value to be returned if nothing is found.
Return value
Float value of the setting.void setBool (string name, int value)
Sets a boolean value of a given setting. If a setting with this name already exists, its value is overwritten.Arguments
- string name - Name of the setting.
- int value - Boolean value (0 or 1). 0 stands for "false", 1 stands for "true".
void setInt (string name, int value)
Sets an integer value of a given setting. If a setting with this name already exists, its value is overwritten.Arguments
- string name - Name of the setting.
- int value - Integer value.
int getBool (string name)
Reads a boolean value of a given setting.Arguments
- string name - Name of the setting.
Return value
Boolean value (0 or 1) of the setting. 0 stands for "false", 1 stands for "true".void setString (string name, string value)
Sets a string value of a given setting. If a setting with this name already exists, its value is overwritten.Arguments
- string name - Name of the setting.
- string value - String value.
int getInt (string name)
Reads an integer value of a given setting.Arguments
- string name - Name of the setting.
Return value
Integer value of the setting.string getString (string name, string value)
Reads a string value of a given setting.Arguments
- string name - Name of the setting.
- string value - Custom value to be returned if nothing is found.
Return value
String value of the setting.int getInt (string name, int value)
Reads an integer value of a given setting.Arguments
- string name - Name of the setting.
- int value - Custom value to be returned if nothing is found.
Return value
Integer value of the setting.void remove (string name)
Removes a setting with a given name from the configuration file.Arguments
- string name - Name of the setting.
int save (string name)
Saves config into the file.Arguments
- string name - Config file name.
Return value
Returns 1 if the config is successfully saved into the file; otherwise, 0 is returned.int getBool (string name, int value)
Reads a boolean value of a given setting.Arguments
- string name - Name of the setting.
- int value - Custom value to be returned if nothing is found.
Return value
Boolean value (0 or 1) of the setting. 0 stands for "false", 1 stands for "true".int flush ()
Flushes config into the current file.Return value
Returns 1 if the config is successfully flushed into the file; otherwise, 0.int load (string name)
Loads config from the file.Arguments
- string name - Config file name.
Return value
Returns 1 if the config is successfully loaded from the file; otherwise, 0 is returned.int isExist (string name)
Checks, whether a setting with a given name exists.Arguments
- string name - Name of the setting.
Return value
1 if the setting exists; otherwise, 0.float getFloat (string name)
Reads a float value of a given setting.Arguments
- string name - Name of the setting.
Return value
Float value of the setting.string getString (string name)
Reads a string value of a given setting.Arguments
- string name - Name of the setting.
Return value
String value of the setting.void setFloat (string name, float value)
Sets a float value of a given setting. If a setting with this name already exists, its value is overwritten.Arguments
- string name - Name of the setting.
- float value - Float value.
Last update: 2017-07-03
Help improve this article
Was this article helpful?
(or select a word/phrase and press Ctrl+Enter)