Clipper
|
Class for holding a list of labelled properties of arbitrary types. More...
#include <clipper_memory.h>
Public Member Functions | |
PropertyManager () | |
null constructor | |
PropertyManager (const PropertyManager &mgr) | |
copy constructor More... | |
PropertyManager & | operator= (const PropertyManager &mgr) |
assign op More... | |
~PropertyManager () | |
destructor More... | |
PropertyManager & | copy (const PropertyManager &mgr) |
copy manager More... | |
bool | set_property (const std::string &label, const Property_base &property) |
add a labelled property to the list | |
const Property_base & | get_property (const std::string &label) const |
get a labelled property from the list More... | |
bool | exists_property (const std::string &label) const |
test for property More... | |
bool | delete_property (const std::string &label) |
delete property | |
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:
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.
clipper::PropertyManager::PropertyManager | ( | const PropertyManager & | mgr | ) |
copy constructor
Makes copies of all property objects.
clipper::PropertyManager::~PropertyManager | ( | ) |
destructor
Deletes all stored properties.
PropertyManager & clipper::PropertyManager::operator= | ( | const PropertyManager & | mgr | ) |
assign op
Clears manager then makes copies of all property objects.
PropertyManager & clipper::PropertyManager::copy | ( | const PropertyManager & | mgr | ) |
copy manager
This function is used by the copy constructor and assignement operator and is also useful for derived classes.
const Property_base & clipper::PropertyManager::get_property | ( | const std::string & | label | ) | const |
get a labelled property from the list
label | The label of the property to be returned. |
bool clipper::PropertyManager::exists_property | ( | const std::string & | label | ) | const |
test for property
label | The label of the property to be tested. |