project_files/frontlib/util/inihelper.h
author Medo <smaxein@googlemail.com>
Mon, 11 Jun 2012 00:02:17 +0200
changeset 7182 076aba32abd3
parent 7179 f84805e6df03
child 7224 5143861c83bd
permissions -rw-r--r--
Small improvements to the frontend lib for better debugging
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
7175
038e3415100a Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff changeset
     1
/**
038e3415100a Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff changeset
     2
 * Some helper functions for working with the iniparser functions - in particular,
038e3415100a Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff changeset
     3
 * for interoperability with the ini format used by the QtSettings class.
038e3415100a Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff changeset
     4
 */
038e3415100a Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff changeset
     5
038e3415100a Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff changeset
     6
#ifndef INIHELPER_H_
038e3415100a Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff changeset
     7
#define INIHELPER_H_
038e3415100a Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff changeset
     8
038e3415100a Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff changeset
     9
#include "../iniparser/iniparser.h"
7179
f84805e6df03 Implemented game launching API for the frontlib.
Medo <smaxein@googlemail.com>
parents: 7177
diff changeset
    10
7175
038e3415100a Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff changeset
    11
#include <stdbool.h>
038e3415100a Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff changeset
    12
038e3415100a Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff changeset
    13
/**
038e3415100a Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff changeset
    14
 * Returned buffer must be free()d
038e3415100a Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff changeset
    15
 */
038e3415100a Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff changeset
    16
char *inihelper_urlencode(const char *inbuf);
038e3415100a Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff changeset
    17
038e3415100a Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff changeset
    18
/**
038e3415100a Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff changeset
    19
 * Returned buffer must be free()d
038e3415100a Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff changeset
    20
 */
038e3415100a Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff changeset
    21
char *inihelper_urldecode(const char *inbuf);
038e3415100a Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff changeset
    22
038e3415100a Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff changeset
    23
/**
038e3415100a Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff changeset
    24
 * Create a key in the format "sectionName:keyName"
038e3415100a Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff changeset
    25
 * Returned buffer must be free()d
038e3415100a Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff changeset
    26
 */
038e3415100a Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff changeset
    27
char *inihelper_createDictKey(const char *sectionName, const char *keyName);
038e3415100a Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff changeset
    28
038e3415100a Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff changeset
    29
/**
038e3415100a Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff changeset
    30
 * Returns an internal buffer, don't modify or free
038e3415100a Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff changeset
    31
 * Sets error to true if something goes wrong, leaves it unchanged otherwise.
038e3415100a Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff changeset
    32
 */
038e3415100a Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff changeset
    33
char *inihelper_getstring(dictionary *inifile, bool *error, const char *sectionName, const char *keyName);
038e3415100a Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff changeset
    34
038e3415100a Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff changeset
    35
/**
038e3415100a Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff changeset
    36
 * Returned buffer must be free()d
038e3415100a Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff changeset
    37
 * Sets error to true if something goes wrong, leaves it unchanged otherwise.
038e3415100a Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff changeset
    38
 */
038e3415100a Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff changeset
    39
char *inihelper_getstringdup(dictionary *inifile, bool *error, const char *sectionName, const char *keyName);
038e3415100a Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff changeset
    40
038e3415100a Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff changeset
    41
/**
038e3415100a Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff changeset
    42
 * Sets error to true if something goes wrong, leaves it unchanged otherwise.
038e3415100a Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff changeset
    43
 */
038e3415100a Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff changeset
    44
int inihelper_getint(dictionary *inifile, bool *error, const char *sectionName, const char *keyName);
038e3415100a Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff changeset
    45
038e3415100a Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff changeset
    46
/**
038e3415100a Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff changeset
    47
 * Sets error to true if something goes wrong, leaves it unchanged otherwise.
038e3415100a Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff changeset
    48
 */
038e3415100a Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff changeset
    49
bool inihelper_getbool(dictionary *inifile, bool *error, const char *sectionName, const char *keyName);
038e3415100a Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff changeset
    50
038e3415100a Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff changeset
    51
int inihelper_setstr(dictionary *dict, const char *sectionName, const char *keyName, const char *value);
038e3415100a Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff changeset
    52
int inihelper_setint(dictionary *dict, const char *sectionName, const char *keyName, int value);
038e3415100a Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff changeset
    53
int inihelper_setbool(dictionary *dict, const char *sectionName, const char *keyName, bool value);
038e3415100a Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff changeset
    54
#endif /* INIHELPER_H_ */