Loading...
Searching...
No Matches
CConfigFile Class Reference

Class for loading config file. More...

`#include <src/common/config_file.h>`

Inheritance diagram for CConfigFile:
[legend]

## Public Member Functions

void | SetUseCurrentDirectory (bool useCurrentDirectory)
bool | Init ()
bool | Save ()
bool | SetStringProperty (std::string section, std::string key, std::string value)
bool | GetStringProperty (std::string section, std::string key, std::string &value)
bool | SetIntProperty (std::string section, std::string key, int value)
bool | SetBoolProperty (std::string section, std::string key, bool value)
bool | GetIntProperty (std::string section, std::string key, int &value)
bool | SetFloatProperty (std::string section, std::string key, float value)
bool | GetFloatProperty (std::string section, std::string key, float &value)
bool | GetBoolProperty (std::string section, std::string key, bool &value)
template<typename T>
bool | SetArrayProperty (std::string section, std::string key, const std::vector< T > &array)
template<typename T>
bool | GetArrayProperty (std::string section, std::string key, std::vector< T > &array)

## Additional Inherited Members

Static Public Member Functions inherited from CSingleton< CConfigFile >
static CConfigFile & | GetInstance ()
static CConfigFile * | GetInstancePointer ()
static bool | IsCreated ()
Static Protected Attributes inherited from CSingleton< CConfigFile >
static CConfigFile * | m_instance

## Detailed Description

Class for loading config file.

## Member Function Documentation

## SetUseCurrentDirectory()

void CConfigFile::SetUseCurrentDirectory | ( | bool | useCurrentDirectory | ) |

Set flag to force using ini file from current directory

## Init()

bool CConfigFile::Init | ( |  | ) |

Loads colobot.ini

Returns
  return true on success

## Save()

bool CConfigFile::Save | ( |  | ) |

Saves colobot.ini

Returns
  return true on success

## SetStringProperty()

bool CConfigFile::SetStringProperty | ( | std::string | section,
|  | std::string | key,
|  | std::string | value )

Sets string value in section under specified key

Returns
  return true on success

## GetStringProperty()

bool CConfigFile::GetStringProperty | ( | std::string | section,
|  | std::string | key,
|  | std::string & | value )

Gets string value in section under specified key

Returns
  return true on success

## SetIntProperty()

bool CConfigFile::SetIntProperty | ( | std::string | section,
|  | std::string | key,
|  | int | value )

Sets int value in section under specified key

Returns
  return true on success

## SetBoolProperty()

bool CConfigFile::SetBoolProperty | ( | std::string | section,
|  | std::string | key,
|  | bool | value )

Sets bool value in section under specified key

Returns
  return true on success

## GetIntProperty()

bool CConfigFile::GetIntProperty | ( | std::string | section,
|  | std::string | key,
|  | int & | value )

Gets int value in section under specified key value will only be changed if key exists

Returns
  return true on success

## SetFloatProperty()

bool CConfigFile::SetFloatProperty | ( | std::string | section,
|  | std::string | key,
|  | float | value )

Sets float value in section under specified key value will only be changed if key exists

Returns
  return true on success

## GetFloatProperty()

bool CConfigFile::GetFloatProperty | ( | std::string | section,
|  | std::string | key,
|  | float & | value )

Gets float value in section under specified key value will only be changed if key exists

Returns
  return true on success

## GetBoolProperty()

bool CConfigFile::GetBoolProperty | ( | std::string | section,
|  | std::string | key,
|  | bool & | value )

Gets bool value in section under specified key value will only be changed if key exists

Returns
  return true on success

## SetArrayProperty()

template<typename T>

bool CConfigFile::SetArrayProperty | ( | std::string | section,
|  | std::string | key,
|  | const std::vector< T > & | array )

inline

Gets an array of values of type T in section under specified key The value separator is ','. array will only be changed if key exists

Returns
  return true on success

## GetArrayProperty()

template<typename T>

bool CConfigFile::GetArrayProperty | ( | std::string | section,
|  | std::string | key,
|  | std::vector< T > & | array )

inline

Sets an array of values of type T in section under specified key. The value separator is ','. array will only be changed if key exists

Returns
  return true on success

The documentation for this class was generated from the following files:

- src/common/config_file.h
- src/common/config_file.cpp