clockUtils  1.1
IniParser

Namespaces

 clockUtils
 

Macros

#define CLOCK_INIPARSER_API
 
#define CLOCK_INIPARSER_API
 

Detailed Description

The ini parser library can be used to easily load, read, write and save ini files used to configure programs

How to use the ini parser library

You need to include this header

Many programms use some configuration files like ini files or use at least the same formatting. To be able to use these files in a simple but efficient way you can use our ini parser library.

An ini file looks normally likes this:

[SECTION]
;comment
variable=value
First create an instance of the IniParser class.

To load a file just call load method and add file as parameter:

iniParser.load("foobar.ini");
If loading of the file succeeds, ClockError::SUCCESS is returned, otherwise another error code.
To get the value of a variable you use the getValue method.

std::string value;
iniParser.getValue("SECTION", "variable", value);

Because of templates the type of value (here std::string) specifies the expected type for the value stored in ini file. If you used a type the type in the file can be converted into the method will return ClockError::SUCCESS, otherwise an error code.

The setting of values works analog.

iniParser.setValue("SECTION", "variable", value);

This code will set the value of the variable "variable" in section "SECTION" to the last parameter.

To save the changes just call save method like load and give an ini file as parameter.

Macro Definition Documentation

§ CLOCK_INIPARSER_API [1/2]

#define CLOCK_INIPARSER_API

Definition at line 40 of file containerParameters.h.

§ CLOCK_INIPARSER_API [2/2]

#define CLOCK_INIPARSER_API

Definition at line 40 of file iniParserParameters.h.