30 #ifndef _CEGUITplProperty_h_
31 #define _CEGUITplProperty_h_
33 #include "CEGUI/TypedProperty.h"
39 template<
class C,
typename T>
45 typedef void (C::*Setter)(
typename Helper::pass_type);
52 template<
typename DT>
struct EnsurePlain {
typedef DT result; };
53 template<
typename DT>
struct EnsurePlain<DT&> {
typedef DT result; };
54 template<
typename DT>
struct EnsurePlain<const DT&> {
typedef DT result; };
57 template<
typename DT>
struct EnsureConstRef<DT&> {
typedef const DT& result; };
58 template<
typename DT>
struct EnsureConstRef<const DT&> {
typedef const DT& result; };
60 template<
typename DT>
struct EnsureRef {
typedef DT& result; };
61 template<
typename DT>
struct EnsureRef<DT&> {
typedef DT& result; };
62 template<
typename DT>
struct EnsureRef<const DT&> {
typedef DT& result; };
76 d_constRefGetter(getter)
80 GetterFunctor(RefGetter getter):
91 operator bool(
void)
const
93 return d_plainGetter || d_constRefGetter || d_refGetter;
95 typename Helper::safe_method_return_type operator()(
const C* instance)
const
100 return CEGUI_CALL_MEMBER_FN(*instance, d_plainGetter)();
101 if (d_constRefGetter)
102 return CEGUI_CALL_MEMBER_FN(*instance, d_constRefGetter)();
104 return CEGUI_CALL_MEMBER_FN(*instance, d_refGetter)();
108 return CEGUI_CALL_MEMBER_FN(*instance, d_plainGetter)();
111 PlainGetter d_plainGetter;
112 ConstRefGetter d_constRefGetter;
113 RefGetter d_refGetter;
116 TplProperty(
const String& name,
const String& help,
const String& origin, Setter setter, GetterFunctor getter,
typename Helper::pass_type defaultValue = T(),
bool writesXML =
true):
117 TypedProperty<T>(name, help, origin, defaultValue, writesXML),
123 virtual ~TplProperty()
139 GetterFunctor d_getter;
144 #endif // end of guard _CEGUITplProperty_h_