gmerlin
Main Page
Related Pages
Modules
Data Structures
Files
File List
include
gmerlin
cfg_registry.h
1
/*****************************************************************
2
* gmerlin - a general purpose multimedia framework and applications
3
*
4
* Copyright (c) 2001 - 2012 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
76
bg_cfg_registry_t
*
bg_cfg_registry_create
();
77
83
void
bg_cfg_registry_destroy
(
bg_cfg_registry_t
* reg);
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
163
bg_cfg_section_t
*
bg_cfg_registry_find_section
(
bg_cfg_registry_t
* reg,
164
const
char
* path);
165
175
bg_cfg_section_t
*
bg_cfg_section_find_subsection
(
bg_cfg_section_t
* section,
176
const
char
* name);
177
185
bg_cfg_section_t
*
bg_cfg_section_create_subsection_at_pos
(
bg_cfg_section_t
* section,
186
int
pos);
187
195
void
bg_cfg_section_move_child
(
bg_cfg_section_t
* section,
bg_cfg_section_t
* child,
196
int
pos);
197
198
208
bg_cfg_section_t
*
bg_cfg_section_find_subsection_by_index
(
bg_cfg_section_t
* section,
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
235
bg_cfg_section_t
*
236
bg_cfg_section_create_from_parameters
(
const
char
* name,
237
const
bg_parameter_info_t
* parameters);
238
249
void
bg_cfg_section_create_items
(
bg_cfg_section_t
* section,
250
const
bg_parameter_info_t
* parameters);
251
257
void
bg_cfg_section_destroy
(
bg_cfg_section_t
* section);
258
265
bg_cfg_section_t
*
bg_cfg_section_copy
(
const
bg_cfg_section_t
* src);
266
277
void
bg_cfg_section_transfer
(
bg_cfg_section_t
* src,
bg_cfg_section_t
* dst);
278
285
void
bg_cfg_section_transfer_children
(
bg_cfg_section_t
* src,
bg_cfg_section_t
* dst);
286
293
void
bg_cfg_section_add_ref
(
bg_cfg_section_t
* section,
bg_cfg_section_t
* ref);
294
295
/*
296
* Get/Set section names
297
*/
298
305
const
char
*
bg_cfg_section_get_name
(
bg_cfg_section_t
* section);
306
315
char
*
bg_cfg_section_get_name_translated
(
bg_cfg_section_t
* section);
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
343
void
bg_cfg_section_set_parameter
(
bg_cfg_section_t
* section,
344
const
bg_parameter_info_t
* info,
345
const
bg_parameter_value_t
* value);
346
359
int
bg_cfg_section_set_parameters_from_string
(
bg_cfg_section_t
* section,
360
const
bg_parameter_info_t
* info,
361
const
char
* str);
362
373
void
bg_cfg_section_get_parameter
(
bg_cfg_section_t
* section,
374
const
bg_parameter_info_t
* info,
375
bg_parameter_value_t
* value);
376
385
void
bg_cfg_section_delete_subsection
(
bg_cfg_section_t
* section,
386
bg_cfg_section_t
* subsection);
387
393
void
bg_cfg_section_delete_subsections
(
bg_cfg_section_t
* section);
394
395
396
/*
397
* Type specific get/set functions, which don't require
398
* an info structure
399
*/
400
408
void
bg_cfg_section_set_parameter_int
(
bg_cfg_section_t
* section,
409
const
char
* name,
int
value);
410
418
void
bg_cfg_section_set_parameter_float
(
bg_cfg_section_t
* section,
419
const
char
* name,
float
value);
420
428
void
bg_cfg_section_set_parameter_string
(
bg_cfg_section_t
* section,
429
const
char
* name,
const
char
* value);
430
438
void
bg_cfg_section_set_parameter_time
(
bg_cfg_section_t
* section,
439
const
char
* name,
gavl_time_t
value);
440
441
/* Get parameter values, return 0 if no such entry */
442
451
int
bg_cfg_section_get_parameter_int
(
bg_cfg_section_t
* section,
452
const
char
* name,
int
* value);
453
462
int
bg_cfg_section_get_parameter_float
(
bg_cfg_section_t
* section,
463
const
char
* name,
float
* value);
464
473
int
bg_cfg_section_get_parameter_string
(
bg_cfg_section_t
* section,
474
const
char
* name,
const
char
** value);
475
484
int
bg_cfg_section_get_parameter_time
(
bg_cfg_section_t
* section,
485
const
char
* name,
gavl_time_t
* value);
486
487
488
/* Apply all values found in the parameter info */
489
502
void
bg_cfg_section_apply
(
bg_cfg_section_t
* section,
503
const
bg_parameter_info_t
* parameters,
504
bg_set_parameter_func_t
func,
505
void
* callback_data);
506
518
void
bg_cfg_section_apply_noterminate
(
bg_cfg_section_t
* section,
519
const
bg_parameter_info_t
* infos,
520
bg_set_parameter_func_t
func,
521
void
* callback_data);
522
536
void
bg_cfg_section_get
(
bg_cfg_section_t
* section,
537
const
bg_parameter_info_t
* parameters,
538
bg_get_parameter_func_t
func,
539
void
* callback_data);
540
548
int
bg_cfg_section_has_subsection
(
bg_cfg_section_t
* section,
549
const
char
* name);
550
557
void
bg_cfg_section_restore_defaults
(
bg_cfg_section_t
* section,
558
const
bg_parameter_info_t
* info);
559
560
561
#endif
/* __BG_CFG_REGISTRY_H_ */
Generated by
1.8.2