48 lines
835 B
C
48 lines
835 B
C
|
#ifndef _CONFIG_H_
|
||
|
#define _CONFIG_H_
|
||
|
|
||
|
#include "list.h"
|
||
|
|
||
|
class Config {
|
||
|
public:
|
||
|
~Config();
|
||
|
|
||
|
bool parseFile(const char* name);
|
||
|
void show() const;
|
||
|
|
||
|
char* getParameter(const char* section, const char* name) const;
|
||
|
char* getString(const char* section, const char* name, char* def) const;
|
||
|
int getInteger(const char* section, const char* name, int def) const;
|
||
|
|
||
|
private:
|
||
|
class Tupel {
|
||
|
public:
|
||
|
Tupel(const char* name, const char* value);
|
||
|
~Tupel();
|
||
|
|
||
|
char* name;
|
||
|
char* value;
|
||
|
};
|
||
|
|
||
|
class Section {
|
||
|
public:
|
||
|
Section(const char* name);
|
||
|
~Section();
|
||
|
|
||
|
bool addTupel(const char* name, const char* option);
|
||
|
char* getTupelValue(const char* name) const;
|
||
|
void show() const;
|
||
|
|
||
|
char* name;
|
||
|
|
||
|
private:
|
||
|
List<Tupel> tupelList;
|
||
|
};
|
||
|
|
||
|
Section* addSection(const char* name);
|
||
|
|
||
|
List<Section> sectionList;
|
||
|
};
|
||
|
|
||
|
#endif // _CONFIG_H_
|