gmerlin
Modules | Typedefs | Functions
Configuration registry

Modules

 Configuration section
 

Typedefs

typedef struct bg_cfg_registry_s bg_cfg_registry_t
 Configuration registry. More...
 

Functions

bg_cfg_registry_tbg_cfg_registry_create ()
 Create an empty configuration registry. More...
 
void bg_cfg_registry_destroy (bg_cfg_registry_t *reg)
 Destroy configuration registry and free all associated memory. More...
 
void bg_cfg_registry_load (bg_cfg_registry_t *reg, const char *filename)
 Load a configuration registry from an xml- file. More...
 
void bg_cfg_registry_save (bg_cfg_registry_t *reg, const char *filename)
 Save a configuration registry to an xml-file. More...
 
int bg_cfg_registry_has_section (bg_cfg_registry_t *reg, const char *name)
 Check if a registry has a section. More...
 
bg_cfg_section_tbg_cfg_registry_find_section (bg_cfg_registry_t *reg, const char *path)
 Find a section in the registry. More...
 

Detailed Description

This is a registry for configuration data, which stores the configuration of a whole application. Each module has it's own section, sections can have subsections. Inside the section, the configuration is stored as name-value pairs.

You can save a registry in an xml-file and load it again. Furthermore, sections can be attached to GUI-widgets. Special routines are available to copy all values from/to a section by using functions of type bg_set_parameter_func_t and bg_get_parameter_func_t.

Typedef Documentation

typedef struct bg_cfg_registry_s bg_cfg_registry_t

Configuration registry.

Opaque container for configuration sections.

Function Documentation

bg_cfg_registry_t* bg_cfg_registry_create ( )

Create an empty configuration registry.

Returns
A newly allocated and empty registry.

To free the registry, use bg_cfg_registry_destroy.

void bg_cfg_registry_destroy ( bg_cfg_registry_t reg)

Destroy configuration registry and free all associated memory.

Parameters
regA configuration registry.
void bg_cfg_registry_load ( bg_cfg_registry_t reg,
const char *  filename 
)

Load a configuration registry from an xml- file.

Parameters
regA configuration registry.
filenameName of the file
void bg_cfg_registry_save ( bg_cfg_registry_t reg,
const char *  filename 
)

Save a configuration registry to an xml-file.

Parameters
regA configuration registry.
filenameName of the file
int bg_cfg_registry_has_section ( bg_cfg_registry_t reg,
const char *  name 
)

Check if a registry has a section.

Parameters
regA configuration registry.
nameName of the section
Returns
1 if the section is present, 0 else
bg_cfg_section_t* bg_cfg_registry_find_section ( bg_cfg_registry_t reg,
const char *  path 
)

Find a section in the registry.

Parameters
regA configuration registry
pathThe path
Returns
Configuration section

Path looks like "section:subsection:subsubsection". If the section does not exist, an empty section is created (including enevtually missing parent sections).