#include <idioskopos/virtualproperty.h>
Inheritance diagram for Idioskopos::VirtualProperty< T >:
Public Types | |
typedef IdioskoposPointer< VirtualProperty > | pointer |
typedef T | value_type |
typedef sigc::slot< T > | GetSlotType |
typedef sigc::slot< void, T > | SetSlotType |
typedef std::set< Object * > | Objects |
Public Member Functions | |
IDIOSKOPOS_OBJECT (VirtualProperty) | |
VirtualProperty (const Glib::ustring &name) | |
Default constructor that doesn't do much. | |
VirtualProperty (const Glib::ustring &name, Introspectable &container) | |
Makes this a property of the introspectable container accessible through the provided name, and initializes the contained value to the value of the third parameter. | |
VirtualProperty (const Glib::ustring &name, sigc::slot< T > get_slot, sigc::slot< void, T > set_slot) | |
VirtualProperty (const Glib::ustring &name, Introspectable &container, sigc::slot< T > get_slot, sigc::slot< void, T > set_slot) | |
Makes this a property of the introspectable container accessible through the provided name, and initializes the contained value to the value of the third parameter. | |
virtual const T & | get () const |
The canonical get() accessor method. | |
virtual T * | get_pointer () |
Should return a pointer to the contained object, or NULL if pointers are not allowed. | |
virtual void | set (const T &val) |
The canonical set() accessor method that also emits the changed signal. | |
sigc::slot< T > | get_slot () |
void | get_slot (sigc::slot< T > slot) |
void | get_slot_clear () |
sigc::slot< void, T > | set_slot () |
void | set_slot (sigc::slot< void, T > slot) |
void | set_slot_clear () |
IDIOSKOPOS_OBJECT (PropertyBase) | |
IDIOSKOPOS_OBJECT (ReadOnlyPropertyBase) | |
IDIOSKOPOS_OBJECT (Object) | |
IDIOSKOPOS_OBJECT (WriteOnlyPropertyBase) | |
PropertyBase< T > & | operator() (const T &val) |
Function call syntax. | |
const T & | operator() () const |
Function call syntax. | |
template<typename X> | |
PropertyBase< T > & | operator+= (X other) |
Arithmetic assignment operator. | |
template<typename X> | |
PropertyBase< T > & | operator-= (X other) |
Arithmetic assignment operator. | |
template<typename X> | |
PropertyBase< T > & | operator *= (X other) |
Arithmetic assignment operator. | |
template<typename X> | |
PropertyBase< T > & | operator/= (X other) |
Arithmetic assignment operator. | |
template<typename X> | |
PropertyBase< T > & | operator%= (X other) |
Arithmetic assignment operator. | |
virtual Glib::ustring | xml (int indent=-1) |
The get_xml function is a template method with full specializations for known types. | |
const std::type_info & | type () const |
Returns the RTTI type id of the contained type. | |
virtual const T * | get_pointer () const |
operator const T & () const | |
Allows for implicit casts to the contained type. | |
T * | operator-> () |
A convenience operator when the property contains a class. | |
virtual Glib::ustring | value () |
Similar in concept to the xml() method, this provides a string representation of the contained value if the get_value() template has a meaningful template specialization. | |
const Glib::ustring & | name () |
void | set_name (const Glib::ustring &n) |
virtual sigc::signal< void, Object * > | signal_property_added () |
Returns the property added signal if this is an introspectable object, otherwise throws an exception. | |
virtual sigc::signal< void, Object * > | signal_property_removed () |
Returns the property removed signal if this is an introspectable object, otherwise throws an exception. | |
sigc::signal< void, const Glib::ustring & > | signal_name_changed () |
sigc::signal< void > & | signal_value_changed () |
Signal emitted when the property is changed. | |
virtual void | set_xml (const Glib::ustring &s, bool change_names=false, bool create_missing=true) |
virtual void | set_xml (const xmlpp::Node *n, bool change_names=false, bool create_missing=true) |
virtual void | set_xml (const Glib::ustring &s, bool change_names=false, bool create_missing=true) |
virtual void | set_xml (const xmlpp::Node *n, bool change_names=false, bool create_missing=true) |
virtual void | set_value (const Glib::ustring &v) |
template<typename T> | |
void | set_value (const T &t) |
virtual void | set_value (const Glib::ustring &v) |
virtual size_t | num_properties () const |
If this is a property container, this should be reimplemented to provide a true count of the number of child properties this container has. | |
virtual iterator | properties_begin () |
virtual iterator | properties_end () |
virtual Object & | operator[] (const Glib::ustring &name) throw (error::bad_property_name) |
This method returns an Object reference and throws exceptions when a bad name is encountered. | |
Static Public Member Functions | |
static pointer | create (const Glib::ustring &name) |
static pointer | create (const Glib::ustring &name, Introspectable &container) |
static pointer | create (const Glib::ustring &name, sigc::slot< T > get_slot, sigc::slot< void, T > set_slot) |
static pointer | create (const Glib::ustring &name, Introspectable &container, sigc::slot< T > get_slot, sigc::slot< void, T > set_slot) |
Protected Member Functions | |
virtual T & | get_value () |
virtual iterator | next_property (std::set< Object * >::iterator i) |
virtual iterator | next_property (size_t i) |
virtual iterator | previous_property (std::set< Object * >::iterator i) |
virtual iterator | previous_property (size_t i) |
Protected Attributes | |
sigc::slot< T > | m_get_slot |
sigc::slot< void, T > | m_set_slot |
Glib::ustring | m_name |
sigc::signal< void, const Glib::ustring & > | m_signal_name_changed |
sigc::signal< void > | m_signal_value_changed |
Signal emitted when underlying data is changed. |
Idioskopos::VirtualProperty< T >::VirtualProperty | ( | const Glib::ustring & | name | ) | [inline] |
Default constructor that doesn't do much.
Idioskopos::VirtualProperty< T >::VirtualProperty | ( | const Glib::ustring & | name, | |
Introspectable & | container | |||
) | [inline] |
Makes this a property of the introspectable container accessible through the provided name, and initializes the contained value to the value of the third parameter.
Idioskopos::VirtualProperty< T >::VirtualProperty | ( | const Glib::ustring & | name, | |
Introspectable & | container, | |||
sigc::slot< T > | get_slot, | |||
sigc::slot< void, T > | set_slot | |||
) | [inline] |
Makes this a property of the introspectable container accessible through the provided name, and initializes the contained value to the value of the third parameter.
virtual const T& Idioskopos::VirtualProperty< T >::get | ( | ) | const [inline, virtual] |
virtual T* Idioskopos::VirtualProperty< T >::get_pointer | ( | ) | [inline, virtual] |
Should return a pointer to the contained object, or NULL if pointers are not allowed.
Implements Idioskopos::ReadOnlyPropertyBase< T >.
virtual void Idioskopos::VirtualProperty< T >::set | ( | const T & | val | ) | [inline, virtual] |
The canonical set() accessor method that also emits the changed signal.
Implements Idioskopos::WriteOnlyPropertyBase< T >.
PropertyBase<T>& Idioskopos::PropertyBase< T >::operator() | ( | const T & | val | ) | [inline, inherited] |
Function call syntax.
Set the value of the property with property(value) notation.
const T& Idioskopos::ReadOnlyPropertyBase< T >::operator() | ( | ) | const [inline, inherited] |
Function call syntax.
Get the value of the property with property() notation.
PropertyBase<T>& Idioskopos::PropertyBase< T >::operator+= | ( | X | other | ) | [inline, inherited] |
Arithmetic assignment operator.
This method is implemented as a template for two reasons:
T + X must be well defined
PropertyBase<T>& Idioskopos::PropertyBase< T >::operator-= | ( | X | other | ) | [inline, inherited] |
Arithmetic assignment operator.
This method is implemented as a template for two reasons:
T - X must be well defined
PropertyBase<T>& Idioskopos::PropertyBase< T >::operator *= | ( | X | other | ) | [inline, inherited] |
Arithmetic assignment operator.
This method is implemented as a template for two reasons:
T * X must be well defined
PropertyBase<T>& Idioskopos::PropertyBase< T >::operator/= | ( | X | other | ) | [inline, inherited] |
Arithmetic assignment operator.
This method is implemented as a template for two reasons:
T / X must be well defined
PropertyBase<T>& Idioskopos::PropertyBase< T >::operator%= | ( | X | other | ) | [inline, inherited] |
Arithmetic assignment operator.
This method is implemented as a template for two reasons:
T % X must be well defined
virtual Glib::ustring Idioskopos::PropertyBase< T >::xml | ( | int | indent = -1 |
) | [inline, virtual, inherited] |
The get_xml function is a template method with full specializations for known types.
The default implementation returns an XML string filled with the RTTI typeinfo id. This is not a portable approach. However, if you provide a specialization of get_xml() for your class, it _will_ be a portable solution.
Reimplemented from Idioskopos::ReadOnlyPropertyBase< T >.
const std::type_info& Idioskopos::PropertyBase< T >::type | ( | ) | const [inline, virtual, inherited] |
Returns the RTTI type id of the contained type.
Reimplemented from Idioskopos::ReadOnlyPropertyBase< T >.
Idioskopos::ReadOnlyPropertyBase< T >::operator const T & | ( | ) | const [inline, inherited] |
Allows for implicit casts to the contained type.
T* Idioskopos::ReadOnlyPropertyBase< T >::operator-> | ( | ) | [inline, inherited] |
A convenience operator when the property contains a class.
Allows class method to be accessed using notation: property->class_method()
virtual Glib::ustring Idioskopos::ReadOnlyPropertyBase< T >::value | ( | ) | [inline, virtual, inherited] |
Similar in concept to the xml() method, this provides a string representation of the contained value if the get_value() template has a meaningful template specialization.
Reimplemented from Idioskopos::Object.
sigc::signal< void, Object * > Idioskopos::Object::signal_property_added | ( | ) | [virtual, inherited] |
Returns the property added signal if this is an introspectable object, otherwise throws an exception.
Reimplemented in Idioskopos::Introspectable.
sigc::signal< void, Object * > Idioskopos::Object::signal_property_removed | ( | ) | [virtual, inherited] |
Returns the property removed signal if this is an introspectable object, otherwise throws an exception.
Reimplemented in Idioskopos::Introspectable.
sigc::signal< void > & Idioskopos::Object::signal_value_changed | ( | ) | [inherited] |
Signal emitted when the property is changed.
size_t Idioskopos::Object::num_properties | ( | ) | const [virtual, inherited] |
If this is a property container, this should be reimplemented to provide a true count of the number of child properties this container has.
Reimplemented in Idioskopos::Introspectable, Idioskopos::PropertyBase< std::vector< X, A > >, and Idioskopos::PropertyBase< IdioskoposArray< X, N > >.
Object & Idioskopos::Object::operator[] | ( | const Glib::ustring & | name | ) | throw (error::bad_property_name) [virtual, inherited] |
This method returns an Object reference and throws exceptions when a bad name is encountered.
The alternative would be to return an Object* and return NULL for an unfound name. However, by returning a reference, it is possible to index into objects using array notation, as in myobject["child"]["property"]
Reimplemented in Idioskopos::Introspectable.
sigc::signal<void> Idioskopos::Object::m_signal_value_changed [protected, inherited] |
Signal emitted when underlying data is changed.