29 #ifndef _CEGUITplProperty_h_
30 #define _CEGUITplProperty_h_
32 #include "CEGUI/TypedProperty.h"
38 template<
class C,
typename T>
44 typedef void (C::*Setter)(
typename Helper::pass_type);
51 template<
typename DT>
struct EnsurePlain {
typedef DT result; };
52 template<
typename DT>
struct EnsurePlain<DT&> {
typedef DT result; };
53 template<
typename DT>
struct EnsurePlain<const DT&> {
typedef DT result; };
56 template<
typename DT>
struct EnsureConstRef<DT&> {
typedef const DT& result; };
57 template<
typename DT>
struct EnsureConstRef<const DT&> {
typedef const DT& result; };
59 template<
typename DT>
struct EnsureRef {
typedef DT& result; };
60 template<
typename DT>
struct EnsureRef<DT&> {
typedef DT& result; };
61 template<
typename DT>
struct EnsureRef<const DT&> {
typedef DT& result; };
75 d_constRefGetter(getter)
79 GetterFunctor(RefGetter getter):
90 operator bool(
void)
const
92 return d_plainGetter || d_constRefGetter || d_refGetter;
94 typename Helper::safe_method_return_type operator()(
const C* instance)
const
99 return CEGUI_CALL_MEMBER_FN(*instance, d_plainGetter)();
100 if (d_constRefGetter)
101 return CEGUI_CALL_MEMBER_FN(*instance, d_constRefGetter)();
103 return CEGUI_CALL_MEMBER_FN(*instance, d_refGetter)();
107 return CEGUI_CALL_MEMBER_FN(*instance, d_plainGetter)();
110 PlainGetter d_plainGetter;
111 ConstRefGetter d_constRefGetter;
112 RefGetter d_refGetter;
115 TplProperty(
const String& name,
const String& help,
const String& origin, Setter setter, GetterFunctor getter,
typename Helper::pass_type defaultValue = T(),
bool writesXML =
true):
116 TypedProperty<T>(name, help, origin, defaultValue, writesXML),
122 virtual ~TplProperty()
138 GetterFunctor d_getter;
143 #endif // end of guard _CEGUITplProperty_h_
Definition: TplProperty.h:51
Definition: TplProperty.h:49
Main namespace for Crazy Eddie's GUI Library.
Definition: arch_overview.dox:1
Definition: TplProperty.h:55
base class for properties able to do native set/get
Definition: TypedProperty.h:49
Definition: TplProperty.h:39
virtual bool isReadable() const
Returns whether the property is readable.
Definition: TplProperty.h:126
Helper class used to convert various data types to and from the format expected in Property strings...
Definition: ForwardRefs.h:84
virtual bool isWritable() const
Returns whether the property is writable.
Definition: TplProperty.h:131
Definition: TplProperty.h:59