Typedefs | |
typedef struct bg_cfg_section_s | bg_cfg_section_t |
Configuration section. | |
Functions | |
void | bg_cfg_section_2_xml (bg_cfg_section_t *section, xmlNodePtr xml_section) |
Convert a configuration section into a libxml2 node. | |
void | bg_cfg_xml_2_section (xmlDocPtr xml_doc, xmlNodePtr xml_section, bg_cfg_section_t *section) |
Convert libxml2 node into a configuration section. | |
void | bg_cfg_section_dump (bg_cfg_section_t *section, const char *filename) |
Dump a config section to a file. | |
bg_cfg_section_t * | bg_cfg_section_find_subsection (bg_cfg_section_t *section, const char *name) |
Find a child of a section. | |
bg_cfg_section_t * | bg_cfg_section_create_subsection_at_pos (bg_cfg_section_t *section, int pos) |
Create a subsection at the specified position. | |
void | bg_cfg_section_move_child (bg_cfg_section_t *section, bg_cfg_section_t *child, int pos) |
Move a subsection to the specified position. | |
bg_cfg_section_t * | bg_cfg_section_find_subsection_by_index (bg_cfg_section_t *section, int index) |
Find a child of a section by index. | |
bg_cfg_section_t * | bg_cfg_section_create (const char *name) |
Create an empty config section. | |
bg_cfg_section_t * | bg_cfg_section_create_from_parameters (const char *name, const bg_parameter_info_t *parameters) |
Create a config section from a parameter array. | |
void | bg_cfg_section_create_items (bg_cfg_section_t *section, const bg_parameter_info_t *parameters) |
Create items from a parameter info. | |
void | bg_cfg_section_destroy (bg_cfg_section_t *section) |
Destroy a config section. | |
bg_cfg_section_t * | bg_cfg_section_copy (const bg_cfg_section_t *src) |
Duplicate a configuration section. | |
void | bg_cfg_section_transfer (bg_cfg_section_t *src, bg_cfg_section_t *dst) |
Set values in a configuration section from another section. | |
void | bg_cfg_section_transfer_children (bg_cfg_section_t *src, bg_cfg_section_t *dst) |
Like bg_cfg_section_transfer but acts only on the subsections. | |
void | bg_cfg_section_add_ref (bg_cfg_section_t *s, bg_cfg_section_t *ref) |
Insert a reference to a section as child. | |
const char * | bg_cfg_section_get_name (bg_cfg_section_t *section) |
Get the name of a configuration section. | |
char * | bg_cfg_section_get_name_translated (bg_cfg_section_t *section) |
Get the translated name of a configuration section. | |
void | bg_cfg_section_set_name (bg_cfg_section_t *section, const char *name, const char *gettext_domain, const char *gettext_directory) |
Set the name of a configuration section. | |
void | bg_cfg_section_set_parameter (bg_cfg_section_t *section, const bg_parameter_info_t *info, const bg_parameter_value_t *value) |
Store a value in the section. | |
int | bg_cfg_section_set_parameters_from_string (bg_cfg_section_t *section, const bg_parameter_info_t *info, const char *str) |
Set values from an option string. | |
void | bg_cfg_section_get_parameter (bg_cfg_section_t *section, const bg_parameter_info_t *info, bg_parameter_value_t *value) |
Read a value from the section. | |
void | bg_cfg_section_delete_subsection (bg_cfg_section_t *section, bg_cfg_section_t *subsection) |
Delete a subsection. | |
void | bg_cfg_section_set_parameter_int (bg_cfg_section_t *section, const char *name, int value) |
Store an integer value in a section. | |
void | bg_cfg_section_set_parameter_float (bg_cfg_section_t *section, const char *name, float value) |
Store a float value in a section. | |
void | bg_cfg_section_set_parameter_string (bg_cfg_section_t *section, const char *name, const char *value) |
Store a string value in a section. | |
void | bg_cfg_section_set_parameter_time (bg_cfg_section_t *section, const char *name, gavl_time_t value) |
Store a time value in a section. | |
int | bg_cfg_section_get_parameter_int (bg_cfg_section_t *section, const char *name, int *value) |
Get an integer value from a section. | |
int | bg_cfg_section_get_parameter_float (bg_cfg_section_t *section, const char *name, float *value) |
Get an float value from a section. | |
int | bg_cfg_section_get_parameter_string (bg_cfg_section_t *section, const char *name, const char **value) |
Get an string value from a section. | |
int | bg_cfg_section_get_parameter_time (bg_cfg_section_t *section, const char *name, gavl_time_t *value) |
Get an time value from a section. | |
void | bg_cfg_section_apply (bg_cfg_section_t *section, const bg_parameter_info_t *parameters, bg_set_parameter_func_t func, void *callback_data) |
Send all parameters to a module. | |
void | bg_cfg_section_apply_noterminate (bg_cfg_section_t *section, const bg_parameter_info_t *infos, bg_set_parameter_func_t func, void *callback_data) |
Send all parameters to a module without terminating. | |
void | bg_cfg_section_get (bg_cfg_section_t *section, const bg_parameter_info_t *parameters, bg_get_parameter_func_t func, void *callback_data) |
Get parameters from a module. | |
int | bg_cfg_section_has_subsection (bg_cfg_section_t *section, const char *name) |
Qurey if a child section is available. | |
void | bg_cfg_section_restore_defaults (bg_cfg_section_t *s, const bg_parameter_info_t *info) |
Restore default values of a section. |
They can, however, be used indepentently from a registry as universal data containers.
typedef struct bg_cfg_section_s bg_cfg_section_t |
Configuration section.
Opaque container for configuration data and child sections
void bg_cfg_section_2_xml | ( | bg_cfg_section_t * | section, | |
xmlNodePtr | xml_section | |||
) |
Convert a configuration section into a libxml2 node.
section | Configuration section | |
xml_section | Pointer to the xml node for the section |
void bg_cfg_xml_2_section | ( | xmlDocPtr | xml_doc, | |
xmlNodePtr | xml_section, | |||
bg_cfg_section_t * | section | |||
) |
Convert libxml2 node into a configuration section.
xml_doc | Pointer to the xml document | |
xml_section | Pointer to the xml node for the section | |
section | Configuration section |
void bg_cfg_section_dump | ( | bg_cfg_section_t * | section, | |
const char * | filename | |||
) |
Dump a config section to a file.
section | Configuration section | |
filename | File to write this to |
bg_cfg_section_t* bg_cfg_section_find_subsection | ( | bg_cfg_section_t * | section, | |
const char * | name | |||
) |
Find a child of a section.
section | A configuration section | |
name | name of the subsection |
bg_cfg_section_t* bg_cfg_section_create_subsection_at_pos | ( | bg_cfg_section_t * | section, | |
int | pos | |||
) |
Create a subsection at the specified position.
section | A configuration section | |
pos | Position of the subsection (starting with 0) |
void bg_cfg_section_move_child | ( | bg_cfg_section_t * | section, | |
bg_cfg_section_t * | child, | |||
int | pos | |||
) |
Move a subsection to the specified position.
section | A configuration section | |
child | Subsection to be moved | |
pos | New position of the subsection (starting with 0) |
bg_cfg_section_t* bg_cfg_section_find_subsection_by_index | ( | bg_cfg_section_t * | section, | |
int | index | |||
) |
Find a child of a section by index.
section | A configuration section | |
index | Index (starting with 0) |
bg_cfg_section_t* bg_cfg_section_create | ( | const char * | name | ) |
Create an empty config section.
name | Name |
bg_cfg_section_t* bg_cfg_section_create_from_parameters | ( | const char * | name, | |
const bg_parameter_info_t * | parameters | |||
) |
Create a config section from a parameter array.
name | Name | |
parameters | A parameter array |
void bg_cfg_section_create_items | ( | bg_cfg_section_t * | section, | |
const bg_parameter_info_t * | parameters | |||
) |
Create items from a parameter info.
section | Configuration section | |
parameters | A parameter array |
void bg_cfg_section_destroy | ( | bg_cfg_section_t * | section | ) |
Destroy a config section.
section | Configuration section |
bg_cfg_section_t* bg_cfg_section_copy | ( | const bg_cfg_section_t * | src | ) |
Duplicate a configuration section.
src | Configuration section |
void bg_cfg_section_transfer | ( | bg_cfg_section_t * | src, | |
bg_cfg_section_t * | dst | |||
) |
Set values in a configuration section from another section.
src | Source section | |
dst | Destination section |
void bg_cfg_section_transfer_children | ( | bg_cfg_section_t * | src, | |
bg_cfg_section_t * | dst | |||
) |
Like bg_cfg_section_transfer but acts only on the subsections.
src | Source section | |
dst | Destination section |
void bg_cfg_section_add_ref | ( | bg_cfg_section_t * | s, | |
bg_cfg_section_t * | ref | |||
) |
Insert a reference to a section as child.
src | s | |
dst | Child section to be added as reference |
const char* bg_cfg_section_get_name | ( | bg_cfg_section_t * | section | ) |
Get the name of a configuration section.
section | Configuration section |
char* bg_cfg_section_get_name_translated | ( | bg_cfg_section_t * | section | ) |
Get the translated name of a configuration section.
section | Configuration section |
void bg_cfg_section_set_name | ( | bg_cfg_section_t * | section, | |
const char * | name, | |||
const char * | gettext_domain, | |||
const char * | gettext_directory | |||
) |
Set the name of a configuration section.
section | Configuration section | |
name | The new name | |
gettext_domain | First argument for bindtextdomain() | |
gettext_directory | Second argument for bindtextdomain() |
void bg_cfg_section_set_parameter | ( | bg_cfg_section_t * | section, | |
const bg_parameter_info_t * | info, | |||
const bg_parameter_value_t * | value | |||
) |
Store a value in the section.
section | The configuration section | |
info | The parameter destription | |
value | The value to be stored |
int bg_cfg_section_set_parameters_from_string | ( | bg_cfg_section_t * | section, | |
const bg_parameter_info_t * | info, | |||
const char * | str | |||
) |
Set values from an option string.
section | The configuration section | |
info | The parameter destription | |
str | A string describing the values |
void bg_cfg_section_get_parameter | ( | bg_cfg_section_t * | section, | |
const bg_parameter_info_t * | info, | |||
bg_parameter_value_t * | value | |||
) |
Read a value from the section.
section | The configuration section | |
info | The parameter destription | |
value | The value will be stored here |
void bg_cfg_section_delete_subsection | ( | bg_cfg_section_t * | section, | |
bg_cfg_section_t * | subsection | |||
) |
Delete a subsection.
section | The configuration section | |
subsection | The child section to be deleten |
void bg_cfg_section_set_parameter_int | ( | bg_cfg_section_t * | section, | |
const char * | name, | |||
int | value | |||
) |
Store an integer value in a section.
section | The configuration section | |
name | Name of the entry | |
value | Value to be stored |
void bg_cfg_section_set_parameter_float | ( | bg_cfg_section_t * | section, | |
const char * | name, | |||
float | value | |||
) |
Store a float value in a section.
section | The configuration section | |
name | Name of the entry | |
value | Value to be stored |
void bg_cfg_section_set_parameter_string | ( | bg_cfg_section_t * | section, | |
const char * | name, | |||
const char * | value | |||
) |
Store a string value in a section.
section | The configuration section | |
name | Name of the entry | |
value | Value to be stored |
void bg_cfg_section_set_parameter_time | ( | bg_cfg_section_t * | section, | |
const char * | name, | |||
gavl_time_t | value | |||
) |
Store a time value in a section.
section | The configuration section | |
name | Name of the entry | |
value | Value to be stored |
int bg_cfg_section_get_parameter_int | ( | bg_cfg_section_t * | section, | |
const char * | name, | |||
int * | value | |||
) |
Get an integer value from a section.
section | The configuration section | |
name | Name of the entry | |
value | Returns value |
int bg_cfg_section_get_parameter_float | ( | bg_cfg_section_t * | section, | |
const char * | name, | |||
float * | value | |||
) |
Get an float value from a section.
section | The configuration section | |
name | Name of the entry | |
value | Returns value |
int bg_cfg_section_get_parameter_string | ( | bg_cfg_section_t * | section, | |
const char * | name, | |||
const char ** | value | |||
) |
Get an string value from a section.
section | The configuration section | |
name | Name of the entry | |
value | Returns value |
int bg_cfg_section_get_parameter_time | ( | bg_cfg_section_t * | section, | |
const char * | name, | |||
gavl_time_t * | value | |||
) |
Get an time value from a section.
section | The configuration section | |
name | Name of the entry | |
value | Returns value |
void bg_cfg_section_apply | ( | bg_cfg_section_t * | section, | |
const bg_parameter_info_t * | parameters, | |||
bg_set_parameter_func_t | func, | |||
void * | callback_data | |||
) |
Send all parameters to a module.
section | The configuration section | |
parameters | Parameter array | |
func | Function to be called | |
callback_data | First argument passed to func |
void bg_cfg_section_apply_noterminate | ( | bg_cfg_section_t * | section, | |
const bg_parameter_info_t * | infos, | |||
bg_set_parameter_func_t | func, | |||
void * | callback_data | |||
) |
Send all parameters to a module without terminating.
section | The configuration section | |
infos | Parameter array | |
func | Function to be called | |
callback_data | First argument passed to func |
void bg_cfg_section_get | ( | bg_cfg_section_t * | section, | |
const bg_parameter_info_t * | parameters, | |||
bg_get_parameter_func_t | func, | |||
void * | callback_data | |||
) |
Get parameters from a module.
section | The configuration section | |
parameters | Parameter array | |
func | Function to be called | |
callback_data | First argument passed to func |
int bg_cfg_section_has_subsection | ( | bg_cfg_section_t * | section, | |
const char * | name | |||
) |
Qurey if a child section is available.
section | The configuration section | |
name | Name of the child section |
void bg_cfg_section_restore_defaults | ( | bg_cfg_section_t * | s, | |
const bg_parameter_info_t * | info | |||
) |
Restore default values of a section.
section | The configuration section | |
info | Parameter info |