#include <idioskopos/introspectable.h>
Inheritance diagram for Idioskopos::Introspectable:
Public Types | |
typedef IdioskoposPointer< Introspectable > | pointer |
typedef std::set< Object * > | Objects |
Public Member Functions | |
IDIOSKOPOS_OBJECT_AND_REGISTRAR (Introspectable) | |
Introspectable (const Glib::ustring &name, sigc::slot< void > slot=sigc::slot< void >()) | |
Introspectable (const Glib::ustring &name, Introspectable &container, sigc::slot< void > slot=sigc::slot< void >()) | |
Object * | get_property (const Glib::ustring &name) |
bool | has_property (const Glib::ustring &name) |
bool | add_property (Object &property) |
Adds the given property that will be identified by the given name. | |
bool | add_property (Object::pointer property) |
void | remove_property (const Glib::ustring &name) |
sigc::signal< void, Object * > | signal_property_value_changed () |
sigc::signal< void, Object *, const Glib::ustring & > | signal_property_name_changed () |
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. | |
template<typename T> | |
PropertyBase< T > & | property (const Glib::ustring &name) |
template<typename T> | |
PropertyBase< T > * | property_ptr (const Glib::ustring &name) |
const std::type_info & | type () const |
Pure virtual method implemented by children to return actual RTTI information from child. | |
virtual size_t | num_properties () const |
Default parent implementation returns 0, so Introspectable must provide a new implementation that will return the true number of children. | |
virtual Glib::ustring | xml (int indent=-1) |
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 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. | |
IDIOSKOPOS_OBJECT (Object) | |
const Glib::ustring & | name () |
void | set_name (const Glib::ustring &n) |
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. | |
virtual void | set_value (const Glib::ustring &v) |
template<typename T> | |
void | set_value (const T &t) |
Static Public Member Functions | |
static pointer | create (const Glib::ustring &name, sigc::slot< void > slot=sigc::slot< void >()) |
static pointer | create (const Glib::ustring &name, Introspectable &container, sigc::slot< void > slot=sigc::slot< void >()) |
Protected Member Functions | |
void | on_property_value_changed (Object *) |
void | on_property_name_changed (const Glib::ustring &, Object *) |
virtual iterator | next_property (std::set< Object * >::iterator i) |
virtual iterator | previous_property (std::set< Object * >::iterator i) |
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 | |
std::set< Object * > | m_properties |
PropertyMap | m_property_name_map |
DynamicPropertyMap | m_dynamic_property_map |
Glib::ustring | m_separator |
sigc::signal< void, Object * > | m_signal_property_value_changed |
std::map< Object *, sigc::connection > | m_property_value_changed_connection |
sigc::signal< void, Object *, const Glib::ustring & > | m_signal_property_name_changed |
std::map< Object *, sigc::connection > | m_property_name_changed_connection |
sigc::signal< void, Object * > | m_signal_property_added |
sigc::signal< void, Object * > | m_signal_property_removed |
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. |
bool Idioskopos::Introspectable::add_property | ( | Object & | property | ) |
Adds the given property that will be identified by the given name.
sigc::signal< void, Object * > Idioskopos::Introspectable::signal_property_added | ( | ) | [virtual] |
Returns the property added signal if this is an introspectable object, otherwise throws an exception.
Reimplemented from Idioskopos::Object.
sigc::signal< void, Object * > Idioskopos::Introspectable::signal_property_removed | ( | ) | [virtual] |
Returns the property removed signal if this is an introspectable object, otherwise throws an exception.
Reimplemented from Idioskopos::Object.
const std::type_info& Idioskopos::Introspectable::type | ( | ) | const [inline, virtual] |
Pure virtual method implemented by children to return actual RTTI information from child.
Implements Idioskopos::Object.
size_t Idioskopos::Introspectable::num_properties | ( | ) | const [virtual] |
Default parent implementation returns 0, so Introspectable must provide a new implementation that will return the true number of children.
Reimplemented from Idioskopos::Object.
Glib::ustring Idioskopos::Introspectable::xml | ( | int | indent = -1 |
) | [virtual] |
Pure virtual method implemented by children to return an XML string containing both type and value information.
Implements Idioskopos::Object.
Object & Idioskopos::Introspectable::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 from Idioskopos::Object.
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 > >.
sigc::signal<void> Idioskopos::Object::m_signal_value_changed [protected, inherited] |
Signal emitted when underlying data is changed.