project_files/frontlib/model/cfg.h
author Medo <smaxein@googlemail.com>
Fri, 15 Jun 2012 19:57:25 +0200
changeset 7230 240620f46dd7
parent 7224 5143861c83bd
child 7271 5608ac657362
permissions -rw-r--r--
Changed frontlib to use the existing ini file formats of the QtFrontend
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
 * Data structures for game scheme information.
038e3415100a Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff changeset
     3
 */
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
#ifndef CFG_H_
038e3415100a Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff changeset
     6
#define CFG_H_
038e3415100a Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff changeset
     7
038e3415100a Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff changeset
     8
#include <stdbool.h>
038e3415100a Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff changeset
     9
7230
240620f46dd7 Changed frontlib to use the existing ini file formats of the QtFrontend
Medo <smaxein@googlemail.com>
parents: 7224
diff changeset
    10
// TODO: cfg/config -> scheme
240620f46dd7 Changed frontlib to use the existing ini file formats of the QtFrontend
Medo <smaxein@googlemail.com>
parents: 7224
diff changeset
    11
7175
038e3415100a Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff changeset
    12
typedef struct {
7230
240620f46dd7 Changed frontlib to use the existing ini file formats of the QtFrontend
Medo <smaxein@googlemail.com>
parents: 7224
diff changeset
    13
    char *name;
7175
038e3415100a Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff changeset
    14
    char *engineCommand;
7230
240620f46dd7 Changed frontlib to use the existing ini file formats of the QtFrontend
Medo <smaxein@googlemail.com>
parents: 7224
diff changeset
    15
    bool maxMeansInfinity;
7175
038e3415100a Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff changeset
    16
    bool times1000;
038e3415100a Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff changeset
    17
    int min;
038e3415100a Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff changeset
    18
    int max;
7230
240620f46dd7 Changed frontlib to use the existing ini file formats of the QtFrontend
Medo <smaxein@googlemail.com>
parents: 7224
diff changeset
    19
    int def;
7175
038e3415100a Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff changeset
    20
} flib_cfg_setting_meta;
038e3415100a Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff changeset
    21
038e3415100a Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff changeset
    22
typedef struct {
7230
240620f46dd7 Changed frontlib to use the existing ini file formats of the QtFrontend
Medo <smaxein@googlemail.com>
parents: 7224
diff changeset
    23
    char *name;
7175
038e3415100a Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff changeset
    24
    int bitmaskIndex;
038e3415100a Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff changeset
    25
} flib_cfg_mod_meta;
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
typedef struct {
7230
240620f46dd7 Changed frontlib to use the existing ini file formats of the QtFrontend
Medo <smaxein@googlemail.com>
parents: 7224
diff changeset
    28
	int _referenceCount;
240620f46dd7 Changed frontlib to use the existing ini file formats of the QtFrontend
Medo <smaxein@googlemail.com>
parents: 7224
diff changeset
    29
	int settingCount;
240620f46dd7 Changed frontlib to use the existing ini file formats of the QtFrontend
Medo <smaxein@googlemail.com>
parents: 7224
diff changeset
    30
	int modCount;
7175
038e3415100a Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff changeset
    31
    flib_cfg_setting_meta *settings;
038e3415100a Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff changeset
    32
    flib_cfg_mod_meta *mods;
038e3415100a Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff changeset
    33
} flib_cfg_meta;
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
typedef struct {
7230
240620f46dd7 Changed frontlib to use the existing ini file formats of the QtFrontend
Medo <smaxein@googlemail.com>
parents: 7224
diff changeset
    36
	int _referenceCount;
240620f46dd7 Changed frontlib to use the existing ini file formats of the QtFrontend
Medo <smaxein@googlemail.com>
parents: 7224
diff changeset
    37
    flib_cfg_meta *meta;
240620f46dd7 Changed frontlib to use the existing ini file formats of the QtFrontend
Medo <smaxein@googlemail.com>
parents: 7224
diff changeset
    38
7175
038e3415100a Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff changeset
    39
    char *schemeName;
038e3415100a Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff changeset
    40
    int *settings;
038e3415100a Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff changeset
    41
    bool *mods;
038e3415100a Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff changeset
    42
} flib_cfg;
038e3415100a Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff changeset
    43
