Unigine::Config Class
Header: | #include <UnigineConfig.h> |
Reads values (settings) from the configuration file and writes back into it.
Config Class
Members
Config * get()
Returns a pointer to the existing Config instance.Return value
A pointer to the Config instance.void setBool(const char * name, int value)
Sets a boolean value of a given parameter. If the parameter with this name already exists, its value is overwritten.Arguments
- const char * name - Name of the parameter.
- int value - Boolean value of the parameter: 0 means FALSE, 1 means TRUE.
int getBool(const char * name)
Returns the current boolean value of a given parameter parameter.Arguments
- const char * name - Name of the parameter.
Return value
Boolean value of the parameter: 0 means FALSE, 1 means TRUE.int getBool(const char * name, int value)
Returns the current boolean value of a given parameter parameter.Arguments
- const char * name - Name of the setting.
- int value - Custom value to be returned if nothing is found.
Return value
Boolean value of the parameter: 0 means FALSE, 1 means TRUE.int isExist(const char * name)
Checks whether the parameter with a given name exists.Arguments
- const char * name - Name of the parameter.
Return value
Returns 1 if the parameter with the given name exists; otherwise, 0.void setFloat(const char * name, float value)
Sets a float value of a given parameter. If the parameter with this name already exists, its value is overwritten.Arguments
- const char * name - Name of the parameter.
- float value - Float value of the parameter.
float getFloat(const char * name, float value)
Returns the current float value of a given parameter.Arguments
- const char * name - Name of the setting.
- float value - Custom value to be returned if nothing is found.
Return value
Float value of the parameter.float getFloat(const char * name)
Returns the current float value of a given parameter.Arguments
- const char * name - Name of the parameter.
Return value
Float value of the parameter.void setInt(const char * name, int value)
Sets an integer value of a given parameter. If the parameter with this name already exists, its value is overwritten.Arguments
- const char * name - Name of the parameter.
- int value - Integer value of the parameter.
int getInt(const char * name)
Returns the current integer value of a given parameter.Arguments
- const char * name - Name of the parameter.
Return value
Integer value of the parameter.int getInt(const char * name, int value)
Returns the current integer value of a given parameter.Arguments
- const char * name - Name of the setting.
- int value - Custom value to be returned if nothing is found.
Return value
Integer value of the parameter.void setString(const char * name, const char * value)
Sets a string value of a given parameter.Arguments
- const char * name - Name of the parameter.
- const char * value - string value of the parameter.
const char * getString(const char * name, const char * value)
Returns the current string value of a given parameter.Arguments
- const char * name - Name of the setting.
- const char * value - Custom value to be returned if nothing is found.
Return value
String value of the parameter.const char * getString(const char * name)
Returns the current string value of a given parameter.Arguments
- const char * name - Name of the parameter.
Return value
String value of the parameter.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(const char * name)
Loads config from the file.Arguments
- const char * name - Config file name.
Return value
Returns 1 if the config is successfully loaded from the file; otherwise, 0 is returned.void remove(const char * name)
Removes a parameter with a given name.Arguments
- const char * name - Name of the parameter.
int save(const char * name)
Saves config into the file.Arguments
- const char * name - Config file name.
Return value
Returns 1 if the config is successfully saved into the file; otherwise, 0 is returned.Last update: 2017-07-03
Help improve this article
Was this article helpful?
(or select a word/phrase and press Ctrl+Enter)