22 #ifndef ELM_UTIL_DELEGATE_H
23 #define ELM_UTIL_DELEGATE_H
28 template <
class C,
class I,
class T>
32 : cont(&container), id(identifier) { }
34 : cont(delegate.cont), id(delegate.id) { }
36 inline operator T(
void)
const {
return ((
const C *)cont)->get(
id); }
37 inline const T&
operator*(
void)
const {
return ((
const C *)cont)->get(
id); }
39 { cont->set(
id, value);
return *
this; }
41 { cont = delegate.cont;
id = delegate.id;
return *
this; }
59 template <
class C,
class I,
class T,
class D = Default<T> >
63 : cont(&container), id(identifier) { }
65 : cont(delegate.cont), id(delegate.id) { }
67 inline operator T(
void)
const
68 {
return ((
const C *)cont)->get(
id, D::def); }
70 {
return ((
const C *)cont)->get(
id, D::def); }
72 { cont->put(
id, value);
return *
this; }
74 { cont = delegate.cont;
id = delegate.id;
return *
this; }
MapDelegate< C, I, T > & operator=(const T &value)
Definition: delegate.h:71
static T def
Definition: delegate.h:53
ArrayDelegate< C, I, T > & operator=(const T &value)
Definition: delegate.h:38
Definition: delegate.h:51
MapDelegate(const MapDelegate &delegate)
Definition: delegate.h:64
Definition: delegate.h:29
value_t value(CString name, int value)
Definition: rtti.h:40
const T & operator*(void) const
Definition: delegate.h:69
ArrayDelegate(C &container, const I &identifier)
Definition: delegate.h:31
MapDelegate< C, I, T > & operator=(const MapDelegate< C, I, T > &delegate)
Definition: delegate.h:73
Definition: delegate.h:60
ArrayDelegate< C, I, T > & operator=(const ArrayDelegate< C, I, T > &delegate)
Definition: delegate.h:40
const T & operator*(void) const
Definition: delegate.h:37
MapDelegate(C &container, const I &identifier)
Definition: delegate.h:62
ArrayDelegate(const ArrayDelegate &delegate)
Definition: delegate.h:33