Idioskopos::ReadOnlyPropertyBase< IdioskoposArray< X, N > > Class Template Reference

#include <idioskopos/readonlypropertybase.h>

Inheritance diagram for Idioskopos::ReadOnlyPropertyBase< IdioskoposArray< X, N > >:

Inheritance graph
[legend]
List of all members.

Detailed Description

template<typename X, size_t N>
class Idioskopos::ReadOnlyPropertyBase< IdioskoposArray< X, N > >

Template specialization of ReadOnlyPropertyBase for std::array.


Public Types

typedef IdioskoposPointer<
ReadOnlyPropertyBase
pointer
typedef IdioskoposArray< X,
N > 
value_type
typedef std::set< Object * > Objects

Public Member Functions

 IDIOSKOPOS_OBJECT (ReadOnlyPropertyBase)
 ReadOnlyPropertyBase (const Glib::ustring &name, sigc::slot< void > slot=sigc::slot< void >())
 Default constructor that doesn't do much.
 ReadOnlyPropertyBase (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 ~ReadOnlyPropertyBase ()
 Destructor.
virtual const IdioskoposArray<
X, N > & 
get () const=0
 The canonical get() accessor method.
virtual IdioskoposArray< X,
N > * 
get_pointer ()=0
 Should return a pointer to the contained object, or NULL if pointers are not allowed.
virtual const IdioskoposArray<
X, N > * 
get_pointer () const
 operator const IdioskoposArray () const
 Allows for implicit casts to the contained type.
const IdioskoposArray< X,
N > & 
operator() () const
 Function call syntax.
IdioskoposArray< X, N > * operator-> ()
 A convenience operator when the property contains a class.
virtual Glib::ustring xml (int indent=-1)
 The get_xml function is a template method with full specializations for known types.
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 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 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 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 Objectoperator[] (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 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.


Constructor & Destructor Documentation

template<typename X, size_t N>
Idioskopos::ReadOnlyPropertyBase< IdioskoposArray< X, N > >::ReadOnlyPropertyBase ( const Glib::ustring &  name,
sigc::slot< void >  slot = sigc::slot<void>() 
) [inline]

Default constructor that doesn't do much.

template<typename X, size_t N>
Idioskopos::ReadOnlyPropertyBase< IdioskoposArray< X, N > >::ReadOnlyPropertyBase ( 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.

template<typename X, size_t N>
virtual Idioskopos::ReadOnlyPropertyBase< IdioskoposArray< X, N > >::~ReadOnlyPropertyBase (  )  [inline, virtual]

Destructor.


Member Function Documentation

template<typename X, size_t N>
virtual const IdioskoposArray<X,N>& Idioskopos::ReadOnlyPropertyBase< IdioskoposArray< X, N > >::get (  )  const [pure virtual]

The canonical get() accessor method.

template<typename X, size_t N>
virtual IdioskoposArray<X,N>* Idioskopos::ReadOnlyPropertyBase< IdioskoposArray< X, N > >::get_pointer (  )  [pure virtual]

Should return a pointer to the contained object, or NULL if pointers are not allowed.

template<typename X, size_t N>
Idioskopos::ReadOnlyPropertyBase< IdioskoposArray< X, N > >::operator const IdioskoposArray (  )  const [inline]

Allows for implicit casts to the contained type.

template<typename X, size_t N>
const IdioskoposArray<X,N>& Idioskopos::ReadOnlyPropertyBase< IdioskoposArray< X, N > >::operator() (  )  const [inline]

Function call syntax.

Get the value of the property with property() notation.

Returns:
the current value of the property

template<typename X, size_t N>
IdioskoposArray<X,N>* Idioskopos::ReadOnlyPropertyBase< IdioskoposArray< X, N > >::operator-> (  )  [inline]

A convenience operator when the property contains a class.

Allows class method to be accessed using notation: property->class_method()

template<typename X, size_t N>
virtual Glib::ustring Idioskopos::ReadOnlyPropertyBase< IdioskoposArray< X, N > >::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< IdioskoposArray< X, N > >.

template<typename X, size_t N>
virtual Glib::ustring Idioskopos::ReadOnlyPropertyBase< IdioskoposArray< X, N > >::value (  )  [inline, virtual]

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.

template<typename X, size_t N>
const std::type_info& Idioskopos::ReadOnlyPropertyBase< IdioskoposArray< X, N > >::type (  )  const [inline, virtual]

Returns the RTTI type id of the contained type.

Implements Idioskopos::Object.

Reimplemented in Idioskopos::PropertyBase< IdioskoposArray< X, N > >.

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.


Member Data Documentation

sigc::signal<void> Idioskopos::Object::m_signal_value_changed [protected, inherited]

Signal emitted when underlying data is changed.


The documentation for this class was generated from the following file:
Generated on Thu Jan 11 00:26:44 2007 by  doxygen 1.5.1