Configuration File object.
More...
|
GF_Config * | gf_cfg_new (const char *filePath, const char *fileName) |
| configuration file constructor More...
|
|
GF_Config * | gf_cfg_force_new (const char *filePath, const char *fileName) |
| alternative configuration file constructor More...
|
|
void | gf_cfg_del (GF_Config *cfgFile) |
| configuration file destructor More...
|
|
void | gf_cfg_remove (GF_Config *cfgFile) |
| configuration file destructor More...
|
|
GF_Err | gf_cfg_save (GF_Config *cfgFile) |
| configuration saving More...
|
|
const char * | gf_cfg_get_key (GF_Config *cfgFile, const char *secName, const char *keyName) |
| key value query More...
|
|
GF_Err | gf_cfg_set_key (GF_Config *cfgFile, const char *secName, const char *keyName, const char *keyValue) |
| key value update More...
|
|
u32 | gf_cfg_get_section_count (GF_Config *cfgFile) |
| section count query More...
|
|
const char * | gf_cfg_get_section_name (GF_Config *cfgFile, u32 secIndex) |
| section name query More...
|
|
u32 | gf_cfg_get_key_count (GF_Config *cfgFile, const char *secName) |
| key count query More...
|
|
const char * | gf_cfg_get_key_name (GF_Config *cfgFile, const char *secName, u32 keyIndex) |
| key count query More...
|
|
void | gf_cfg_del_section (GF_Config *cfgFile, const char *secName) |
| section destrouction More...
|
|
const char * | gf_cfg_get_filename (GF_Config *iniFile) |
|
GF_Err | gf_cfg_discard_changes (GF_Config *iniFile) |
|
This section documents the configuration file objects of the GPAC framework. A specific global configuration file is used for libgpac, see Library configuration. Such objects may be used by third-party applications to store data, and are used by the player scripting API to store various GUI data. A configuration file is formatted as the INI file mode of WIN32 in sections and keys.
[Section1]
Key1=foo
Key2=bar
[Section2]
Key1=@multiline
for
some
reason@
Key3=2
◆ GF_Config
configuration file object
◆ gf_cfg_new()
GF_Config* gf_cfg_new |
( |
const char * |
filePath, |
|
|
const char * |
fileName |
|
) |
| |
Constructs a configuration file.
- Parameters
-
filePath | directory the file is located in |
fileName | name of the configuration file |
- Returns
- the configuration file object, NULL if the file does not exist
◆ gf_cfg_force_new()
GF_Config* gf_cfg_force_new |
( |
const char * |
filePath, |
|
|
const char * |
fileName |
|
) |
| |
Constructs a configuration file. If file does not exist, configuration will be still created
- Parameters
-
filePath | directory the file is located in |
fileName | name of the configuration file |
- Returns
- the configuration file object, never NULL, even if file does not exist
◆ gf_cfg_del()
Destroys the configuration file and saves it if needed.
- Parameters
-
cfgFile | the target configuration file |
◆ gf_cfg_remove()
Destroys the configuration file and removes the file from disk.
- Parameters
-
cfgFile | the target configuration file |
◆ gf_cfg_save()
Saves the configuration file if modified.
- Parameters
-
cfgFile | the target configuration file |
- Returns
- error if any
◆ gf_cfg_get_key()
const char* gf_cfg_get_key |
( |
GF_Config * |
cfgFile, |
|
|
const char * |
secName, |
|
|
const char * |
keyName |
|
) |
| |
Gets a key value from its section and name.
- Parameters
-
cfgFile | the target configuration file |
secName | the desired key parent section name |
keyName | the desired key name |
- Returns
- the desired key value if found, NULL otherwise.
◆ gf_cfg_set_key()
GF_Err gf_cfg_set_key |
( |
GF_Config * |
cfgFile, |
|
|
const char * |
secName, |
|
|
const char * |
keyName, |
|
|
const char * |
keyValue |
|
) |
| |
Sets a key value from its section and name.
- Parameters
-
cfgFile | the target configuration file |
secName | the desired key parent section name |
keyName | the desired key name |
keyValue | the desired key value |
- Note
- this will also create both section and key if they are not found in the configuration file
- Returns
- error if any
◆ gf_cfg_get_section_count()
Gets the number of sections in the configuration file
- Parameters
-
cfgFile | the target configuration file |
- Returns
- the number of sections
◆ gf_cfg_get_section_name()
const char* gf_cfg_get_section_name |
( |
GF_Config * |
cfgFile, |
|
|
u32 |
secIndex |
|
) |
| |
Gets a section name based on its index
- Parameters
-
cfgFile | the target configuration file |
secIndex | 0-based index of the section to query |
- Returns
- the section name if found, NULL otherwise
◆ gf_cfg_get_key_count()
u32 gf_cfg_get_key_count |
( |
GF_Config * |
cfgFile, |
|
|
const char * |
secName |
|
) |
| |
Gets the number of keys in a section of the configuration file
- Parameters
-
cfgFile | the target configuration file |
secName | the target section |
- Returns
- the number of keys in the section
◆ gf_cfg_get_key_name()
const char* gf_cfg_get_key_name |
( |
GF_Config * |
cfgFile, |
|
|
const char * |
secName, |
|
|
u32 |
keyIndex |
|
) |
| |
Gets the number of keys in a section of the configuration file
- Parameters
-
cfgFile | the target configuration file |
secName | the target section |
keyIndex | 0-based index of the key in the section |
- Returns
- the key name if found, NULL otherwise
◆ gf_cfg_del_section()
void gf_cfg_del_section |
( |
GF_Config * |
cfgFile, |
|
|
const char * |
secName |
|
) |
| |
Removes all entries in the given section
- Parameters
-
cfgFile | the target configuration file |
secName | the target section |
◆ gf_cfg_get_filename()
const char* gf_cfg_get_filename |
( |
GF_Config * |
iniFile | ) |
|
Get the full filename associated with this config file
- Parameters
-
- Returns
- the associated filename
◆ gf_cfg_discard_changes()
Do not save results to file
- Parameters
-
- Returns
- error code