#include <idioskopos/writeonlypropertybase.h>
Inheritance diagram for Idioskopos::WriteOnlyPropertyBase< T >:
Using this class ensures that the value may not be read through introspection methods.
Public Types | |
typedef IdioskoposPointer< WriteOnlyPropertyBase > | pointer |
typedef T | value_type |
typedef std::set< Object * > | Objects |
Public Member Functions | |
IDIOSKOPOS_OBJECT (WriteOnlyPropertyBase) | |
WriteOnlyPropertyBase (const Glib::ustring &name, sigc::slot< void > slot=sigc::slot< void >()) | |
Default constructor that doesn't do much. | |
WriteOnlyPropertyBase (const Glib::ustring &name, Introspectable &container, sigc::slot< void > slot=sigc::slot< void >()) | |
Makes this a property of the introspectable container accessible through the provided name. | |
virtual | ~WriteOnlyPropertyBase () |
Destructor. | |
virtual void | set_value (const Glib::ustring &v) |
WriteOnlyPropertyBase< T > & | operator= (const T &val) |
Allows assignment to the property from the contained value type. | |
virtual void | set (const T &val)=0 |
The canonical set() accessor method that also emits the changed signal. | |
virtual Glib::ustring | xml (int indent=-1) |
The get_xml function is a template method with full specializations for known types. | |
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) |
const std::type_info & | type () const |
Returns the RTTI type id of the contained type. | |
IDIOSKOPOS_OBJECT (Object) | |
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 Glib::ustring | value () |
Virtual method implemented by children to return a string representation of the contained value. | |
template<typename T> | |
void | set_value (const T &t) |
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. | |
Protected Member Functions | |
virtual T & | get_value ()=0 |
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 | |
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::WriteOnlyPropertyBase< T >::WriteOnlyPropertyBase | ( | const Glib::ustring & | name, | |
sigc::slot< void > | slot = sigc::slot<void>() | |||
) | [inline] |
Default constructor that doesn't do much.
Idioskopos::WriteOnlyPropertyBase< T >::WriteOnlyPropertyBase | ( | const Glib::ustring & | name, | |
Introspectable & | container, | |||
sigc::slot< void > | slot = sigc::slot<void>() | |||
) | [inline] |
Makes this a property of the introspectable container accessible through the provided name.
virtual Idioskopos::WriteOnlyPropertyBase< T >::~WriteOnlyPropertyBase | ( | ) | [inline, virtual] |
Destructor.
WriteOnlyPropertyBase<T>& Idioskopos::WriteOnlyPropertyBase< T >::operator= | ( | const T & | val | ) | [inline] |
Allows assignment to the property from the contained value type.
Reimplemented in Idioskopos::Property< T >, Idioskopos::PropertyBase< T >, Idioskopos::PropertyBase< std::vector< bool, A > >, Idioskopos::Property< double >, Idioskopos::Property< std::string >, Idioskopos::Property< int >, Idioskopos::Property< VerySimple >, Idioskopos::Property< std::vector< double > >, Idioskopos::Property< IdioskoposArray< int, 10 > >, Idioskopos::PropertyBase< double >, Idioskopos::PropertyBase< std::string >, Idioskopos::PropertyBase< int >, Idioskopos::PropertyBase< VerySimple >, Idioskopos::PropertyBase< std::vector< double > >, and Idioskopos::PropertyBase< IdioskoposArray< int, 10 > >.
virtual void Idioskopos::WriteOnlyPropertyBase< T >::set | ( | const T & | val | ) | [pure virtual] |
The canonical set() accessor method that also emits the changed signal.
Implemented in Idioskopos::WriteOnlyProperty< T >, Idioskopos::Property< T >, Idioskopos::WriteOnlyReferenceProperty< T >, Idioskopos::ReferenceProperty< T >, Idioskopos::WriteOnlyVirtualProperty< T >, Idioskopos::VirtualProperty< T >, Idioskopos::Property< double >, Idioskopos::Property< std::string >, Idioskopos::Property< int >, Idioskopos::Property< VerySimple >, Idioskopos::Property< std::vector< double > >, Idioskopos::Property< IdioskoposArray< int, 10 > >, Idioskopos::ReferenceProperty< double >, and Idioskopos::VirtualProperty< double >.
virtual Glib::ustring Idioskopos::WriteOnlyPropertyBase< T >::xml | ( | int | indent = -1 |
) | [inline, virtual] |
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.
Implements Idioskopos::Object.
Reimplemented in Idioskopos::PropertyBase< T >, Idioskopos::PropertyBase< std::vector< bool, A > >, Idioskopos::PropertyBase< double >, Idioskopos::PropertyBase< std::string >, Idioskopos::PropertyBase< int >, Idioskopos::PropertyBase< VerySimple >, Idioskopos::PropertyBase< std::vector< double > >, and Idioskopos::PropertyBase< IdioskoposArray< int, 10 > >.
const std::type_info& Idioskopos::WriteOnlyPropertyBase< T >::type | ( | ) | const [inline, virtual] |
Returns the RTTI type id of the contained type.
Implements Idioskopos::Object.
Reimplemented in Idioskopos::PropertyBase< T >, Idioskopos::PropertyBase< std::vector< bool, A > >, Idioskopos::PropertyBase< double >, Idioskopos::PropertyBase< std::string >, Idioskopos::PropertyBase< int >, Idioskopos::PropertyBase< VerySimple >, Idioskopos::PropertyBase< std::vector< double > >, and Idioskopos::PropertyBase< IdioskoposArray< int, 10 > >.
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.
Glib::ustring Idioskopos::Object::value | ( | ) | [virtual, inherited] |
Virtual method implemented by children to return a string representation of the contained value.
Reimplemented in Idioskopos::ReadOnlyPropertyBase< T >, Idioskopos::ReadOnlyPropertyBase< std::vector< X, A > >, Idioskopos::ReadOnlyPropertyBase< IdioskoposArray< X, N > >, Idioskopos::ReadOnlyPropertyBase< double >, Idioskopos::ReadOnlyPropertyBase< std::string >, Idioskopos::ReadOnlyPropertyBase< std::vector< bool, A > >, Idioskopos::ReadOnlyPropertyBase< int >, Idioskopos::ReadOnlyPropertyBase< VerySimple >, Idioskopos::ReadOnlyPropertyBase< std::vector< double > >, and Idioskopos::ReadOnlyPropertyBase< IdioskoposArray< int, 10 > >.
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.