gmerlin
cfg_registry.h
1 /*****************************************************************
2  * gmerlin - a general purpose multimedia framework and applications
3  *
4  * Copyright (c) 2001 - 2011 Members of the Gmerlin project
5  * gmerlin-general@lists.sourceforge.net
6  * http://gmerlin.sourceforge.net
7  *
8  * This program is free software: you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation, either version 2 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program. If not, see <http://www.gnu.org/licenses/>.
20  * *****************************************************************/
21 
22 #ifndef __BG_CFG_REGISTRY_H_
23 #define __BG_CFG_REGISTRY_H_
24 
25 #include <gmerlin/parameter.h>
26 
59 typedef struct bg_cfg_section_s bg_cfg_section_t;
60 
67 typedef struct bg_cfg_registry_s bg_cfg_registry_t;
68 
77 
84 
85 /* cfg_xml.c */
86 
93 void bg_cfg_registry_load(bg_cfg_registry_t * reg, const char * filename);
94 
101 void bg_cfg_registry_save(bg_cfg_registry_t * reg, const char * filename);
102 
111 int bg_cfg_registry_has_section(bg_cfg_registry_t * reg, const char * name);
112 
113 
114 /* The name and xml tag of the section must be set before */
115 
124 void bg_cfg_section_2_xml(const bg_cfg_section_t * section, xmlNodePtr xml_section);
125 
135 void bg_cfg_xml_2_section(xmlDocPtr xml_doc, xmlNodePtr xml_section,
136  bg_cfg_section_t * section);
137 
146 void bg_cfg_section_dump(bg_cfg_section_t * section, const char * filename);
147 
148 /*
149  * Path looks like "section:subsection:subsubsection"
150  */
151 
164  const char * path);
165 
176  const char * name);
177 
186  int pos);
187 
196  int pos);
197 
198 
209  int index);
210 
211 
212 /*
213  * Create/destroy config sections
214  */
215 
222 bg_cfg_section_t * bg_cfg_section_create(const char * name);
223 
236 bg_cfg_section_create_from_parameters(const char * name,
237  const bg_parameter_info_t * parameters);
238 
250  const bg_parameter_info_t * parameters);
251 
258 
266 
278 
286 
294 
295 /*
296  * Get/Set section names
297  */
298 
305 const char * bg_cfg_section_get_name(bg_cfg_section_t * section);
306 
316 
325 void bg_cfg_section_set_name(bg_cfg_section_t * section, const char * name,
326  const char * gettext_domain,
327  const char * gettext_directory);
328 
329 /*
330  * Get/Set values
331  */
332 
344  const bg_parameter_info_t * info,
345  const bg_parameter_value_t * value);
346 
360  const bg_parameter_info_t * info,
361  const char * str);
362 
374  const bg_parameter_info_t * info,
375  bg_parameter_value_t * value);
376 
386  bg_cfg_section_t * subsection);
387 
394 
395 
396 /*
397  * Type specific get/set functions, which don't require
398  * an info structure
399  */
400 
409  const char * name, int value);
410 
419  const char * name, float value);
420 
429  const char * name, const char * value);
430 
439  const char * name, gavl_time_t value);
440 
441 /* Get parameter values, return 0 if no such entry */
442 
452  const char * name, int * value);
453 
463  const char * name, float * value);
464 
474  const char * name, const char ** value);
475 
485  const char * name, gavl_time_t * value);
486 
487 
488 /* Apply all values found in the parameter info */
489 
503  const bg_parameter_info_t * parameters,
505  void * callback_data);
506 
519  const bg_parameter_info_t * infos,
521  void * callback_data);
522 
536 void bg_cfg_section_get(bg_cfg_section_t * section,
537  const bg_parameter_info_t * parameters,
539  void * callback_data);
540 
549  const char * name);
550 
558  const bg_parameter_info_t * info);
559 
560 
561 #endif /* __BG_CFG_REGISTRY_H_ */