actube/src/cw/cfg.h

39 lines
924 B
C
Raw Normal View History

2022-07-31 01:22:11 +02:00
#ifndef _CFG_H
#define _CFG_H
#include <mavl.h>
2022-07-31 09:49:14 +02:00
#define CW_CFG_MAX_KEY_LEN 1024
2022-07-31 01:22:11 +02:00
typedef struct mavl cw_Cfg_t;
2022-07-31 09:49:14 +02:00
cw_Cfg_t * cw_cfg_create();
int cw_cfg_set(cw_Cfg_t *cfg,const char *key, const char *val);
void cw_cfg_dump(cw_Cfg_t *cfg);
int cw_cfg_read_from_file(FILE * file, cw_Cfg_t * cfg);
int cw_cfg_load(const char *filename,cw_Cfg_t * cfg);
struct cw_Cfg_entry{
const char *key;
const char *val;
};
struct cw_Cfg_iter{
struct mavliter it;
const char *base;
};
const char * cw_cfg_get(cw_Cfg_t * cfg, const char *key, const char *def);
const char *cw_cfg_iter_next(struct cw_Cfg_iter *cfi, const char *key);
void cw_cfg_iter_init(cw_Cfg_t * cfg, struct cw_Cfg_iter *cfi, const char *base);
int cw_cfg_get_bool(cw_Cfg_t * cfg, const char * key, const char *def);
uint16_t cw_cfg_get_word(cw_Cfg_t * cfg, char *key, const char * def);
2022-08-09 09:52:30 +02:00
void cw_cfg_set_int(cw_Cfg_t * cfg, const char * key, int val);
2022-07-31 01:22:11 +02:00
#endif