entitiesdef.h
Go to the documentation of this file.00001
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #ifndef ENITIESDEF_H
00029 # define ENITIESDEF_H
00030
00031 #ifdef __cplusplus
00032 extern "C" {
00033 #endif
00034
00035 # define ED_MAX_DEFS 64
00036
00037 # define ED_ERROR -1
00038 # define ED_OK 1
00039
00040 # define ED_OPTIONAL (1<<0)
00041 # define ED_MANDATORY (1<<1)
00042 # define ED_ABSTRACT (1<<2)
00043 # define ED_TYPE_FLOAT (1<<3)
00044 # define ED_TYPE_INT (1<<4)
00045 # define ED_TYPE_STRING (1<<5)
00046 # define ED_DEFAULT (1<<6)
00047 # define ED_MODE_TYPE (1<<7)
00048 # define ED_RANGE (1<<8)
00049 # define ED_INSIST_POSITIVE (1<<9)
00051 # define ED_CONCRETE (ED_OPTIONAL | ED_MANDATORY)
00052 # define ED_KEY_TYPE (ED_TYPE_FLOAT | ED_TYPE_INT | ED_TYPE_STRING)
00053
00054 typedef union int_float_u {
00055 int i;
00056 float f;
00057 } int_float_tu;
00058
00059 typedef struct entityKeyRange_s {
00060 char *str;
00061 int *iArr;
00062 float *fArr;
00063 int numElements;
00064 int continuous;
00065 } entityKeyRange_t;
00066
00067 typedef struct entityKeyDef_s {
00068 char *name;
00069 char *desc;
00070 char *defaultVal;
00071 int flags;
00072 int vLen;
00073 entityKeyRange_t **ranges;
00074 int numRanges;
00075 } entityKeyDef_t;
00076
00077 typedef struct entityDef_s {
00078 char *classname;
00079 entityKeyDef_t *keyDefs;
00080 int numKeyDefs;
00081 } entityDef_t;
00082
00083 int ED_GetDefaultFloat(float *defaultBuf, const int n, const entityKeyDef_t *kd);
00084 int ED_GetDefaultInt(int *defaultBuf, const int n, const entityKeyDef_t *kd);
00085 int ED_GetDefaultString(char *defaultBuf, const size_t n, const entityKeyDef_t *kd);
00086
00087 int ED_GetIntVector(const entityKeyDef_t *kd, int v[], const int n);
00088 int ED_Check(const char *classname, const char *key, const char *value);
00089 int ED_CheckKey(const entityKeyDef_t *kd, const char *value);
00090 const entityDef_t *ED_GetEntityDef(const char *classname);
00091 const entityKeyDef_t *ED_GetKeyDef(const char *classname, const char *keyname, const int abstract);
00092 const entityKeyDef_t *ED_GetKeyDefEntity(const entityDef_t *ed, const char *keyname, const int abstract);
00093 int ED_Parse(const char *data_p);
00094 const char *ED_GetLastError(void);
00095 void ED_Free(void);
00096
00097 extern int numEntityDefs;
00098 extern entityDef_t entityDefs[ED_MAX_DEFS + 1];
00099
00100 #ifdef __cplusplus
00101 }
00102 #endif
00103
00104 #endif