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 typedef enum 23 { 24 BG_CFG_INT, 25 BG_CFG_FLOAT, 26 BG_CFG_STRING, 27 BG_CFG_STRING_HIDDEN, 28 BG_CFG_COLOR, 29 BG_CFG_TIME, /* int64 */ 30 BG_CFG_POSITION 31 } bg_cfg_type_t; 32 33 typedef struct bg_cfg_item_s bg_cfg_item_t; 34 35 struct bg_cfg_item_s 36 { 37 char * name; 38 bg_parameter_value_t value; 39 bg_cfg_type_t type; 40 struct bg_cfg_item_s * next; 41 }; 42 43 struct bg_cfg_section_s 44 { 45 char * name; 46 char * gettext_domain; 47 char * gettext_directory; 48 49 bg_cfg_item_t * items; 50 51 struct bg_cfg_section_s * next; 52 struct bg_cfg_section_s * children; 53 54 /* References: These are returned as if they were children, 55 but are never saved since they are actually at a different position 56 in the registry */ 57 int num_refs; 58 struct bg_cfg_section_s ** refs; 59 }; 60 61 struct bg_cfg_registry_s 62 { 63 bg_cfg_section_t * sections; 64 65 }; 66 67 /* Create an empty item */ 68 69 bg_cfg_item_t * bg_cfg_item_create_empty(const char * name); 70 71 /* Value can be NULL, then the default is used */ 72 73 bg_cfg_item_t * bg_cfg_item_create(const bg_parameter_info_t *, 74 bg_parameter_value_t * value); 75 76 void bg_cfg_destroy_item(bg_cfg_item_t *); 77 78 79 80 bg_cfg_item_t * bg_cfg_section_find_item(bg_cfg_section_t * section, 81 const bg_parameter_info_t * info); 82 83 bg_cfg_item_t * bg_cfg_item_copy(bg_cfg_item_t * src); 84 void bg_cfg_item_transfer(bg_cfg_item_t * src, bg_cfg_item_t * dst); 85 void bg_cfg_item_to_parameter(bg_cfg_item_t * src, bg_parameter_info_t * info); 86