Fork me on GitHub
Loading...
Searching...
No Matches
config.h
Go to the documentation of this file.
1
11#ifndef JANUS_CONFIG_H
12#define JANUS_CONFIG_H
13
14#include <glib.h>
15
27
39
42
45
48
50typedef struct janus_config {
52 gboolean is_jcfg;
54 const char *name;
56 GList *list;
58
59
63janus_config *janus_config_parse(const char *config_file);
67janus_config *janus_config_create(const char *name);
77void janus_config_print_as(janus_config *config, int level);
83int janus_config_save(janus_config *config, const char *folder, const char *filename);
87
92janus_config_item *janus_config_item_create(const char *name, const char *value);
106
116 janus_config_container *parent, janus_config_type type, const char *name);
125 janus_config_container *parent, janus_config_type type, const char *name);
132
146int janus_config_remove(janus_config *config, janus_config_container *parent, const char *name);
147
169
170#endif
int janus_config_remove(janus_config *config, janus_config_container *parent, const char *name)
Remove an existing item with the specific name from a category/array.
Definition config.c:466
janus_config_array * janus_config_array_create(const char *name)
Method to create a new janus_config_array instance.
Definition config.c:350
janus_config_container * janus_config_get_create(janus_config *config, janus_config_container *parent, janus_config_type type, const char *name)
Same as janus_config_get, but creates the element if it doesn't exist.
Definition config.c:409
GList * janus_config_get_items(janus_config *config, janus_config_container *parent)
Helper method to return the list of plain items, either in root or from a parent.
Definition config.c:485
GList * janus_config_get_categories(janus_config *config, janus_config_container *parent)
Helper method to return the list of categories, either in root or from a parent.
Definition config.c:499
janus_config * janus_config_parse(const char *config_file)
Method to parse an INI configuration file.
Definition config.c:178
GList * janus_config_get_arrays(janus_config *config, janus_config_container *parent)
Helper method to return the list of arrays, either in root or from a parent.
Definition config.c:513
janus_config_container * janus_config_search(janus_config *config,...)
Helper method to quickly lookup an item, category, or array.
Definition config.c:414
struct janus_config_container janus_config_container
Generic configuration container (can be an item, a category or an array)
void janus_config_container_destroy(janus_config_container *container)
Helper method to quickly destroy an item, category or array.
Definition config.c:358
int janus_config_add(janus_config *config, janus_config_container *parent, janus_config_container *item)
Add an item/category/array instance to a category or array.
Definition config.c:447
void janus_config_print_as(janus_config *config, int level)
Helper method to print a configuration on the standard output using a different logging level than LO...
Definition config.c:561
void janus_config_print(janus_config *config)
Helper method to print a configuration on the standard output.
Definition config.c:529
janus_config_container * janus_config_get(janus_config *config, janus_config_container *parent, janus_config_type type, const char *name)
Helper method to quickly get an item, category, or array.
Definition config.c:404
janus_config_item * janus_config_item_create(const char *name, const char *value)
Method to create a new janus_config_item instance from name and value.
Definition config.c:330
struct janus_config janus_config
Configuration container.
janus_config_type
Configuration element type.
Definition config.h:17
@ janus_config_type_array
Array.
Definition config.h:25
@ janus_config_type_any
Anything (just for searches)
Definition config.h:19
@ janus_config_type_item
Plain item.
Definition config.h:21
@ janus_config_type_category
Category.
Definition config.h:23
int janus_config_save(janus_config *config, const char *folder, const char *filename)
Helper method to save a configuration to a file.
Definition config.c:648
janus_config_category * janus_config_category_create(const char *name)
Method to create a new janus_config_category instance.
Definition config.c:342
void janus_config_destroy(janus_config *config)
Destroy a configuration container instance.
Definition config.c:700
janus_config * janus_config_create(const char *name)
Method to create a new, empty, configuration.
Definition config.c:318
Generic configuration container (can be an item, a category or an array)
Definition config.h:29
janus_config_type type
Whether this is a category, an item or an array.
Definition config.h:31
const char * value
Value of the item (item only)
Definition config.h:35
GList * list
Linked list of contained items/categories/arrays (category and array only)
Definition config.h:37
const char * name
Name of the item/category/array.
Definition config.h:33
Configuration container.
Definition config.h:50
gboolean is_jcfg
Whether this is a libconfig (jcfg for us) or an INI config.
Definition config.h:52
GList * list
Linked list of items/categories/arrays.
Definition config.h:56
const char * name
Name of the configuration.
Definition config.h:54