#include <idioskopos/object.h>
Inheritance diagram for Idioskopos::Object:
Namely, it provides an top-level interface for signals and RTTI information. Since Property is a template class that inherits from Object, this serves as a common ancestor.
It is useful for generic containers of properties, such as that used by Introspectable.
Public Types | |
typedef IdioskoposPointer< Object > | pointer |
typedef std::set< Object * > | Objects |
Public Member Functions | |
IDIOSKOPOS_OBJECT (Object) | |
Object (const Glib::ustring &name, sigc::slot< void > slot=sigc::slot< void >()) | |
Object (const Glib::ustring &name, Introspectable &container, sigc::slot< void > slot=sigc::slot< void >()) | |
Constructor that adds this property to the introspectable container and will identify this property by the given name. | |
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 const std::type_info & | type () const=0 |
Pure virtual method implemented by children to return actual RTTI information from child. | |
virtual Glib::ustring | xml (int indent=-1)=0 |
Pure virtual method implemented by children to return an XML string containing both type and value information. | |
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 Glib::ustring | value () |
Virtual method implemented by children to return a string representation of the contained value. | |
virtual void | set_value (const Glib::ustring &v) |
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 iterator | next_property (std::set< Object * >::iterator i) |
virtual iterator | previous_property (std::set< Object * >::iterator i) |
virtual iterator | next_property (size_t 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. | |
Classes | |
class | iterator |
An STL type iterator to iterate through the children of an introspectable object. More... |
Idioskopos::Object::Object | ( | const Glib::ustring & | name, | |
Introspectable & | container, | |||
sigc::slot< void > | slot = sigc::slot< void >() | |||
) |
Constructor that adds this property to the introspectable container and will identify this property by the given name.
sigc::signal< void, Object * > Idioskopos::Object::signal_property_added | ( | ) | [virtual] |
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] |
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 | ( | ) |
Signal emitted when the property is changed.
virtual const std::type_info& Idioskopos::Object::type | ( | ) | const [pure virtual] |
Pure virtual method implemented by children to return actual RTTI information from child.
Implemented in Idioskopos::Introspectable, Idioskopos::PropertyBase< T >, Idioskopos::PropertyBase< std::vector< X, A > >, Idioskopos::PropertyBase< std::vector< bool, A > >, Idioskopos::PropertyBase< IdioskoposArray< X, N > >, Idioskopos::ReadOnlyPropertyBase< T >, Idioskopos::ReadOnlyPropertyBase< std::vector< X, A > >, Idioskopos::ReadOnlyPropertyBase< IdioskoposArray< X, N > >, Idioskopos::WriteOnlyPropertyBase< T >, Idioskopos::WriteOnlyPropertyBase< std::vector< X, A > >, Idioskopos::WriteOnlyPropertyBase< IdioskoposArray< X, N > >, Idioskopos::PropertyBase< double >, Idioskopos::PropertyBase< std::string >, Idioskopos::PropertyBase< int >, Idioskopos::PropertyBase< VerySimple >, Idioskopos::PropertyBase< std::vector< double > >, Idioskopos::PropertyBase< IdioskoposArray< int, 10 > >, Idioskopos::ReadOnlyPropertyBase< double >, Idioskopos::ReadOnlyPropertyBase< std::string >, Idioskopos::ReadOnlyPropertyBase< std::vector< bool, A > >, Idioskopos::ReadOnlyPropertyBase< int >, Idioskopos::ReadOnlyPropertyBase< VerySimple >, Idioskopos::ReadOnlyPropertyBase< std::vector< double > >, Idioskopos::ReadOnlyPropertyBase< IdioskoposArray< int, 10 > >, Idioskopos::WriteOnlyPropertyBase< double >, Idioskopos::WriteOnlyPropertyBase< std::string >, Idioskopos::WriteOnlyPropertyBase< std::vector< bool, A > >, Idioskopos::WriteOnlyPropertyBase< int >, Idioskopos::WriteOnlyPropertyBase< VerySimple >, Idioskopos::WriteOnlyPropertyBase< std::vector< double > >, and Idioskopos::WriteOnlyPropertyBase< IdioskoposArray< int, 10 > >.
virtual Glib::ustring Idioskopos::Object::xml | ( | int | indent = -1 |
) | [pure virtual] |
Pure virtual method implemented by children to return an XML string containing both type and value information.
Implemented in Idioskopos::Introspectable, Idioskopos::PropertyBase< T >, Idioskopos::PropertyBase< std::vector< X, A > >, Idioskopos::PropertyBase< std::vector< bool, A > >, Idioskopos::PropertyBase< IdioskoposArray< X, N > >, Idioskopos::ReadOnlyPropertyBase< T >, Idioskopos::ReadOnlyPropertyBase< std::vector< X, A > >, Idioskopos::ReadOnlyPropertyBase< IdioskoposArray< X, N > >, Idioskopos::WriteOnlyPropertyBase< T >, Idioskopos::WriteOnlyPropertyBase< std::vector< X, A > >, Idioskopos::WriteOnlyPropertyBase< IdioskoposArray< X, N > >, Idioskopos::PropertyBase< double >, Idioskopos::PropertyBase< std::string >, Idioskopos::PropertyBase< int >, Idioskopos::PropertyBase< VerySimple >, Idioskopos::PropertyBase< std::vector< double > >, Idioskopos::PropertyBase< IdioskoposArray< int, 10 > >, Idioskopos::ReadOnlyPropertyBase< double >, Idioskopos::ReadOnlyPropertyBase< std::string >, Idioskopos::ReadOnlyPropertyBase< std::vector< bool, A > >, Idioskopos::ReadOnlyPropertyBase< int >, Idioskopos::ReadOnlyPropertyBase< VerySimple >, Idioskopos::ReadOnlyPropertyBase< std::vector< double > >, Idioskopos::ReadOnlyPropertyBase< IdioskoposArray< int, 10 > >, Idioskopos::WriteOnlyPropertyBase< double >, Idioskopos::WriteOnlyPropertyBase< std::string >, Idioskopos::WriteOnlyPropertyBase< std::vector< bool, A > >, Idioskopos::WriteOnlyPropertyBase< int >, Idioskopos::WriteOnlyPropertyBase< VerySimple >, Idioskopos::WriteOnlyPropertyBase< std::vector< double > >, and Idioskopos::WriteOnlyPropertyBase< IdioskoposArray< int, 10 > >.
Glib::ustring Idioskopos::Object::value | ( | ) | [virtual] |
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] |
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] |
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] |
Signal emitted when underlying data is changed.