6 #if VARIABLE_NUM_ARGS == VARIABLE_MAX_ARGS
8 struct const_function_t
11 struct no_const_function_t
14 const static const_function_t const_function = const_function_t();
15 const static no_const_function_t no_const_function = no_const_function_t();
17 template <
bool isConst,
class T,
class Po
interType,
class TRet, VARIABLE_ARGS>
18 class MEncapsulate_Base
22 typedef TRet (T::*FNoConst)(VARIABLE_ARGS_DECL);
23 typedef TRet (T::*FConst)(VARIABLE_ARGS_DECL)
const;
24 typedef typename _if<isConst,FConst,FNoConst>::Result F;
27 MEncapsulate_Base():mOwner(0){};
28 MEncapsulate_Base(
const F&
function, PointerType& obj ):mOwner(obj),mFunction(function)
34 return equality( Int2Type< Conversion<F2, MEncapsulate_Base<isConst,T,PointerType,TRet,VARIABLE_ARGS_DECL> >::exists >(),ob2 );
43 bool equality( Int2Type<false>,
const F&)
const
47 bool equality( Int2Type<true >,
const MEncapsulate_Base<isConst,T,PointerType,TRet,VARIABLE_ARGS_DECL>& me2)
const
51 return mOwner == me2.mOwner && mel::mpl::equal<true>( mFunction,me2.mFunction);
76 template <
bool isConst,
class T,
class Po
interType,
class TRet, VARIABLE_ARGS>
77 class MEncapsulate :
public MEncapsulate_Base<isConst,T,PointerType,TRet,VARIABLE_ARGS_DECL>
79 typedef typename MEncapsulate_Base<isConst,T,PointerType,TRet,VARIABLE_ARGS_DECL>::F F;
81 MEncapsulate():MEncapsulate_Base<isConst,T,PointerType,TRet,VARIABLE_ARGS_DECL>(){};
82 MEncapsulate(
const F&
function, PointerType& obj ):MEncapsulate_Base<isConst,T,PointerType,TRet,VARIABLE_ARGS_DECL>(
function,obj)
85 TRet operator()( VARIABLE_ARGS_IMPL )
87 return (MEncapsulate_Base<isConst,T,PointerType,TRet,VARIABLE_ARGS_DECL>::mOwner->*MEncapsulate_Base<isConst,T,PointerType,TRet,VARIABLE_ARGS_DECL>::mFunction)( VARIABLE_ARGS_USE);
92 template <
bool isConst,
class T,
class Po
interType,
class TRet>
93 class MEncapsulate_Base<isConst,T,PointerType,TRet>
97 typedef TRet (T::*FNoConst)();
98 typedef TRet (T::*FConst)()
const;
102 MEncapsulate_Base():mOwner(0){};
103 MEncapsulate_Base(
const F&
function, PointerType& obj ):mFunction(function), mOwner(obj)
109 return equality( Int2Type< Conversion<F2, MEncapsulate_Base<isConst,T,PointerType,TRet> >::exists >(),ob2 );
117 bool equality( Int2Type<false>,
const F&)
const
121 bool equality( Int2Type<true >,
const MEncapsulate_Base<isConst,T,PointerType,TRet>& me2)
const
125 return mOwner == me2.mOwner &&::mel::mpl::equal<true>( mFunction,me2.mFunction);
136 template <
bool isConst,
class T,
class Po
interType,
class TRet >
137 class MEncapsulate<isConst,T,PointerType,TRet> :
public MEncapsulate_Base<isConst,T,PointerType,TRet,void>
139 typedef typename MEncapsulate_Base<isConst,T,PointerType,TRet,void>::F F;
142 MEncapsulate():MEncapsulate_Base<isConst,T,PointerType, TRet>(){};
143 MEncapsulate(
const F&
function, PointerType& obj ):MEncapsulate_Base<isConst,T,PointerType,TRet>(
function,obj)
148 return (MEncapsulate_Base<isConst,T,PointerType,TRet,void>::mOwner->*MEncapsulate_Base<isConst,T,PointerType,TRet,void>::mFunction)( );
153 template <
class TRet,
class T,VARIABLE_ARGS_NODEFAULT,
class Po
interType >
inline
159 template <
class TRet,
class T,VARIABLE_ARGS_NODEFAULT,
class Po
interType >
inline
160 MEncapsulate<false,T,PointerType,TRet,VARIABLE_ARGS_DECL> makeMemberEncapsulate( TRet (T::*F)(VARIABLE_ARGS_DECL),PointerType owner, no_const_function_t)
162 return MEncapsulate<false,T,PointerType,TRet,VARIABLE_ARGS_DECL>(F,owner);
167 template <
class TRet,
class T,VARIABLE_ARGS_NODEFAULT,
class Po
interType >
inline
175 template <
class TRet,
class T,
class Po
interType>
inline
176 MEncapsulate<false,T,PointerType,TRet> makeMemberEncapsulate( TRet (T::*F)(),PointerType owner)
178 return MEncapsulate<false,T,PointerType,TRet>(F,owner);
180 template <
class TRet,
class T,
class Po
interType>
inline
181 MEncapsulate<false,T,PointerType,TRet> makeMemberEncapsulate( TRet (T::*F)(),PointerType owner,no_const_function_t)
183 return MEncapsulate<false,T,PointerType,TRet>(F,owner);
186 template <
class TRet,
class T,
class Po
interType>
inline
187 MEncapsulate<true,T,PointerType,TRet> makeMemberEncapsulate( TRet (T::*F)()
const,PointerType owner, const_function_t)
189 return MEncapsulate<true,T,PointerType,TRet>(F,owner);
196 template <
bool isConst,
class T,
class Po
interType,
class TRet, VARIABLE_ARGS>
197 class MEncapsulate_Base<isConst,T,PointerType,TRet,VARIABLE_ARGS_DECL,void>
200 typedef TRet (T::*FNoConst)(VARIABLE_ARGS_DECL);
201 typedef TRet (T::*FConst)(VARIABLE_ARGS_DECL)
const;
202 typedef typename _if<isConst,FConst,FNoConst>::Result F;
206 MEncapsulate_Base():mOwner(0){};
207 MEncapsulate_Base(
const F&
function, PointerType& obj ):mFunction(function), mOwner(obj)
213 return equality( Int2Type< Conversion<F2, MEncapsulate_Base<isConst,T,PointerType,TRet,VARIABLE_ARGS_DECL> >::exists >(),ob2 );
222 bool equality( Int2Type<false>,
const F&)
const
226 bool equality( Int2Type<true >,
const MEncapsulate_Base<isConst,T,PointerType,TRet,VARIABLE_ARGS_DECL>& me2)
const
230 return mOwner == me2.mOwner &&::mel::mpl::equal<true>( mFunction,me2.mFunction);
238 template <
bool isConst,
class T,
class Po
interType,
class TRet, VARIABLE_ARGS>
239 class MEncapsulate<isConst,T,PointerType,TRet,VARIABLE_ARGS_DECL,void> :
public MEncapsulate_Base<isConst,T,PointerType,TRet,VARIABLE_ARGS_DECL>
241 typedef typename MEncapsulate_Base<isConst,T,PointerType,TRet,VARIABLE_ARGS_DECL>::F F;
243 MEncapsulate():MEncapsulate_Base<isConst,T,PointerType,TRet,VARIABLE_ARGS_DECL>(){};
244 MEncapsulate( F
function, PointerType& obj ):MEncapsulate_Base<isConst,T,PointerType,TRet,VARIABLE_ARGS_DECL>(function,obj){}
245 TRet operator()( VARIABLE_ARGS_IMPL )
247 return (MEncapsulate_Base<isConst,T,PointerType,TRet,VARIABLE_ARGS_DECL>::mOwner->*MEncapsulate_Base<isConst,T,PointerType,TRet,VARIABLE_ARGS_DECL>::mFunction)( VARIABLE_ARGS_USE);
257 template <
class TRet,
class T, VARIABLE_ARGS,
class Po
interType>
inline
258 MEncapsulate<false,T,PointerType,TRet,VARIABLE_ARGS_DECL> makeMemberEncapsulate( TRet (T::*F)(VARIABLE_ARGS_DECL),PointerType owner)
260 return MEncapsulate<false,T,PointerType,TRet,VARIABLE_ARGS_DECL>(F,owner);
266 template <
class TRet,
class T, VARIABLE_ARGS,
class Po
interType >
inline
267 MEncapsulate<false,T,PointerType, TRet,VARIABLE_ARGS_DECL> makeMemberEncapsulate( TRet (T::*F)(VARIABLE_ARGS_DECL) ,PointerType owner,no_const_function_t)
269 return MEncapsulate<false,T,PointerType,TRet,VARIABLE_ARGS_DECL>(F,owner);
272 template <
class TRet,
class T,VARIABLE_ARGS,
class Po
interType >
inline
273 MEncapsulate<true,T,PointerType,TRet,VARIABLE_ARGS_DECL> makeMemberEncapsulate( TRet (T::*F)(VARIABLE_ARGS_DECL)
const,PointerType owner,const_function_t)
275 return MEncapsulate<true,T,PointerType,TRet,VARIABLE_ARGS_DECL>(F,owner);
Definition: MemberEncapsulateImpl.h:78
Definition: BasicTypes.h:7
Small operator==(const AnyType &, const AnyType &)
Definition: Callback_Impl.h:11