#include <DynamicObject.h>

Public Member Functions | |
| virtual void | merge (const DynamicObject *pObject)=0 |
| virtual void | adoptiveMerge (DynamicObject *pObject)=0 |
| template<class T> | |
| bool | setAttribute (const std::string &name, const T &value) |
| virtual bool | adoptAttribute (const std::string &name, DataVariant &value)=0 |
| template<class T> | |
| bool | setAttributeByPath (const std::string &path, const T &value) |
| virtual bool | adoptAttributeByPath (const std::string &path, DataVariant &value)=0 |
| template<class T> | |
| bool | setAttributeByPath (const std::string pComponents[], const T &value) |
| virtual bool | adoptAttributeByPath (const std::string pComponents[], DataVariant &value)=0 |
| virtual const DataVariant & | getAttribute (const std::string &name) const =0 |
| virtual DataVariant & | getAttribute (const std::string &name)=0 |
| virtual const DataVariant & | getAttributeByPath (const std::string &path) const =0 |
| virtual DataVariant & | getAttributeByPath (const std::string &path)=0 |
| virtual const DataVariant & | getAttributeByPath (const std::string pComponents[]) const =0 |
| virtual DataVariant & | getAttributeByPath (const std::string pComponents[])=0 |
| virtual void | getAttributeNames (std::vector< std::string > &attributeNames) const =0 |
| virtual unsigned int | getNumAttributes () const =0 |
| virtual const DataVariant & | findFirstOf (const QRegExp &name, const QRegExp &value) const =0 |
| virtual DataVariant & | findFirstOf (const QRegExp &name, const QRegExp &value)=0 |
| virtual bool | removeAttribute (const std::string &name)=0 |
| virtual bool | removeAttributeByPath (const std::string pComponents[])=0 |
| virtual bool | removeAttributeByPath (const std::string &path)=0 |
| virtual bool | compare (const DynamicObject *pObject) const =0 |
| virtual void | clear ()=0 |
Static Public Member Functions | |
| static const std::string & | signalAttributeAdded () |
| static const std::string & | signalAttributeModified () |
| static const std::string & | signalAttributeRemoved () |
| static const std::string & | signalCleared () |
Protected Member Functions | |
| virtual | ~DynamicObject () |
Dynamic Object refers to a class that allows attributes to be added during runtime. Many classes extend the Dynamic Object to provide future support for new attributes without changing the class specification.
This subclass of Subject will notify upon the following conditions:
Definition at line 41 of file DynamicObject.h.
| virtual DynamicObject::~DynamicObject | ( | ) | [protected, virtual] |
This should be destroyed by calling ObjectFactory::destroyObject.
Definition at line 530 of file DynamicObject.h.
| static const std::string& DynamicObject::signalAttributeAdded | ( | ) | [static] |
Emitted just after a new attribute is added with boost::any<std::pair<std::string, DataVariant*> > containing the attribute name and value.
Definition at line 49 of file DynamicObject.h.
| static const std::string& DynamicObject::signalAttributeModified | ( | ) | [static] |
Emitted just after an existing attribute is modified with boost::any<std::pair<std::string, DataVariant*> > containing the attribute name and the new value.
Definition at line 56 of file DynamicObject.h.
| static const std::string& DynamicObject::signalAttributeRemoved | ( | ) | [static] |
Emitted just before an existing attribute is removed with boost::any<std::pair<std::string, DataVariant*> > containing the name and value of the attribute that will be removed. The attribute value is guaranteed to be valid when the signal is emitted.
Definition at line 64 of file DynamicObject.h.
| static const std::string& DynamicObject::signalCleared | ( | ) | [static] |
Emitted just before the dynamic object is cleared. All existing attribute values are guaranteed to be valid when the signal is emitted.
Definition at line 70 of file DynamicObject.h.
| virtual void DynamicObject::merge | ( | const DynamicObject * | pObject | ) | [pure virtual] |
Sets attributes from those of another dynamic object.
This method parses the given object's attributes, adding them to or setting them in this object. Any existing attributes that are not contained in the given object are not removed.
| pObject | The object from which to set this object's attributes. Cannot be NULL. |
| virtual void DynamicObject::adoptiveMerge | ( | DynamicObject * | pObject | ) | [pure virtual] |
Sets attributes from those of another dynamic object.
This method parses the given object's attributes, adopting them into the destination object. Any existing attributes that are not contained in the given object are not removed. The attributes of the given dynamic object will be modified in an undefined manner.
This method is intended for use when the given object will be discarded after being merged into the destination object and can be much faster than using the merge() method which sets the attributes rather than adopting them.
| pObject | The object from which to adopt into this object's attributes. Cannot be NULL. |
| bool DynamicObject::setAttribute | ( | const std::string & | name, | |
| const T & | value | |||
| ) |
Creates a new attribute or sets an existing dynamic attribute.
This method is preferred to adoptAttribute() unless you are passing an already constructed DataVariant in which case, adoptAttribute() will be faster because it avoids a deep copy.
| name | The name of the attribute to set the value. If an attribute with the given name does not exist, an attribute is added. | |
| value | The attribute's value. |
true if the attributes was successfully created or set, otherwise false.Definition at line 138 of file DynamicObject.h.
| virtual bool DynamicObject::adoptAttribute | ( | const std::string & | name, | |
| DataVariant & | value | |||
| ) | [pure virtual] |
Creates a new attribute or sets an existing dynamic attribute.
This method should not be used; generally setAttribute() is preferred. This method and setAttribute() have identical performance characteristics and setAttribute() is easier to call. This method is faster than setAttribute() though if you have an already constructed DataVariant and is preferred to setAttribute() in this case.
| name | The name of the attribute to set the value. If an attribute with the given name does not exist, an attribute is added. | |
| value | A variant holding the attribute's value. On return, this will contain the value previously stored in the DynamicObject. If the value did not previously exist in the DynamicObject, then this will contain an invalid DataVariant. |
true if the attributes was successfully created or set, otherwise false.| bool DynamicObject::setAttributeByPath | ( | const std::string & | path, | |
| const T & | value | |||
| ) |
Sets the value within the DynamicObject hierarchy as described in the path.
This method will create DynamicObjects as needed to set the value. This method is preferred to adoptAttributeByPath() unless you are passing an already constructed DataVariant in which case, adoptAttributeByPath() will be faster because it avoids a deep copy.
| path | The path of names within names for the DynamicObjects, separated by '/'. A slash in the name can be represented by escaping the slash with another slash (e.g. '//'). If the path ends in a single slash, it will be ignored. | |
| value | The value to set into the DynamicObject. |
true if the operation was a success, false otherwise. This method will fail if any object along the path already exists but is not a DynamicObject.Definition at line 198 of file DynamicObject.h.
| virtual bool DynamicObject::adoptAttributeByPath | ( | const std::string & | path, | |
| DataVariant & | value | |||
| ) | [pure virtual] |
Sets the value within the DynamicObject hierarchy as described in the path.
This method should not be used; generally setAttributeByPath() is preferred. This method and setAttributeByPath() have identical performance characteristics and setAttributeByPath() is easier to call. This method is faster than setAttributeByPath() though if you have an already constructed DataVariant and is preferred to setAttributeByPath() in this case.
| path | The path of names within names for the DynamicObjects, separated by '/'. A slash in the name can be represented by escaping the slash with another slash (e.g. '//'). If the path ends in a single slash, it will be ignored. | |
| value | The value to set into the DynamicObject. On return, this will contain the value previously stored in the DynamicObject. If the value did not previously exist in the DynamicObject, then this will contain an invalid DataVariant. |
true if the operation was a success, false otherwise. This method will fail if any object along the path already exists but is not a DynamicObject.| bool DynamicObject::setAttributeByPath | ( | const std::string | pComponents[], | |
| const T & | value | |||
| ) |
Sets the value within the DynamicObject hierarchy as described in the path.
This method will create DynamicObjects as needed to set the value. This method is preferred to adoptAttributeByPath() unless you are passing an already constructed DataVariant in which case, adoptAttributeByPath() will be faster because it avoids a deep copy.
| pComponents | An array of path components to the desired object as std::strings. Must end with END_METADATA_NAME. | |
| value | The value to set into the DynamicObject. |
true if the operation was a success, false otherwise. This method will fail if any object along the path already exists but is not a DynamicObject.Definition at line 260 of file DynamicObject.h.
| virtual bool DynamicObject::adoptAttributeByPath | ( | const std::string | pComponents[], | |
| DataVariant & | value | |||
| ) | [pure virtual] |
Sets the value within the DynamicObject hierarchy as described in the path.
This method should not be used; generally setAttributeByPath() is preferred. This method and setAttributeByPath() have identical performance characteristics and setAttributeByPath() is easier to call. This method is faster than setAttributeByPath() though if you have an already constructed DataVariant and is preferred to setAttributeByPath() in this case.
| pComponents | An array of path components to the desired object as std::strings. Must end with END_METADATA_NAME. | |
| value | The value to set into the DynamicObject. On return, this will contain the value previously stored in the DynamicObject. If the value did not previously exist in the DynamicObject, then this will contain an invalid DataVariant. |
true if the operation was a success, false otherwise. This method will fail if any object along the path already exists but is not a DynamicObject.| virtual const DataVariant& DynamicObject::getAttribute | ( | const std::string & | name | ) | const [pure virtual] |
Returns an attribute value.
| name | The name of the attribute for which to get the value. |
| virtual DataVariant& DynamicObject::getAttribute | ( | const std::string & | name | ) | [pure virtual] |
Returns an attribute value.
| name | The name of the attribute for which to get the value. |
| virtual const DataVariant& DynamicObject::getAttributeByPath | ( | const std::string & | path | ) | const [pure virtual] |
Get the value within the DynamicObject hierarchy as described in the path.
| path | The path of names within names for the DynamicObjects, separated by '/'. A slash in the name can be represented by escaping the slash with another slash (e.g. '//'). If the path ends in a single slash, it will be ignored. |
| virtual DataVariant& DynamicObject::getAttributeByPath | ( | const std::string & | path | ) | [pure virtual] |
Get the value within the DynamicObject hierarchy as described in the path.
| path | The path of names within names for the DynamicObjects, separated by '/'. A slash in the name can be represented by escaping the slash with another slash (e.g. '//'). If the path ends in a single slash, it will be ignored. |
| virtual const DataVariant& DynamicObject::getAttributeByPath | ( | const std::string | pComponents[] | ) | const [pure virtual] |
Get the value within the DynamicObject hierarchy as described in the path.
| pComponents | An array of path components to the desired object as std::strings. Must end with END_METADATA_NAME. |
| virtual DataVariant& DynamicObject::getAttributeByPath | ( | const std::string | pComponents[] | ) | [pure virtual] |
Get the value within the DynamicObject hierarchy as described in the path.
| pComponents | An array of path components to the desired object as std::strings. Must end with END_METADATA_NAME. |
| virtual void DynamicObject::getAttributeNames | ( | std::vector< std::string > & | attributeNames | ) | const [pure virtual] |
Retrieves the names of all attributes in the object.
| attributeNames | A vector of strings that is populated with the attribute names. |
| virtual unsigned int DynamicObject::getNumAttributes | ( | ) | const [pure virtual] |
Retrieves the total number of attributes in the object.
| virtual const DataVariant& DynamicObject::findFirstOf | ( | const QRegExp & | name, | |
| const QRegExp & | value | |||
| ) | const [pure virtual] |
Searches the object for an attribute with a given name and/or value.
| name | The name of the attribute for which to search, which can be a fixed string or any regular expression supported by QRegExp. If name is empty, then the first attribute found with the given value is returned. | |
| value | The value of the attribute for which to search, which can be a fixed string or any regular expression supported by QRegExp. If value is empty, then the first attribute found with the given name is returned. |
| virtual DataVariant& DynamicObject::findFirstOf | ( | const QRegExp & | name, | |
| const QRegExp & | value | |||
| ) | [pure virtual] |
Searches the object for an attribute with a given name and/or value.
| name | The name of the attribute for which to search, which can be a fixed string or any regular expression supported by QRegExp. If name is empty, then the first attribute found with the given value is returned. | |
| value | The value of the attribute for which to search, which can be a fixed string or any regular expression supported by QRegExp. If value is empty, then the first attribute found with the given name is returned. |
| virtual bool DynamicObject::removeAttribute | ( | const std::string & | name | ) | [pure virtual] |
Removes an attribute from the object.
| name | The name of the attribute to remove. |
true if the attribute was was successfully removed from the object, otherwise false.| virtual bool DynamicObject::removeAttributeByPath | ( | const std::string | pComponents[] | ) | [pure virtual] |
Removes an attribute from the object.
| pComponents | An array of path components to the desired object as std::strings. Must end with END_METADATA_NAME. |
true if the attribute was was successfully removed from the object, otherwise false.| virtual bool DynamicObject::removeAttributeByPath | ( | const std::string & | path | ) | [pure virtual] |
Removes an attribute from the object.
| path | The path of names within names for the DynamicObjects, separated by '/'. A slash in the name can be represented by escaping the slash with another slash (e.g. '//'). If the path ends in a single slash, it will be ignored. |
true if the attribute was was successfully removed from the object, otherwise false.| virtual bool DynamicObject::compare | ( | const DynamicObject * | pObject | ) | const [pure virtual] |
Compares all attributes in this DynamicObject with those of another DynamicObject.
| pObject | The DynamicObject with which to compare attributes in this DynamicObject. This method does nothing and returns false if NULL is passed in. |
true if all attributes in pObject are present and have the same values as the attributes in this DynamicObject; otherwise returns false. | virtual void DynamicObject::clear | ( | ) | [pure virtual] |
Erases all attributes in the object.