34d7dc684e1f078abf04dcb5e4307cd11fe37a10
[tpg/opendispense2.git] / src / common / config.h
1 /*
2  * OpenDispense2
3  *
4  * This code is published under the terms of the Acess licence.
5  * See the file COPYING for details.
6  *
7  * config.h - Config Header
8  */
9 #ifndef _CONFIG_H_
10 #define _CONFIG_H_
11
12 #include <stdbool.h>    // Because C
13
14 // === HELPER MACROS ===
15 #define _EXPSTR(x)      #x
16 #define EXPSTR(x)       _EXPSTR(x)
17
18 #define ASSERT(cnd) do{if(!(cnd)){fprintf(stderr, "ASSERT failed at "__FILE__":"EXPSTR(__LINE__)" - "EXPSTR(cnd)"\n");exit(-1);}}while(0)
19
20
21
22 // --- Config Database ---
23 extern int      Config_ParseFile(const char *Filename);
24
25 extern void     Config_AddValue(const char *Key, const char *Value);
26
27 extern int      Config_GetValueCount(const char *KeyName);
28 extern const char       *Config_GetValue_Idx(const char *KeyName, int Index);
29
30 extern bool     Config_GetValue_Str(const char *KeyName, const char** ValPtr);
31 extern bool     Config_GetValue_Bool(const char *KeyName, bool* ValPtr);
32 extern bool     Config_GetValue_Int(const char *KeyName, int* ValPtr);
33
34 #endif

UCC git Repository :: git.ucc.asn.au