project_files/frontlib/ini/inihelper.h
changeset 7179 f84805e6df03
parent 7177 bf6cf4dd847a
child 7182 076aba32abd3
equal deleted inserted replaced
7177:bf6cf4dd847a 7179:f84805e6df03
     1 /**
       
     2  * Some helper functions for working with the iniparser functions - in particular,
       
     3  * for interoperability with the ini format used by the QtSettings class.
       
     4  */
       
     5 
       
     6 #ifndef INIHELPER_H_
       
     7 #define INIHELPER_H_
       
     8 
       
     9 #include "../iniparser/iniparser.h"
       
    10 #include <stdbool.h>
       
    11 
       
    12 /**
       
    13  * Returned buffer must be free()d
       
    14  */
       
    15 char *inihelper_urlencode(const char *inbuf);
       
    16 
       
    17 /**
       
    18  * Returned buffer must be free()d
       
    19  */
       
    20 char *inihelper_urldecode(const char *inbuf);
       
    21 
       
    22 /**
       
    23  * Create a key in the format "sectionName:keyName"
       
    24  * Returned buffer must be free()d
       
    25  */
       
    26 char *inihelper_createDictKey(const char *sectionName, const char *keyName);
       
    27 
       
    28 /**
       
    29  * Returns an internal buffer, don't modify or free
       
    30  * Sets error to true if something goes wrong, leaves it unchanged otherwise.
       
    31  */
       
    32 char *inihelper_getstring(dictionary *inifile, bool *error, const char *sectionName, const char *keyName);
       
    33 
       
    34 /**
       
    35  * Returned buffer must be free()d
       
    36  * Sets error to true if something goes wrong, leaves it unchanged otherwise.
       
    37  */
       
    38 char *inihelper_getstringdup(dictionary *inifile, bool *error, const char *sectionName, const char *keyName);
       
    39 
       
    40 /**
       
    41  * Sets error to true if something goes wrong, leaves it unchanged otherwise.
       
    42  */
       
    43 int inihelper_getint(dictionary *inifile, bool *error, const char *sectionName, const char *keyName);
       
    44 
       
    45 /**
       
    46  * Sets error to true if something goes wrong, leaves it unchanged otherwise.
       
    47  */
       
    48 bool inihelper_getbool(dictionary *inifile, bool *error, const char *sectionName, const char *keyName);
       
    49 
       
    50 int inihelper_setstr(dictionary *dict, const char *sectionName, const char *keyName, const char *value);
       
    51 int inihelper_setint(dictionary *dict, const char *sectionName, const char *keyName, int value);
       
    52 int inihelper_setbool(dictionary *dict, const char *sectionName, const char *keyName, bool value);
       
    53 #endif /* INIHELPER_H_ */