00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #ifndef Reflex_FunctionBuilder
00013 #define Reflex_FunctionBuilder
00014
00015
00016 #include "Reflex/Reflex.h"
00017
00018 namespace Reflex {
00019
00020 class FunctionMember;
00021 class Type;
00022
00023
00024
00025
00026
00027
00028
00029 class RFLX_API FunctionBuilder {
00030 public:
00031
00032 FunctionBuilder(const Type &typ,
00033 const char* nam,
00034 StubFunction stubFP,
00035 void* stubCtx,
00036 const char* params,
00037 unsigned char modifiers);
00038
00039
00040
00041 virtual ~FunctionBuilder();
00042
00043
00044
00045
00046
00047
00048
00049 FunctionBuilder& AddProperty(const char* key,
00050 Any value);
00051 FunctionBuilder& AddProperty(const char* key,
00052 const char* value);
00053
00054
00055
00056
00057
00058
00059 Member ToMember();
00060
00061 private:
00062
00063 Member fFunction;
00064
00065 };
00066
00067
00068
00069
00070
00071
00072
00073
00074 class RFLX_API FunctionBuilderImpl {
00075 public:
00076
00077 FunctionBuilderImpl(const char* nam,
00078 const Type &typ,
00079 StubFunction stubFP,
00080 void* stubCtx,
00081 const char* params,
00082 unsigned char modifiers = 0);
00083
00084
00085
00086 ~FunctionBuilderImpl();
00087
00088
00089
00090
00091
00092
00093
00094 void AddProperty(const char* key,
00095 Any value);
00096 void AddProperty(const char* key,
00097 const char* value);
00098
00099
00100
00101
00102
00103
00104 Member ToMember();
00105
00106 private:
00107
00108 Member fFunction;
00109
00110 };
00111
00112
00113
00114
00115
00116
00117
00118
00119 template <typename F> class FunctionBuilderT {
00120 public:
00121
00122 FunctionBuilderT(const char* nam,
00123 StubFunction stubFP,
00124 void* stubCtx,
00125 const char* params,
00126 unsigned char modifiers);
00127
00128
00129 virtual ~FunctionBuilderT() {}
00130
00131
00132
00133
00134
00135
00136
00137 template <typename P>
00138 FunctionBuilderT& AddProperty(const char* key,
00139 P value);
00140
00141
00142
00143
00144
00145
00146 Member ToMember();
00147
00148 private:
00149
00150 FunctionBuilderImpl fFunctionBuilderImpl;
00151
00152 };
00153
00154 }
00155
00156 #include "Reflex/Builder/TypeBuilder.h"
00157
00158
00159 template <typename F>
00160 inline Reflex::FunctionBuilderT<F>::FunctionBuilderT(const char* nam,
00161 StubFunction stubFP,
00162 void* stubCtx,
00163 const char* params,
00164 unsigned char modifiers)
00165
00166 : fFunctionBuilderImpl(nam,
00167 FunctionDistiller<F>::Get(),
00168 stubFP,
00169 stubCtx,
00170 params,
00171 modifiers) {
00172 }
00173
00174
00175
00176 template <typename F> template <typename P>
00177 inline Reflex::FunctionBuilderT<F>&
00178 Reflex::FunctionBuilderT<F
00179 >::AddProperty(const char* key,
00180 P value) {
00181
00182 fFunctionBuilderImpl.AddProperty(key, value);
00183 return *this;
00184 }
00185
00186
00187
00188 template <typename F> inline Reflex::Member
00189 Reflex::FunctionBuilderT<F
00190 >::ToMember() {
00191
00192 return fFunctionBuilderImpl.ToMember();
00193 }
00194
00195
00196 #endif // Reflex_FunctionBuilder