hlswmaster-ng/config.h

65 lines
1.3 KiB
C
Raw Permalink Normal View History

2006-02-02 16:55:44 +01:00
#ifndef _CONFIG_H_
#define _CONFIG_H_
#include "list.h"
class Config {
public:
~Config();
bool parseFile(const char* name);
2006-04-15 19:55:07 +02:00
void show();
2006-02-02 16:55:44 +01:00
2006-04-15 19:55:07 +02:00
const char* getParameter(const char* section, const char* name);
const char* getString(const char* section, const char* name, char* def);
int getInteger(const char* section, const char* name, int def);
2006-02-02 16:55:44 +01:00
2006-02-05 16:44:38 +01:00
Iterator<char>* createIterator(const char* section, const char* name);
2006-02-02 16:55:44 +01:00
private:
2006-04-15 19:55:07 +02:00
class Tupel : private ListEntry<Tupel> {
2006-03-05 02:28:19 +01:00
public:
2006-02-02 16:55:44 +01:00
Tupel(const char* name, const char* value);
~Tupel();
2006-02-05 16:44:38 +01:00
const char* name;
const char* value;
2006-02-02 16:55:44 +01:00
};
2006-03-05 02:28:19 +01:00
2006-04-15 19:55:07 +02:00
class Section : private ListEntry<Section> {
2006-02-02 16:55:44 +01:00
public:
2006-02-05 16:44:38 +01:00
class SectionIterator : public Iterator<char> {
public:
SectionIterator(Section* section, const char* name);
~SectionIterator();
bool hasNext();
char* next();
2006-03-06 20:13:26 +01:00
void remove() {}
2006-02-05 16:44:38 +01:00
void reset();
2006-03-05 02:28:19 +01:00
2006-02-05 16:44:38 +01:00
private:
Iterator<Tupel>* it;
Tupel* nexttup;
const char* name;
};
2006-03-05 02:28:19 +01:00
2006-02-02 16:55:44 +01:00
Section(const char* name);
~Section();
bool addTupel(const char* name, const char* option);
2006-04-15 19:55:07 +02:00
const char* getTupelValue(const char* name);
void show();
2006-03-05 02:28:19 +01:00
2006-02-05 16:44:38 +01:00
const char* name;
2006-02-02 16:55:44 +01:00
List<Tupel> tupelList;
};
Section* addSection(const char* name);
2006-04-15 19:55:07 +02:00
Section* getSection(const char* name);
2006-02-02 16:55:44 +01:00
List<Section> sectionList;
};
#endif // _CONFIG_H_