OpenCBM
configuration.h
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version
5  * 2 of the License, or (at your option) any later version.
6  *
7  * Copyright 2007 Spiro Trikaliotis
8  *
9 */
10 
21 
24 
45 typedef int opencbm_configuration_enum_sections_callback_t(opencbm_configuration_handle Handle,
46  const char Section[],
47  void * Context);
48 
72 typedef int opencbm_configuration_enum_data_callback_t(opencbm_configuration_handle Handle,
73  const char Section[],
74  const char Entry[],
75  void * Context);
76 
77 extern const char *configuration_get_default_filename(void);
78 extern const char *configuration_get_default_filename_for_install(unsigned int local_install);
79 
80 extern opencbm_configuration_handle opencbm_configuration_open(const char * Filename);
81 extern opencbm_configuration_handle opencbm_configuration_create(const char * Filename);
82 extern int opencbm_configuration_close(opencbm_configuration_handle Handle);
83 extern int opencbm_configuration_flush(opencbm_configuration_handle Handle);
84 extern int opencbm_configuration_get_data(opencbm_configuration_handle Handle, const char Section[], const char Entry[], char ** ReturnBuffer);
85 extern int opencbm_configuration_set_data(opencbm_configuration_handle Handle, const char Section[], const char Entry[], const char Value[]);
86 extern int opencbm_configuration_enum_sections(opencbm_configuration_handle Handle, opencbm_configuration_enum_sections_callback_t Callback, void * Context);
87 extern int opencbm_configuration_enum_data(opencbm_configuration_handle Handle, const char Section[], opencbm_configuration_enum_data_callback_t Callback, void * Context);
int opencbm_configuration_set_data(opencbm_configuration_handle Handle, const char Section[], const char Entry[], const char Value[])
Write/Change data to/in the configuration file.
int opencbm_configuration_enum_data(opencbm_configuration_handle Handle, const char Section[], opencbm_configuration_enum_data_callback_t Callback, void *Context)
Enumerate data in the configuration file.
const char * configuration_get_default_filename(void)
Get the default filename for the configuration file.
int opencbm_configuration_close(opencbm_configuration_handle Handle)
Close the configuration file.
const char * configuration_get_default_filename_for_install(unsigned int local_install)
Get the default filename for the configuration file on installation.
int opencbm_configuration_flush(opencbm_configuration_handle Handle)
Flush the configuration file.
int opencbm_configuration_enum_sections(opencbm_configuration_handle Handle, opencbm_configuration_enum_sections_callback_t Callback, void *Context)
Enumerate sections in the configuration file.
int opencbm_configuration_get_data(opencbm_configuration_handle Handle, const char Section[], const char Entry[], char **ReturnBuffer)
Read data from the configuration file.
int opencbm_configuration_enum_data_callback_t(opencbm_configuration_handle Handle, const char Section[], const char Entry[], void *Context)
Callback type for entry enumeration.
Definition: configuration.h:72
opencbm_configuration_handle opencbm_configuration_create(const char *Filename)
Creates the configuration file for reading and writing.
struct opencbm_configuration_s * opencbm_configuration_handle
Handle to a configuration file.
Definition: configuration.h:23
int opencbm_configuration_enum_sections_callback_t(opencbm_configuration_handle Handle, const char Section[], void *Context)
Callback type for section enumeration.
Definition: configuration.h:45
opencbm_configuration_handle opencbm_configuration_open(const char *Filename)
Open the configuration file.