1 | /* |
---|
2 | orxonox - the future of 3D-vertical-scrollers |
---|
3 | |
---|
4 | Copyright (C) 2004 orx |
---|
5 | |
---|
6 | This program is free software; you can redistribute it and/or modify |
---|
7 | it under the terms of the GNU General Public License as published by |
---|
8 | the Free Software Foundation; either version 2, or (at your option) |
---|
9 | any later version. |
---|
10 | */ |
---|
11 | |
---|
12 | |
---|
13 | /*! |
---|
14 | * @file functors_list.h |
---|
15 | * all the Different types of Functions one can include |
---|
16 | */ |
---|
17 | |
---|
18 | /** |
---|
19 | useable FunctionParameters are: |
---|
20 | l_INT: int |
---|
21 | l_LONG: long |
---|
22 | l_SHORT: short |
---|
23 | l_FLOAT: float |
---|
24 | l_STRING: const char* |
---|
25 | l_XML_ELEM: TiXmlElement* |
---|
26 | */ |
---|
27 | |
---|
28 | #ifndef __FUNCTOR_PARAMETERS__ |
---|
29 | #define __FUNCTOR_PARAMETERS__ |
---|
30 | |
---|
31 | //! defines the maximum count of arguments function pointers might have |
---|
32 | #define FUNCTOR_MAX_ARGUMENTS 5 |
---|
33 | |
---|
34 | typedef enum |
---|
35 | { |
---|
36 | ParameterNull = 0, |
---|
37 | ParameterBool = 1, |
---|
38 | ParameterChar = 2, |
---|
39 | ParameterString = 4, |
---|
40 | ParameterInt = 8, |
---|
41 | ParameterUInt = 16, |
---|
42 | ParameterFloat = 32, |
---|
43 | ParameterLong = 64, |
---|
44 | /* ... */ |
---|
45 | } ParameterType; |
---|
46 | |
---|
47 | |
---|
48 | #define l_BOOL_TYPE bool //!< The type of an BOOL |
---|
49 | #define l_BOOL_FUNC isBool //!< The function to call to parse BOOL |
---|
50 | #define l_BOOL_NAME "bool" //!< The name of an BOOL |
---|
51 | #define l_BOOL_PARAM ParameterBool //!< the type of the parameter BOOL |
---|
52 | #define l_BOOL_DEFAULT false //!< a default Value for an BOOL |
---|
53 | |
---|
54 | |
---|
55 | #define l_INT_TYPE int //!< The type of an INT |
---|
56 | #define l_INT_FUNC isInt //!< The function to call to parse INT |
---|
57 | #define l_INT_NAME "int" //!< The name of an INT |
---|
58 | #define l_INT_PARAM ParameterInt //!< the type of the parameter INT |
---|
59 | #define l_INT_DEFAULT 0 //!< a default Value for an INT |
---|
60 | |
---|
61 | #define l_UINT_TYPE unsigned int //!< The type of an UINT |
---|
62 | #define l_UINT_FUNC isInt //!< The function to call to parse UINT |
---|
63 | #define l_UINT_NAME "unsigned int" //!< The name of an UINT |
---|
64 | #define l_UINT_PARAM ParameterUInt //!< the type of the parameter UINT |
---|
65 | #define l_UINT_DEFAULT 0 //!< a default Value for an UINT |
---|
66 | |
---|
67 | #define l_LONG_TYPE long //!< The type of a LONG |
---|
68 | #define l_LONG_FUNC isInt //!< The function to parse a LONG |
---|
69 | #define l_LONG_NAME "long" //!< The name of a LONG |
---|
70 | #define l_LONG_PARAM ParameterLong //!< the type of the parameter LONG |
---|
71 | #define l_LONG_DEFAULT 0 //!< a default Value for a LONG |
---|
72 | |
---|
73 | // #define l_SHORT_TYPE short //!< The type of a SHORT |
---|
74 | // #define l_SHORT_FUNC atoi //!< The function to parse a SHORT |
---|
75 | // #define l_SHORT_NAME "short" //!< The name of a SHORT |
---|
76 | //#define l_SHORT_PARAM ParameterShort //!< the type of the parameter SHORT |
---|
77 | // #define l_SHORT_DEFAULT 0 //!< a default Value for a SHORT |
---|
78 | |
---|
79 | #define l_FLOAT_TYPE float //!< The type of a FLOAT |
---|
80 | #define l_FLOAT_FUNC isFloat //!< The function to parse a FLOAT |
---|
81 | #define l_FLOAT_NAME "float" //!< The name of a FLOAT |
---|
82 | #define l_FLOAT_PARAM ParameterFloat //!< the type of the parameter FLOAT |
---|
83 | #define l_FLOAT_DEFAULT 0.0 //!< a default Value for a FLOAT |
---|
84 | |
---|
85 | //#define l_VECTOR_TYPE const Vector& //!< The type of a VECTOR |
---|
86 | //#define l_VECTOR_FUNC isVector //!< The function to parse a VECTOR |
---|
87 | //#define l_VECTOR_NAME "Vector[x/y/z]" //!< The name of a VECTOR |
---|
88 | //#define l_VECTOR_DEFAULT Vector(0,0,0) //!< Default value for a VECTOR |
---|
89 | |
---|
90 | #define l_STRING_TYPE const char* //!< The type of a STRING |
---|
91 | #define l_STRING_FUNC isString //!< The function to parse a STRING |
---|
92 | #define l_STRING_NAME "string" //!< The name of a STRING |
---|
93 | #define l_STRING_PARAM ParameterString //!< the type of the parameter STRING |
---|
94 | #define l_STRING_DEFAULT "" //!< a default Value for an STRING |
---|
95 | |
---|
96 | #define l_XML_ELEM_TYPE const TiXmlElement* //!< The type of an XML_ELEM |
---|
97 | #define l_XML_ELEM_FUNC //!< The function to parse an XML_ELEM |
---|
98 | #define l_XML_ELEM_NAME "XML" //!< The name of an XML_ELEM |
---|
99 | //#define l_XML_ELEM_PARAM Parameter //!< the type of the parameter XML_ELEM |
---|
100 | #define l_XML_ELEM_DEFAULT NULL //!< The dafault Value for an XML_ELEM |
---|
101 | |
---|
102 | #endif /* __FUNCTOR_PARAMETERS__ */ |
---|
103 | |
---|
104 | |
---|
105 | #ifdef FUNCTOR_LIST |
---|
106 | FUNCTOR_LIST(0)(); |
---|
107 | //! makes functions with one string |
---|
108 | FUNCTOR_LIST(1)(l_STRING); |
---|
109 | //! makes functions with two strings |
---|
110 | FUNCTOR_LIST(2)(l_STRING, l_STRING); |
---|
111 | //! makes functions with three strings |
---|
112 | FUNCTOR_LIST(3)(l_STRING, l_STRING, l_STRING); |
---|
113 | //! makes functions with four strings |
---|
114 | FUNCTOR_LIST(4)(l_STRING, l_STRING, l_STRING, l_STRING); |
---|
115 | |
---|
116 | //! makes functions with one bool |
---|
117 | FUNCTOR_LIST(1)(l_BOOL); |
---|
118 | |
---|
119 | //! makes functions with one int |
---|
120 | FUNCTOR_LIST(1)(l_INT); |
---|
121 | //! makes functions with two ints |
---|
122 | FUNCTOR_LIST(2)(l_INT, l_INT); |
---|
123 | //! makes functions with three ints |
---|
124 | FUNCTOR_LIST(3)(l_INT, l_INT, l_INT); |
---|
125 | //! makes functions with four ints |
---|
126 | FUNCTOR_LIST(4)(l_INT, l_INT, l_INT, l_INT); |
---|
127 | |
---|
128 | |
---|
129 | //! makes functions with one unsigned int |
---|
130 | FUNCTOR_LIST(1)(l_UINT); |
---|
131 | //! makes functions with two unsigned ints |
---|
132 | FUNCTOR_LIST(2)(l_UINT, l_UINT); |
---|
133 | //! makes functions with three unsigned ints |
---|
134 | FUNCTOR_LIST(3)(l_UINT, l_UINT, l_UINT); |
---|
135 | //! makes functions with four unsigned ints |
---|
136 | FUNCTOR_LIST(4)(l_UINT, l_UINT, l_UINT, l_UINT); |
---|
137 | |
---|
138 | //! makes functions with one float |
---|
139 | FUNCTOR_LIST(1)(l_FLOAT); |
---|
140 | //! makes functions with two floats |
---|
141 | FUNCTOR_LIST(2)(l_FLOAT, l_FLOAT); |
---|
142 | //! makes functions with three floats |
---|
143 | FUNCTOR_LIST(3)(l_FLOAT, l_FLOAT, l_FLOAT); |
---|
144 | //! makes functions with four floats |
---|
145 | FUNCTOR_LIST(4)(l_FLOAT, l_FLOAT, l_FLOAT, l_FLOAT); |
---|
146 | //! makes functions with four floats |
---|
147 | FUNCTOR_LIST(5)(l_FLOAT, l_FLOAT, l_FLOAT, l_FLOAT, l_FLOAT); |
---|
148 | |
---|
149 | //! mixed values: |
---|
150 | FUNCTOR_LIST(2)(l_STRING, l_FLOAT); |
---|
151 | #endif /* FUNCTOR_LIST */ |
---|
152 | |
---|