21#ifndef __EDELIB_CONFIG_H__
22#define __EDELIB_CONFIG_H__
48typedef list<ConfigEntry*> EntryList;
49typedef list<ConfigEntry*>::iterator EntryListIter;
51typedef list<ConfigSection*> SectionList;
52typedef list<ConfigSection*>::iterator SectionListIter;
114 unsigned int errcode;
115 unsigned int linenum;
116 unsigned int sectnum;
117 ConfigSection* cached;
119 SectionList section_list;
121 ConfigSection* add_section(
const char* section);
122 ConfigSection* find_section(
const char* section);
163 operator bool(
void)
const {
return ((errcode ==
CONF_SUCCESS) ? 1 : 0); }
179 bool get(
const char* section,
const char* key,
char* ret,
unsigned int size);
203 bool get_localized(
const char* section,
const char* key,
char* ret,
unsigned int size);
216 bool get_allocated(
const char* section,
const char* key,
char** ret,
unsigned int& retsize);
227 bool get(
const char* section,
const char* key,
bool& ret,
bool dfl =
false);
238 bool get(
const char* section,
const char* key,
int& ret,
int dfl = 0);
249 bool get(
const char* section,
const char* key,
float& ret,
float dfl = 0);
260 bool get(
const char* section,
const char* key,
long& ret,
long dfl = 0);
271 bool get(
const char* section,
const char* key,
double& ret,
double dfl = 0);
282 bool get(
const char* section,
const char* key,
char& ret,
char dfl = 0);
292 void set(
const char* section,
const char* key,
char* val);
302 void set(
const char* section,
const char* key,
const char* val);
332 void set(
const char* section,
const char* key,
bool val);
342 void set(
const char* section,
const char* key,
int val);
352 void set(
const char* section,
const char* key,
long val);
362 void set(
const char* section,
const char* key,
float val);
372 void set(
const char* section,
const char* key,
double val);
427EDELIB_API
int config_getline(
char** buff,
int* len, FILE* f);
A config file reader.
Definition Config.h:112
bool get(const char *section, const char *key, bool &ret, bool dfl=false)
void set(const char *section, const char *key, float val)
bool exist(const char *section)
void set_localized(const char *section, const char *key, char *val)
bool get_localized(const char *section, const char *key, char *ret, unsigned int size)
const char * strerror(int code)
void set(const char *section, const char *key, double val)
bool get(const char *section, const char *key, long &ret, long dfl=0)
~Config()
Definition Config.h:130
bool get(const char *section, const char *key, double &ret, double dfl=0)
void set(const char *section, const char *key, const char *val)
void set(const char *section, const char *key, bool val)
bool get(const char *section, const char *key, char *ret, unsigned int size)
void set(const char *section, const char *key, int val)
void set(const char *section, const char *key, long val)
bool key_exist(const char *section, const char *key)
unsigned int num_sections(void)
bool get(const char *section, const char *key, char &ret, char dfl=0)
void set_localized(const char *section, const char *key, const char *val)
bool save(const char *fname)
const char * strerror(void)
void set(const char *section, const char *key, char *val)
bool get(const char *section, const char *key, float &ret, float dfl=0)
bool get(const char *section, const char *key, int &ret, int dfl=0)
bool get_allocated(const char *section, const char *key, char **ret, unsigned int &retsize)
bool load(const char *fname)
#define E_DISABLE_CLASS_COPY(klass)
Definition edelib-global.h:161
ConfigErrors
Error codes from Config class.
Definition Config.h:33
@ CONF_ERR_FILE
trouble accessing config file or directory
Definition Config.h:35
@ CONF_ERR_SECTION
requested section was not found
Definition Config.h:37
@ CONF_ERR_BAD
malformed file
Definition Config.h:36
@ CONF_SUCCESS
successful operation
Definition Config.h:34
@ CONF_ERR_MEMORY
memory allocation error
Definition Config.h:39
@ CONF_ERR_NOVALUE
key found, but invalid value associated with it
Definition Config.h:40
@ CONF_ERR_KEY
requested key was not found
Definition Config.h:38