-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathiniconf.h
38 lines (27 loc) · 973 Bytes
/
iniconf.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
/*
* iniconf.h
*
* Created on: 2014-1-22
* Author: Luo Guochun
*/
#ifndef __INICONF_H__
#define __INICONF_H__
#include "dict.h"
/*this implementation don't care about the performance*/
#define INI_MAX_KEY_LEN 256
#define INI_MAX_VALUE_LEN 1024
#define INI_READ_LINE (INI_MAX_KEY_LEN + INI_MAX_VALUE_LEN + 2)
typedef dict ini_conf_t;
typedef dict ini_sec_t;
int ini_destroy(ini_conf_t* ini);
ini_conf_t* ini_create();
int ini_load(ini_conf_t* ini, const char* file);
int ini_save(ini_conf_t* ini, const char* file);
int ini_dump(ini_conf_t* ini, char* buf, size_t len);
ini_sec_t* ini_insert_sec(ini_conf_t* ini, const char* key);
int ini_delete_sec(ini_conf_t* ini, const char* key);
ini_sec_t* ini_get_sec(ini_conf_t* ini, const char* key);
int ini_insert_val(ini_sec_t* sec, const char* key, const char* val);
int ini_delete_val(ini_sec_t* sec, const char* key);
const char* ini_get_val(ini_sec_t* sec, const char* key);
#endif /* __INICONF_H__ */