Class for holding a list of labelled properties of arbitrary types. More...
#include <clipper_memory.h>
Class for holding a list of labelled properties of arbitrary types.
To add a property list to an object, derive it from this class, or include a member and mirror the methods. To add a property, simply call insert_property(label,property). Properties must be objects derived from clipper::Propert_base. Usually, you can just use the template form, clipper::Property<T>.
To read a property which you know exists and is of a particular type, use:
const T& obj = dynamic_cast<const Property<T>& >(list.get_property( label )).value();
If you are unsure if a property is present, use the exists_property(label) method. If you are unsure of a property's type, dynamic cast a pointer and test for null. e.g.
if ( !list.exists_property( label ) ) { error("No such property"); } const Property_base* ptr = &list.get_property( label ); if ( dynamic_cast<const T*>(ptr) == NULL ) { error("Wrong type"); } const T& obj = *(dynamic_cast<const T*>(ptr));
destructor
Deletes all stored properties.
copy manager
This function is used by the copy constructor and assignement operator and is also useful for derived classes.
Referenced by operator=(), and PropertyManager().
get a labelled property from the list
References clipper::Message::message().
test for property