#include <Fl_Config.h>
Inheritance diagram for Fl_Config:
Public Types | |
enum | ConfigType { USER = 1, SYSTEM } |
Config file modes. More... | |
Public Methods | |
Fl_Config (const char *vendor, const char *application, int mode=USER) | |
Creates/reads/writes app specific config file. More... | |
Fl_Config (const char *filename, bool readfile=true, bool createfile=true) | |
Access custom file in filesystem. More... | |
virtual | ~Fl_Config () |
Destroys config. | |
bool | read_file (bool create=true) |
(re)read file. More... | |
bool | flush () |
Flush entries to file. More... | |
const Fl_String & | filename () const |
Returns current filename. | |
void | filename (const char *filename) |
Set new filename. More... | |
void | filename (const Fl_String &filename) |
Set new filename. More... | |
const Fl_String & | vendor () const |
Returns current vendor name. | |
void | vendor (const char *vendor) |
Set new vendor name. | |
void | vendor (const Fl_String &vendor) |
Set new vendor name. | |
const Fl_String & | application () const |
Returns current application name. | |
void | application (const char *app) |
Set new application name. | |
void | application (const Fl_String &app) |
Set new application name. | |
bool | is_changed () const |
Returns true, if data changed. More... | |
void | set_changed () |
Set changed, forces flush() to write file. More... | |
int | error () const |
Returns last error happened. | |
void | reset_error () |
Reset error, normally you don't need to call this. | |
const char * | strerror () const |
Return string presentation for last happened error. | |
Fl_Config_Section * | create_section (const char *path) |
Create new section. More... | |
Fl_Config_Section * | create_section (const Fl_String &path) |
Create new section. More... | |
Fl_Config_Section * | find_section (const char *path, bool perfect_match=true) const |
Find section. More... | |
Fl_Config_Sections * | section_list (const char *secpath) const |
Return child sections of section specified 'secpath'. | |
Fl_Config_Lines * | line_list (const char *secpath) const |
Return entries of section specified 'secpath'. | |
void | set_section (const char *secpath) |
Set default section for read/write operations. More... | |
void | set_section (Fl_Config_Section *sec) |
Set default section for read/write operations. | |
void | remove_key (const char *section, const char *key) |
Remove entry associated with 'key' from section. More... | |
void | remove_sec (const char *section) |
Remove section specified by 'section'. More... | |
int | read (const char *key, Fl_String &ret, const char *def_value) |
Read Fl_String entry from config. More... | |
int | read (const char *key, char *ret, const char *def_value, int size) |
Read char* entry from config. More... | |
int | read (const char *key, char *&ret, const char *def_value=0) |
Read char* entry from config. More... | |
int | read (const char *key, long &ret, long def_value=0) |
Read long entry from config. More... | |
int | read (const char *key, int &ret, int def_value=0) |
Read int entry from config. More... | |
int | read (const char *key, float &ret, float def_value=0) |
Read float entry from config. More... | |
int | read (const char *key, double &ret, double def_value=0) |
Read double entry from config. More... | |
int | read (const char *key, bool &ret, bool def_value=0) |
Read bool entry from config. More... | |
int | read (const char *key, Fl_Color &ret, Fl_Color def_value=0) |
Read Fl_Color entry from config. More... | |
int | write (const char *key, const Fl_String &value) |
Write Fl_String entry to config. More... | |
int | write (const char *key, const char *value) |
Write const char* entry to config. More... | |
int | write (const char *key, const long value) |
Write long entry to config. More... | |
int | write (const char *key, const int value) |
Write int entry to config. More... | |
int | write (const char *key, const float value) |
Write float entry to config. More... | |
int | write (const char *key, const double value) |
Write double entry to config. More... | |
int | write (const char *key, const bool value) |
Write bool entry to config. More... | |
int | write (const char *key, const Fl_Color value) |
Write Fl_Color entry to config. More... | |
int | get (const char *section, const char *key, Fl_String &ret, const char *def_value) |
Read Fl_String entry from config. More... | |
int | get (const char *section, const char *key, char *ret, const char *def_value, int size) |
Read char* entry from config. More... | |
int | get (const char *section, const char *key, char *&ret, const char *def_value=0) |
Read char* entry from config. More... | |
int | get (const char *section, const char *key, long &ret, long def_value=0) |
Read long entry from config. More... | |
int | get (const char *section, const char *key, int &ret, int def_value=0) |
Read int entry from config. More... | |
int | get (const char *section, const char *key, float &ret, float def_value=0) |
Read float entry from config. More... | |
int | get (const char *section, const char *key, double &ret, double def_value=0) |
Read double entry from config. More... | |
int | get (const char *section, const char *key, bool &ret, bool def_value=0) |
Read bool entry from config. More... | |
int | get (const char *section, const char *key, Fl_Color &ret, Fl_Color def_value=0) |
Read Fl_Color entry from config. More... | |
int | set (const char *section, const char *key, const Fl_String &value) |
Write Fl_String entry to config. More... | |
int | set (const char *section, const char *key, const char *value) |
Write const char *entry to config. More... | |
int | set (const char *section, const char *key, const long value) |
Write long entry to config. More... | |
int | set (const char *section, const char *key, const int value) |
Write int entry to config. More... | |
int | set (const char *section, const char *key, const float value) |
Write float entry to config. More... | |
int | set (const char *section, const char *key, const bool value) |
Write bool entry to config. More... | |
int | set (const char *section, const char *key, const Fl_Color value) |
Write Fl_Color entry to config. More... | |
Static Public Methods | |
char * | find_config_file (const char *filename, bool create=true, int mode=USER) |
Finds config file, depending on mode. More... | |
const char * | strerror (int errnum) |
Return error string, associated with 'errnum'. |
This class maybe used very easily to store application settings to file. Either system wide or user specific, depending on config type. Fl_Config is derived Fl_Config_Section, please take look a look at functions it provides also.
Definition at line 149 of file Fl_Config.h.
|
Config file modes.
Definition at line 155 of file Fl_Config.h. |
|
Creates/reads/writes app specific config file.
LINUX:
Location depends on ConfigType 'mode', USER or SYSTEM
|
|
Access custom file in filesystem.
|
|
Create new section. You can pass full path as section name. For example: create_section("/path/to/my/section"); All nested sections are created automatically. Returns pointer to created section, NULL if failed. |
|
Create new section. You can pass full path as section name. For example: create_section("/path/to/my/section"); All nested sections are created automatically. Returns pointer to created section, NULL if failed. Definition at line 287 of file Fl_Config.h. |
|
Set new filename. You need to call read_file() to get new entries. Definition at line 231 of file Fl_Config.h. |
|
Set new filename. You need to call read_file() to get new entries. Definition at line 229 of file Fl_Config.h. |
|
Finds config file, depending on mode. NOTE: User MUST NOT free returned pointer!
LINUX:
|
|
Find section. You can pass full path as section name. For example: find_section("/path/to/my/section"); Returns pointer to found section, NULL if not found.
|
|
Flush entries to file. Returns true on success.
|
|
Read Fl_Color entry from config. Returns CONF_SUCCESS on success, otherwise errorcode. NOTE: section must be set as first parameter!
Definition at line 633 of file Fl_Config.h. |
|
Read bool entry from config. Returns CONF_SUCCESS on success, otherwise errorcode. NOTE: section must be set as first parameter!
Definition at line 621 of file Fl_Config.h. |
|
Read double entry from config. Returns CONF_SUCCESS on success, otherwise errorcode. NOTE: section must be set as first parameter!
Definition at line 609 of file Fl_Config.h. |
|
Read float entry from config. Returns CONF_SUCCESS on success, otherwise errorcode. NOTE: section must be set as first parameter!
Definition at line 597 of file Fl_Config.h. |
|
Read int entry from config. Returns CONF_SUCCESS on success, otherwise errorcode. NOTE: section must be set as first parameter!
Definition at line 585 of file Fl_Config.h. |
|
Read long entry from config. Returns CONF_SUCCESS on success, otherwise errorcode. NOTE: section must be set as first parameter!
Definition at line 573 of file Fl_Config.h. |
|
Read char* entry from config. Returns CONF_SUCCESS on success, otherwise errorcode. NOTE: 'ret' is allocated by Fl_Confing, user MUST free 'ret' by calling free() function. NOTE: section must be set as first parameter!
Definition at line 561 of file Fl_Config.h. |
|
Read char* entry from config. Returns CONF_SUCCESS on success, otherwise errorcode. NOTE: section must be set as first parameter!
Definition at line 548 of file Fl_Config.h. |
|
Read Fl_String entry from config. Returns CONF_SUCCESS on success, otherwise errorcode. NOTE: section must be set as first parameter!
Definition at line 536 of file Fl_Config.h. |
|
Returns true, if data changed. call flush() to sync changes to file
Definition at line 252 of file Fl_Config.h. |
|
Read Fl_Color entry from config. Returns CONF_SUCCESS on success, otherwise errorcode. NOTE: This function assumes that current section is set with set_section().
Definition at line 442 of file Fl_Config.h. |
|
Read bool entry from config. Returns CONF_SUCCESS on success, otherwise errorcode. NOTE: This function assumes that current section is set with set_section().
Definition at line 431 of file Fl_Config.h. |
|
Read double entry from config. Returns CONF_SUCCESS on success, otherwise errorcode. NOTE: This function assumes that current section is set with set_section().
Definition at line 420 of file Fl_Config.h. |
|
Read float entry from config. Returns CONF_SUCCESS on success, otherwise errorcode. NOTE: This function assumes that current section is set with set_section().
Definition at line 409 of file Fl_Config.h. |
|
Read int entry from config. Returns CONF_SUCCESS on success, otherwise errorcode. NOTE: This function assumes that current section is set with set_section().
Definition at line 398 of file Fl_Config.h. |
|
Read long entry from config. Returns CONF_SUCCESS on success, otherwise errorcode. NOTE: This function assumes that current section is set with set_section().
Definition at line 387 of file Fl_Config.h. |
|
Read char* entry from config. Returns CONF_SUCCESS on success, otherwise errorcode. NOTE: 'ret' is allocated by Fl_Confing, user MUST free 'ret' by calling free() function. NOTE: This function assumes that current section is set with set_section().
Definition at line 376 of file Fl_Config.h. |
|
Read char* entry from config. Returns CONF_SUCCESS on success, otherwise errorcode. NOTE: This function assumes that current section is set with set_section().
Definition at line 364 of file Fl_Config.h. |
|
Read Fl_String entry from config. Returns CONF_SUCCESS on success, otherwise errorcode. NOTE: This function assumes that current section is set with set_section().
Definition at line 352 of file Fl_Config.h. |
|
(re)read file. NOTE: Deletes current entries from this Fl_Config object.
|
|
Remove entry associated with 'key' from section. NOTE: You can pass path to section e.g "/path/to/my/section" |
|
Remove section specified by 'section'. NOTE: You can pass path to section e.g "/path/to/my/section" |
|
Write Fl_Color entry to config. You must call flush() to sunc changes to file. Returns CONF_SUCCESS on success, otherwise errorcode. NOTE: section must be set as first parameter!
Definition at line 711 of file Fl_Config.h. |
|
Write bool entry to config. You must call flush() to sunc changes to file. Returns CONF_SUCCESS on success, otherwise errorcode. NOTE: section must be set as first parameter!
Definition at line 700 of file Fl_Config.h. |
|
Write float entry to config. You must call flush() to sunc changes to file. Returns CONF_SUCCESS on success, otherwise errorcode. NOTE: section must be set as first parameter!
Definition at line 689 of file Fl_Config.h. |
|
Write int entry to config. You must call flush() to sunc changes to file. Returns CONF_SUCCESS on success, otherwise errorcode. NOTE: section must be set as first parameter!
Definition at line 678 of file Fl_Config.h. |
|
Write long entry to config. You must call flush() to sunc changes to file. Returns CONF_SUCCESS on success, otherwise errorcode. NOTE: section must be set as first parameter!
Definition at line 667 of file Fl_Config.h. |
|
Write const char *entry to config. You must call flush() to sunc changes to file. Returns CONF_SUCCESS on success, otherwise errorcode. NOTE: section must be set as first parameter!
Definition at line 656 of file Fl_Config.h. |
|
Write Fl_String entry to config. You must call flush() to sunc changes to file. Returns CONF_SUCCESS on success, otherwise errorcode. NOTE: section must be set as first parameter!
Definition at line 645 of file Fl_Config.h. |
|
Set changed, forces flush() to write file. Even if it is not changed. Definition at line 258 of file Fl_Config.h. |
|
Set default section for read/write operations.
NOTE: section is created, if it's not found. Definition at line 323 of file Fl_Config.h. |
|
Write Fl_Color entry to config. You must call flush() to sunc changes to file. Returns CONF_SUCCESS on success, otherwise errorcode. NOTE: This function assumes that current section is set with set_section().
Definition at line 523 of file Fl_Config.h. |
|
Write bool entry to config. You must call flush() to sunc changes to file. Returns CONF_SUCCESS on success, otherwise errorcode. NOTE: This function assumes that current section is set with set_section().
Definition at line 513 of file Fl_Config.h. |
|
Write double entry to config. You must call flush() to sunc changes to file. Returns CONF_SUCCESS on success, otherwise errorcode. NOTE: This function assumes that current section is set with set_section().
Definition at line 503 of file Fl_Config.h. |
|
Write float entry to config. You must call flush() to sunc changes to file. Returns CONF_SUCCESS on success, otherwise errorcode. NOTE: This function assumes that current section is set with set_section().
Definition at line 493 of file Fl_Config.h. |
|
Write int entry to config. You must call flush() to sunc changes to file. Returns CONF_SUCCESS on success, otherwise errorcode. NOTE: This function assumes that current section is set with set_section().
Definition at line 483 of file Fl_Config.h. |
|
Write long entry to config. You must call flush() to sunc changes to file. Returns CONF_SUCCESS on success, otherwise errorcode. NOTE: This function assumes that current section is set with set_section().
Definition at line 473 of file Fl_Config.h. |
|
Write const char* entry to config. You must call flush() to sunc changes to file. Returns CONF_SUCCESS on success, otherwise errorcode. NOTE: This function assumes that current section is set with set_section().
Definition at line 463 of file Fl_Config.h. |
|
Write Fl_String entry to config. You must call flush() to sunc changes to file. Returns CONF_SUCCESS on success, otherwise errorcode. NOTE: This function assumes that current section is set with set_section().
Definition at line 453 of file Fl_Config.h. |