00001
00004 #ifndef RAZORBACK_CONFIG_FILE_H
00005 #define RAZORBACK_CONFIG_FILE_H
00006
00007 #include <razorback/visibility.h>
00008 #include <razorback/types.h>
00009
00010 #ifdef __cplusplus
00011 extern "C" {
00012 #endif
00013
00014 #ifdef _MSC_VER
00015 typedef DWORD conf_int_t;
00016
00017 #else //_MSC_VER
00018 #include <libconfig.h>
00019
00020
00021
00022
00023 #if (((LIBCONFIG_VER_MAJOR == 1) && (LIBCONFIG_VER_MINOR >= 4)) \
00024 || (LIBCONFIG_VER_MAJOR > 1))
00025
00026 typedef int conf_int_t;
00027 #else
00028 typedef long conf_int_t;
00029 #endif
00030
00031 #endif //_MSC_VER
00032
00035 typedef enum
00036 {
00037 RZB_CONF_KEY_TYPE_STRING = 5,
00038 RZB_CONF_KEY_TYPE_INT,
00039 RZB_CONF_KEY_TYPE_PARSED_STRING,
00040 RZB_CONF_KEY_TYPE_UUID,
00041 RZB_CONF_KEY_TYPE_BOOL,
00042 RZB_CONF_KEY_TYPE_ARRAY,
00043 RZB_CONF_KEY_TYPE_LIST,
00044 RZB_CONF_KEY_TYPE_END
00045 } RZB_CONF_KEY_TYPE_t;
00046
00050 typedef struct
00051 {
00052 bool (*parseString) (const char *, conf_int_t *);
00053 } RZBConfCallBack;
00054
00055 struct ConfArray
00056 {
00057 RZB_CONF_KEY_TYPE_t type;
00058 void **data;
00059 conf_int_t *count;
00060 bool (*parseString) (const char *, conf_int_t *);
00061 };
00065 typedef struct
00066 {
00067 const char *key;
00068 RZB_CONF_KEY_TYPE_t type;
00069 void *dest;
00070 void *callback;
00071 } RZBConfKey_t;
00072
00073 struct ConfList
00074 {
00075 void **data;
00076 conf_int_t *count;
00077 RZBConfKey_t *items;
00078 };
00079
00086 SO_PUBLIC extern bool readMyConfig (const char *configDir, const char *configFile,
00087 RZBConfKey_t * config);
00088
00092 SO_PUBLIC extern void rzbConfCleanUp (void);
00093
00094 #ifdef __cplusplus
00095 }
00096 #endif
00097 #endif // RAZORBACK_CONFIG_FILE_H
00098