Polycode
Polycode::Config Class Reference

Saves and loads simple config files. More...

List of all members.

Public Member Functions

 Config ()
 Default constructor.
void loadConfig (const String &configNamespace, const String &fileName)
 Load config from a specified file into the specified namespace.
void saveConfig (const String &configNamespace, const String &fileName)
 Save config to a specified file from the specified namespace.
void setStringValue (const String &configNamespace, const String &key, const String &value)
 Sets a string value into the specified config namespace.
void setNumericValue (const String &configNamespace, const String &key, Number value)
 Sets a numeric value into the specified config namespace.
Number getNumericValue (const String &configNamespace, const String &key)
 Returns a numeric value by a string key.
const StringgetStringValue (const String &configNamespace, const String &key)
 Returns a string value by a string key.

Detailed Description

Saves and loads simple config files.

Config stores, loads and saves string and number values associated by string keys. You can use to easily save and load settings and preferences and other data. Configs are separated by namespaces, so you can have multiple configs with the same keys.


Member Function Documentation

Number Config::getNumericValue ( const String configNamespace,
const String key 
)

Returns a numeric value by a string key.

Parameters:
configNamespaceNamespace to get the value from.
keyString key of the value.
const String & Config::getStringValue ( const String configNamespace,
const String key 
)

Returns a string value by a string key.

Parameters:
configNamespaceNamespace to get the value from.
keyString key of the value.
void Config::loadConfig ( const String configNamespace,
const String fileName 
)

Load config from a specified file into the specified namespace.

Parameters:
configNamespaceNamespace of the config to load data into.
fileNamePath to the file to load.
void Config::saveConfig ( const String configNamespace,
const String fileName 
)

Save config to a specified file from the specified namespace.

Parameters:
configNamespaceNamespace of the config to save data from.
fileNamePath to the file to save data to.
void Config::setNumericValue ( const String configNamespace,
const String key,
Number  value 
)

Sets a numeric value into the specified config namespace.

Parameters:
configNamespaceNamespace to set value in.
keyString key of the value.
valueThe numeric value to save.
void Config::setStringValue ( const String configNamespace,
const String key,
const String value 
)

Sets a string value into the specified config namespace.

Parameters:
configNamespaceNamespace to set value in.
keyString key of the value.
valueThe string value to save.