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 <gmerlin/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
00111 int bg_cfg_registry_has_section(bg_cfg_registry_t * r, const char * name);
00112
00113
00114
00115
00124 void bg_cfg_section_2_xml(bg_cfg_section_t * section, xmlNodePtr xml_section);
00125
00135 void bg_cfg_xml_2_section(xmlDocPtr xml_doc, xmlNodePtr xml_section,
00136 bg_cfg_section_t * section);
00137
00146 void bg_cfg_section_dump(bg_cfg_section_t * section, const char * filename);
00147
00148
00149
00150
00151
00163 bg_cfg_section_t * bg_cfg_registry_find_section(bg_cfg_registry_t * reg,
00164 const char * path);
00165
00175 bg_cfg_section_t * bg_cfg_section_find_subsection(bg_cfg_section_t * section,
00176 const char * name);
00177
00185 bg_cfg_section_t * bg_cfg_section_create_subsection_at_pos(bg_cfg_section_t * section,
00186 int pos);
00187
00195 void bg_cfg_section_move_child(bg_cfg_section_t * section, bg_cfg_section_t * child,
00196 int pos);
00197
00198
00208 bg_cfg_section_t * bg_cfg_section_find_subsection_by_index(bg_cfg_section_t * section,
00209 int index);
00210
00211
00212
00213
00214
00215
00222 bg_cfg_section_t * bg_cfg_section_create(const char * name);
00223
00235 bg_cfg_section_t *
00236 bg_cfg_section_create_from_parameters(const char * name,
00237 const bg_parameter_info_t * parameters);
00238
00249 void bg_cfg_section_create_items(bg_cfg_section_t * section,
00250 const bg_parameter_info_t * parameters);
00251
00257 void bg_cfg_section_destroy(bg_cfg_section_t * section);
00258
00265 bg_cfg_section_t * bg_cfg_section_copy(const bg_cfg_section_t * src);
00266
00277 void bg_cfg_section_transfer(bg_cfg_section_t * src, bg_cfg_section_t * dst);
00278
00285 void bg_cfg_section_add_ref(bg_cfg_section_t * s, bg_cfg_section_t * ref);
00286
00287
00288
00289
00290
00297 const char * bg_cfg_section_get_name(bg_cfg_section_t * section);
00298
00307 char * bg_cfg_section_get_name_translated(bg_cfg_section_t * section);
00308
00317 void bg_cfg_section_set_name(bg_cfg_section_t * section, const char * name,
00318 const char * gettext_domain,
00319 const char * gettext_directory);
00320
00321
00322
00323
00324
00335 void bg_cfg_section_set_parameter(bg_cfg_section_t * section,
00336 const bg_parameter_info_t * info,
00337 const bg_parameter_value_t * value);
00338
00351 int bg_cfg_section_set_parameters_from_string(bg_cfg_section_t * section,
00352 const bg_parameter_info_t * info,
00353 const char * str);
00354
00365 void bg_cfg_section_get_parameter(bg_cfg_section_t * section,
00366 const bg_parameter_info_t * info,
00367 bg_parameter_value_t * value);
00368
00377 void bg_cfg_section_delete_subsection(bg_cfg_section_t * section,
00378 bg_cfg_section_t * subsection);
00379
00380
00381
00382
00383
00384
00385
00393 void bg_cfg_section_set_parameter_int(bg_cfg_section_t * section,
00394 const char * name, int value);
00395
00403 void bg_cfg_section_set_parameter_float(bg_cfg_section_t * section,
00404 const char * name, float value);
00405
00413 void bg_cfg_section_set_parameter_string(bg_cfg_section_t * section,
00414 const char * name, const char * value);
00415
00423 void bg_cfg_section_set_parameter_time(bg_cfg_section_t * section,
00424 const char * name, gavl_time_t value);
00425
00426
00427
00436 int bg_cfg_section_get_parameter_int(bg_cfg_section_t * section,
00437 const char * name, int * value);
00438
00447 int bg_cfg_section_get_parameter_float(bg_cfg_section_t * section,
00448 const char * name, float * value);
00449
00458 int bg_cfg_section_get_parameter_string(bg_cfg_section_t * section,
00459 const char * name, const char ** value);
00460
00469 int bg_cfg_section_get_parameter_time(bg_cfg_section_t * section,
00470 const char * name, gavl_time_t * value);
00471
00472
00473
00474
00487 void bg_cfg_section_apply(bg_cfg_section_t * section,
00488 const bg_parameter_info_t * parameters,
00489 bg_set_parameter_func_t func,
00490 void * callback_data);
00491
00503 void bg_cfg_section_apply_noterminate(bg_cfg_section_t * section,
00504 const bg_parameter_info_t * infos,
00505 bg_set_parameter_func_t func,
00506 void * callback_data);
00507
00521 void bg_cfg_section_get(bg_cfg_section_t * section,
00522 const bg_parameter_info_t * parameters,
00523 bg_get_parameter_func_t func,
00524 void * callback_data);
00525
00533 int bg_cfg_section_has_subsection(bg_cfg_section_t * section,
00534 const char * name);
00535
00536 #endif