7224
5143861c83bd Cleanup, refactoring and generally more development in the frontlib
Medo <smaxein@googlemail.com>
parents: 7175
diff changeset
    44
/**
7230
240620f46dd7 Changed frontlib to use the existing ini file formats of the QtFrontend
Medo <smaxein@googlemail.com>
parents: 7224
diff changeset
    45
 * Read the meta-configuration from a .ini file (e.g. which settings exist,
7224
5143861c83bd Cleanup, refactoring and generally more development in the frontlib
Medo <smaxein@googlemail.com>
parents: 7175
diff changeset
    46
 * what are their defaults etc.)
5143861c83bd Cleanup, refactoring and generally more development in the frontlib
Medo <smaxein@googlemail.com>
parents: 7175
diff changeset
    47
 *
7230
240620f46dd7 Changed frontlib to use the existing ini file formats of the QtFrontend
Medo <smaxein@googlemail.com>
parents: 7224
diff changeset
    48
 * Returns the meta-configuration or NULL.
7224
5143861c83bd Cleanup, refactoring and generally more development in the frontlib
Medo <smaxein@googlemail.com>
parents: 7175
diff changeset
    49
 */
7230
240620f46dd7 Changed frontlib to use the existing ini file formats of the QtFrontend
Medo <smaxein@googlemail.com>
parents: 7224
diff changeset
    50
flib_cfg_meta *flib_cfg_meta_from_ini(const char *filename);
7175
038e3415100a Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff changeset
    51
7224
5143861c83bd Cleanup, refactoring and generally more development in the frontlib
Medo <smaxein@googlemail.com>
parents: 7175
diff changeset
    52
/**
7230
240620f46dd7 Changed frontlib to use the existing ini file formats of the QtFrontend
Medo <smaxein@googlemail.com>
parents: 7224
diff changeset
    53
 * Increase the reference count of the object. Call this if you store a pointer to it somewhere.
240620f46dd7 Changed frontlib to use the existing ini file formats of the QtFrontend
Medo <smaxein@googlemail.com>
parents: 7224
diff changeset
    54
 * Returns the parameter.
240620f46dd7 Changed frontlib to use the existing ini file formats of the QtFrontend
Medo <smaxein@googlemail.com>
parents: 7224
diff changeset
    55
 */
240620f46dd7 Changed frontlib to use the existing ini file formats of the QtFrontend
Medo <smaxein@googlemail.com>
parents: 7224
diff changeset
    56
flib_cfg_meta *flib_cfg_meta_retain(flib_cfg_meta *metainfo);
240620f46dd7 Changed frontlib to use the existing ini file formats of the QtFrontend
Medo <smaxein@googlemail.com>
parents: 7224
diff changeset
    57
240620f46dd7 Changed frontlib to use the existing ini file formats of the QtFrontend
Medo <smaxein@googlemail.com>
parents: 7224
diff changeset
    58
/**
240620f46dd7 Changed frontlib to use the existing ini file formats of the QtFrontend
Medo <smaxein@googlemail.com>
parents: 7224
diff changeset
    59
 * Decrease the reference count of the object and free it if this was the last reference.
240620f46dd7 Changed frontlib to use the existing ini file formats of the QtFrontend
Medo <smaxein@googlemail.com>
parents: 7224
diff changeset
    60
 */
240620f46dd7 Changed frontlib to use the existing ini file formats of the QtFrontend
Medo <smaxein@googlemail.com>
parents: 7224
diff changeset
    61
void flib_cfg_meta_release(flib_cfg_meta *metainfo);
240620f46dd7 Changed frontlib to use the existing ini file formats of the QtFrontend
Medo <smaxein@googlemail.com>
parents: 7224
diff changeset
    62
240620f46dd7 Changed frontlib to use the existing ini file formats of the QtFrontend
Medo <smaxein@googlemail.com>
parents: 7224
diff changeset
    63
