|
MorphoGraphX
|
Class representing an element. More...
#include <PlyFile.hpp>
Public Member Functions | |
| Element (const QString &name, PlyFile *parent=0) | |
| Element constructor. More... | |
| ~Element () | |
| The destructor takes care of detaching the element from the PLY file that contains it. | |
| void | allocate () |
| Allocate the memory for all the properties attached to the element. | |
| void | clear () |
| Remove any property attached to this element. More... | |
| size_t | nbProperties () const |
| Number of properties in the element. | |
| size_t | size () const |
| Number of items in the element. | |
| void | resize (size_t n) |
| Change the number of items in the element. More... | |
| QStringList | properties () const |
| Get the list of property names. | |
| Property * | property (size_t pos) |
| Access a property by index number. | |
| const Property * | property (size_t pos) const |
| Access a property by index number. | |
| Property * | property (const QString &name) |
| Access a property by name. | |
| const Property * | property (const QString &name) const |
| Access a property by name. | |
| Property * | createValue (const QString &name, TYPE file, TYPE mem=INVALID_TYPE) |
| Create a new value property if the name doesn't already exist. More... | |
| Property * | createList (const QString &name, TYPE size, TYPE file, TYPE mem=INVALID_TYPE) |
| Create a new value property if the name doesn't already exist. More... | |
| bool | error (const QString &str) const |
| Write the error in the standard out and return false. | |
| bool | hasProperty (const QString &name) const |
Returns true if the element has a property names name. | |
| bool | attach (Property *prop) |
| Attach a property to the element. | |
| bool | detach (Property *prop) |
| Remove a property from the element. | |
| Property * | detach (const QString &name) |
| Remove a property from the element, and return the removed property. | |
| const QString & | name () const |
| Name of the element. | |
| bool | rename (const QString &n) |
| Rename the element, only if the containing PLY file doesn't already contain an element with the new name. | |
| bool | allocated () const |
| Return true if the element has been allocated. | |
| bool | setParent (PlyFile *p) |
| Change the parent of the element, only if the new parent doesn't have an element with the same name. | |
| PlyFile * | parent () |
| Get the parent of the element. | |
| const PlyFile * | parent () const |
| Get the parent of the element. | |
| void | _rename_prop (Property *prop, const QString &new_name) |
| void | _attach (Property *prop) |
| void | _detach (Property *prop) |
Protected Attributes | |
| QString | _name |
| size_t | _nbElements |
| QList< Property * > | _properties |
| QHash< QString, int > | _property_map |
| PlyFile * | _parent |
| bool | _allocated |
Class representing an element.
Element constructor.
| name | Name of the lement |
| parent | PLY file holding the element |
The name must be unique in the PLY file. If this is not the case, the element won't be attached to the PLY file and the parent won't be set.
| void mgx::util::PlyFile::Element::clear | ( | ) |
Remove any property attached to this element.
The properties will be deleted.
| Property* mgx::util::PlyFile::Element::createList | ( | const QString & | name, |
| TYPE | size, | ||
| TYPE | file, | ||
| TYPE | mem = INVALID_TYPE |
||
| ) |
Create a new value property if the name doesn't already exist.
| name | Name of the new property |
| size | File type for the size of the list |
| file | File type of the property |
| mem | Memory type. If INVALID_TYPE is specified here, the memory type will be equal to the file type |
| Property* mgx::util::PlyFile::Element::createValue | ( | const QString & | name, |
| TYPE | file, | ||
| TYPE | mem = INVALID_TYPE |
||
| ) |
Create a new value property if the name doesn't already exist.
| name | Name of the new property |
| file | File type of the property |
| mem | Memory type. If INVALID_TYPE is specified here, the memory type will be equal to the file type |
| void mgx::util::PlyFile::Element::resize | ( | size_t | n | ) |
Change the number of items in the element.
This will call Property::resize on all the properties of the element.
1.8.11