added some more config file functions for going through each section
This commit is contained in:
parent
2a9e3a7179
commit
5edc9cf9cb
@ -331,6 +331,24 @@ void config_close(config_t config)
|
||||
bfree(config);
|
||||
}
|
||||
|
||||
size_t config_num_sections(config_t config)
|
||||
{
|
||||
return config->sections.num;
|
||||
}
|
||||
|
||||
const char *config_get_section(config_t config, size_t idx)
|
||||
{
|
||||
struct config_section *section;
|
||||
|
||||
if (idx >= config->sections.num)
|
||||
return NULL;
|
||||
|
||||
section = darray_item(sizeof(struct config_section), &config->sections,
|
||||
idx);
|
||||
|
||||
return section->name;
|
||||
}
|
||||
|
||||
static struct config_item *config_find_item(struct darray *sections,
|
||||
const char *section, const char *name)
|
||||
{
|
||||
|
@ -52,6 +52,9 @@ EXPORT int config_open_defaults(config_t config, const char *file);
|
||||
EXPORT int config_save(config_t config);
|
||||
EXPORT void config_close(config_t config);
|
||||
|
||||
EXPORT size_t config_num_sections(config_t config);
|
||||
EXPORT const char *config_get_section(config_t config, size_t idx);
|
||||
|
||||
EXPORT void config_set_string(config_t config, const char *section,
|
||||
const char *name, const char *value);
|
||||
EXPORT void config_set_int(config_t config, const char *section,
|
||||
|
Loading…
x
Reference in New Issue
Block a user