/**
240620f46dd7 Changed frontlib to use the existing ini file formats of the QtFrontend
Medo <smaxein@googlemail.com>
parents: 7224
diff changeset
    64
 * Create a new configuration with everything set to default or false
7224
5143861c83bd Cleanup, refactoring and generally more development in the frontlib
Medo <smaxein@googlemail.com>
parents: 7175
diff changeset
    65
 * Returns NULL on error.
5143861c83bd Cleanup, refactoring and generally more development in the frontlib
Medo <smaxein@googlemail.com>
parents: 7175
diff changeset
    66
 */
7230
240620f46dd7 Changed frontlib to use the existing ini file formats of the QtFrontend
Medo <smaxein@googlemail.com>
parents: 7224
diff changeset
    67
flib_cfg *flib_cfg_create(flib_cfg_meta *meta, const char *schemeName);
240620f46dd7 Changed frontlib to use the existing ini file formats of the QtFrontend
Medo <smaxein@googlemail.com>
parents: 7224
diff changeset
    68
240620f46dd7 Changed frontlib to use the existing ini file formats of the QtFrontend
Medo <smaxein@googlemail.com>
parents: 7224
diff changeset
    69
/**
240620f46dd7 Changed frontlib to use the existing ini file formats of the QtFrontend
Medo <smaxein@googlemail.com>
parents: 7224
diff changeset
    70
 * Create a copy of the scheme. Returns NULL on error or if NULL was passed.
240620f46dd7 Changed frontlib to use the existing ini file formats of the QtFrontend
Medo <smaxein@googlemail.com>
parents: 7224
diff changeset
    71
 */
240620f46dd7 Changed frontlib to use the existing ini file formats of the QtFrontend
Medo <smaxein@googlemail.com>
parents: 7224
diff changeset
    72
flib_cfg *flib_cfg_copy(flib_cfg *cfg);
7224
5143861c83bd Cleanup, refactoring and generally more development in the frontlib
Medo <smaxein@googlemail.com>
parents: 7175
diff changeset
    73
5143861c83bd Cleanup, refactoring and generally more development in the frontlib
Medo <smaxein@googlemail.com>
parents: 7175
diff changeset
    74
/**
7230
240620f46dd7 Changed frontlib to use the existing ini file formats of the QtFrontend
Medo <smaxein@googlemail.com>
parents: 7224
diff changeset
    75
 * Increase the reference count of the object. Call this if you store a pointer to it somewhere.
240620f46dd7 Changed frontlib to use the existing ini file formats of the QtFrontend
Medo <smaxein@googlemail.com>
parents: 7224
diff changeset
    76
 * Returns the parameter.
7224
5143861c83bd Cleanup, refactoring and generally more development in the frontlib
Medo <smaxein@googlemail.com>
parents: 7175
diff changeset
    77
 */
7230
240620f46dd7 Changed frontlib to use the existing ini file formats of the QtFrontend
Medo <smaxein@googlemail.com>
parents: 7224
diff changeset
    78
flib_cfg *flib_cfg_retain(flib_cfg *cfg);
7224
5143861c83bd Cleanup, refactoring and generally more development in the frontlib
Medo <smaxein@googlemail.com>
parents: 7175
diff changeset
    79
5143861c83bd Cleanup, refactoring and generally more development in the frontlib
Medo <smaxein@googlemail.com>
parents: 7175
diff changeset
    80
/**
7230
240620f46dd7 Changed frontlib to use the existing ini file formats of the QtFrontend
Medo <smaxein@googlemail.com>
parents: 7224
diff changeset
    81
 * Decrease the reference count of the object and free it if this was the last reference.
7224
5143861c83bd Cleanup, refactoring and generally more development in the frontlib
Medo <smaxein@googlemail.com>
parents: 7175
diff changeset
    82
 */
7230
240620f46dd7 Changed frontlib to use the existing ini file formats of the QtFrontend
Medo <smaxein@googlemail.com>
parents: 7224
diff changeset
    83
void flib_cfg_release(flib_cfg* cfg);
7175
038e3415100a Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff changeset
    84
038e3415100a Added ini reading/writing for game schemes to the frontend lib
Medo <smaxein@googlemail.com>
parents:
diff changeset
    85
#endif /* CFG_H_ */