OSDN Git Service

add tstools.
[rec10/rec10-git.git] / tstools / DtsEdit / src / gpac / config_file.h
1 /*\r
2  *                      GPAC - Multimedia Framework C SDK\r
3  *\r
4  *                      Copyright (c) Jean Le Feuvre 2000-2005 \r
5  *                                      All rights reserved\r
6  *\r
7  *  This file is part of GPAC / common tools sub-project\r
8  *\r
9  *  GPAC is free software; you can redistribute it and/or modify\r
10  *  it under the terms of the GNU Lesser General Public License as published by\r
11  *  the Free Software Foundation; either version 2, or (at your option)\r
12  *  any later version.\r
13  *   \r
14  *  GPAC is distributed in the hope that it will be useful,\r
15  *  but WITHOUT ANY WARRANTY; without even the implied warranty of\r
16  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
17  *  GNU Lesser General Public License for more details.\r
18  *   \r
19  *  You should have received a copy of the GNU Lesser General Public\r
20  *  License along with this library; see the file COPYING.  If not, write to\r
21  *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. \r
22  *\r
23  */\r
24 \r
25 #ifndef _GF_CONFIG_FILE_H_\r
26 #define _GF_CONFIG_FILE_H_\r
27 \r
28 #ifdef __cplusplus\r
29 extern "C" {\r
30 #endif\r
31 \r
32 /*!\r
33  *      \file <gpac/config_file.h>\r
34  *      \brief configuration file functions.\r
35  */\r
36 \r
37  /*!\r
38  *      \addtogroup cfg_grp configuration\r
39  *      \ingroup utils_grp\r
40  *      \brief Configuration File object\r
41  *\r
42  *      This section documents the configuration file object of the GPAC framework.\r
43  *      This file is formatted as the INI file mode of WIN32 in sections and keys.\n\r
44  *\note For more information on the GPAC configuration file itself, please refer to the GPAC configuration help provided with GPAC.\r
45  *      @{\r
46  */\r
47 \r
48 #include <gpac/tools.h>\r
49 \r
50 \r
51 typedef struct __tag_config GF_Config;\r
52 \r
53 /*!\r
54  *      \brief configuration file constructor\r
55  *\r
56  *Constructs a configuration file\r
57  *\param filePath directory the file is located in\r
58  *\param fileName name of the configuration file\r
59  *\return the configuration file object\r
60  */\r
61 GF_Config *gf_cfg_new(const char *filePath, const char *fileName);\r
62 /*!\r
63  *      \brief configuration file destructor\r
64  *\r
65  *Destroys the configuration file and saves it if needed.\r
66  *\param cfgFile the target configuration file\r
67  */\r
68 void gf_cfg_del(GF_Config *cfgFile);\r
69 /*!\r
70  *      \brief configuration saving\r
71  *\r
72  *Saves the configuration file if modified.\r
73  *\param cfgFile the target configuration file\r
74  */\r
75 GF_Err gf_cfg_save(GF_Config *iniFile);\r
76 /*!\r
77  *      \brief key value query\r
78  *\r
79  *Gets a key value from its section and name.\r
80  *\param cfgFile the target configuration file\r
81  *\param secName the desired key parent section name\r
82  *\param keyName the desired key name\r
83  *\return the desired key value if found, NULL otherwise.\r
84  */\r
85 const char *gf_cfg_get_key(GF_Config *cfgFile, const char *secName, const char *keyName);\r
86 /*!\r
87  *      \brief key value update\r
88  *\r
89  *Sets a key value from its section and name.\r
90  *\param cfgFile the target configuration file\r
91  *\param secName the desired key parent section name\r
92  *\param keyName the desired key name\r
93  *\param keyValue the desired key value\r
94  *\note this will also create both section and key if they are not found in the configuration file\r
95  */\r
96 GF_Err gf_cfg_set_key(GF_Config *cfgFile, const char *secName, const char *keyName, const char *keyValue);\r
97 /*!\r
98  *      \brief section count query\r
99  *\r
100  *Gets the number of sections in the configuration file\r
101  *\param cfgFile the target configuration file\r
102  *\return the number of sections\r
103  */\r
104 u32 gf_cfg_get_section_count(GF_Config *cfgFile);\r
105 /*!\r
106  *      \brief section name query\r
107  *\r
108  *Gets a section name based on its index\r
109  *\param cfgFile the target configuration file\r
110  *\param secIndex 0-based index of the section to query\r
111  *\return the section name if found, NULL otherwise\r
112  */\r
113 const char *gf_cfg_get_section_name(GF_Config *cfgFile, u32 secIndex);\r
114 /*!\r
115  *      \brief key count query\r
116  *\r
117  *Gets the number of keys in a section of the configuration file\r
118  *\param cfgFile the target configuration file\r
119  *\param secName the target section\r
120  *\return the number of keys in the section\r
121  */\r
122 u32 gf_cfg_get_key_count(GF_Config *cfgFile, const char *secName);\r
123 /*!\r
124  *      \brief key count query\r
125  *\r
126  *Gets the number of keys in a section of the configuration file\r
127  *\param cfgFile the target configuration file\r
128  *\param secName the target section\r
129  *\param keyIndex 0-based index of the key in the section\r
130  *\return the key name if found, NULL otherwise\r
131  */\r
132 const char *gf_cfg_get_key_name(GF_Config *cfgFile, const char *secName, u32 keyIndex);\r
133 \r
134 /*!\r
135  *      \brief key insertion\r
136  *\r
137  *Inserts a new key in a given section. Returns an error if a key with the given name \r
138  *already exists in the section\r
139  *\param cfgFile the target configuration file\r
140  *\param secName the target section\r
141  *\param keyName the name of the target key\r
142  *\param keyValue the value for the new key\r
143  *\param index the 0-based index position of the new key\r
144  */\r
145 GF_Err gf_cfg_insert_key(GF_Config *cfgFile, const char *secName, const char *keyName, const char *keyValue, u32 index);\r
146 \r
147 /*!\r
148  *      \brief section destrouction\r
149  *\r
150  *Removes all entries in the given section\r
151  *\param cfgFile the target configuration file\r
152  *\param secName the target section\r
153  */\r
154 void gf_cfg_del_section(GF_Config *cfgFile, const char *secName);\r
155 \r
156 /*! @} */\r
157 \r
158 \r
159 #ifdef __cplusplus\r
160 }\r
161 #endif\r
162 \r
163 \r
164 #endif          /*_GF_CONFIG_FILE_H_*/\r
165 \r