00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef __BG_CFG_REGISTRY_H_
00023 #define __BG_CFG_REGISTRY_H_
00024
00025 #include "parameter.h"
00026
00059 typedef struct bg_cfg_section_s bg_cfg_section_t;
00060
00067 typedef struct bg_cfg_registry_s bg_cfg_registry_t;
00068
00076 bg_cfg_registry_t * bg_cfg_registry_create();
00077
00083 void bg_cfg_registry_destroy(bg_cfg_registry_t * reg);
00084
00085
00086
00093 void bg_cfg_registry_load(bg_cfg_registry_t * reg, const char * filename);
00094
00101 void bg_cfg_registry_save(bg_cfg_registry_t * reg, const char * filename);
00102
00103
00104
00113 void bg_cfg_section_2_xml(bg_cfg_section_t * section, xmlNodePtr xml_section);
00114
00124 void bg_cfg_xml_2_section(xmlDocPtr xml_doc, xmlNodePtr xml_section,
00125 bg_cfg_section_t * section);
00126
00127
00128
00129
00130
00142 bg_cfg_section_t * bg_cfg_registry_find_section(bg_cfg_registry_t * reg,
00143 const char * path);
00144
00154 bg_cfg_section_t * bg_cfg_section_find_subsection(bg_cfg_section_t * section,
00155 const char * name);
00156
00164 bg_cfg_section_t * bg_cfg_section_create_subsection_at_pos(bg_cfg_section_t * section,
00165 int pos);
00166
00174 void bg_cfg_section_move_child(bg_cfg_section_t * section, bg_cfg_section_t * child,
00175 int pos);
00176
00177
00187 bg_cfg_section_t * bg_cfg_section_find_subsection_by_index(bg_cfg_section_t * section,
00188 int index);
00189
00190
00191
00192
00193
00194
00201 bg_cfg_section_t * bg_cfg_section_create(const char * name);
00202
00214 bg_cfg_section_t *
00215 bg_cfg_section_create_from_parameters(const char * name,
00216 const bg_parameter_info_t * parameters);
00217
00228 void bg_cfg_section_create_items(bg_cfg_section_t * section,
00229 const bg_parameter_info_t * parameters);
00230
00236 void bg_cfg_section_destroy(bg_cfg_section_t * section);
00237
00244 bg_cfg_section_t * bg_cfg_section_copy(const bg_cfg_section_t * src);
00245
00253 void bg_cfg_section_restore(bg_cfg_section_t * section, bg_cfg_section_t * section_saved);
00254
00265 void bg_cfg_section_transfer(bg_cfg_section_t * src, bg_cfg_section_t * dst);
00266
00267
00268
00269
00270
00277 const char * bg_cfg_section_get_name(bg_cfg_section_t * section);
00278
00287 char * bg_cfg_section_get_name_translated(bg_cfg_section_t * section);
00288
00297 void bg_cfg_section_set_name(bg_cfg_section_t * section, const char * name,
00298 const char * gettext_domain,
00299 const char * gettext_directory);
00300
00301
00302
00303
00304
00315 void bg_cfg_section_set_parameter(bg_cfg_section_t * section,
00316 const bg_parameter_info_t * info,
00317 const bg_parameter_value_t * value);
00318
00331 int bg_cfg_section_set_parameters_from_string(bg_cfg_section_t * section,
00332 const bg_parameter_info_t * info,
00333 const char * str);
00334
00345 void bg_cfg_section_get_parameter(bg_cfg_section_t * section,
00346 const bg_parameter_info_t * info,
00347 bg_parameter_value_t * value);
00348
00357 void bg_cfg_section_delete_subsection(bg_cfg_section_t * section,
00358 bg_cfg_section_t * subsection);
00359
00360
00361
00362
00363
00364
00365
00373 void bg_cfg_section_set_parameter_int(bg_cfg_section_t * section,
00374 const char * name, int value);
00375
00383 void bg_cfg_section_set_parameter_float(bg_cfg_section_t * section,
00384 const char * name, float value);
00385
00393 void bg_cfg_section_set_parameter_string(bg_cfg_section_t * section,
00394 const char * name, const char * value);
00395
00403 void bg_cfg_section_set_parameter_time(bg_cfg_section_t * section,
00404 const char * name, gavl_time_t value);
00405
00406
00407
00416 int bg_cfg_section_get_parameter_int(bg_cfg_section_t * section,
00417 const char * name, int * value);
00418
00427 int bg_cfg_section_get_parameter_float(bg_cfg_section_t * section,
00428 const char * name, float * value);
00429
00438 int bg_cfg_section_get_parameter_string(bg_cfg_section_t * section,
00439 const char * name, const char ** value);
00440
00449 int bg_cfg_section_get_parameter_time(bg_cfg_section_t * section,
00450 const char * name, gavl_time_t * value);
00451
00452
00453
00454
00467 void bg_cfg_section_apply(bg_cfg_section_t * section,
00468 const bg_parameter_info_t * parameters,
00469 bg_set_parameter_func_t func,
00470 void * callback_data);
00471
00483 void bg_cfg_section_apply_noterminate(bg_cfg_section_t * section,
00484 const bg_parameter_info_t * infos,
00485 bg_set_parameter_func_t func,
00486 void * callback_data);
00487
00501 void bg_cfg_section_get(bg_cfg_section_t * section,
00502 const bg_parameter_info_t * parameters,
00503 bg_get_parameter_func_t func,
00504 void * callback_data);
00505
00513 int bg_cfg_section_has_subsection(bg_cfg_section_t * section,
00514 const char * name);
00515
00516 #endif