|
MorphoGraphX
|
Class representing a property in an element. More...
#include <PlyFile.hpp>
Public Types | |
| enum | KIND { VALUE, LIST } |
| Kind of a property. More... | |
Public Member Functions | |
| Property (const QString &name, Element *el=0) | |
| Constructor of a property. More... | |
| ~Property () | |
| The destructor takes charge to detach the property from any element that contains it. | |
| void | allocate (size_t size) |
Allocate the memory for the property, as long as memType is not INVALID_TYPE. More... | |
| void | deallocate () |
| Free the memory occupied by the property. | |
| template<typename T > | |
| std::vector< std::vector< T > > * | list () |
| Return a pointer to the list help by the property as long as the property is a list and the type is correct. | |
| template<typename T > | |
| std::vector< T > * | value () |
| Return a pointer to the values help by the property as long as the property is a value and the type is correct. | |
| template<typename T > | |
| const std::vector< std::vector< T > > * | list () const |
| Return a pointer to the list help by the property as long as the property is a list and the type is correct. | |
| template<typename T > | |
| const std::vector< T > * | value () const |
| Return a pointer to the values help by the property as long as the property is a value and the type is correct. | |
| bool | error (const QString &str) const |
| Print an error on the standard output and return false. | |
| const QString & | name () const |
| Name of the property. | |
| TYPE | fileType () const |
| File type of the property value. | |
| TYPE | memType () const |
| Memory type of the property value. | |
| TYPE | sizeType () const |
| File type of the size of the property list. | |
| KIND | kind () const |
| Kind of the property. | |
| size_t | size () const |
| Size of the property, that is the number of elements stored in it. | |
| bool | rename (const QString &n) |
| Change the name of the property, only if the new name doesn't conflict with one of the other properties in the parent element. | |
| void | setFileType (TYPE ft) |
| Change the file type of the property. | |
| void | setMemType (TYPE mt) |
| Change the memory type of the property. More... | |
| void | setSizeType (TYPE st) |
| Change the file type of the size of the property. | |
| void | setKind (KIND k) |
| Change the kind of the property. More... | |
| Element * | parent () |
| Get the element containing the property, if any. | |
| const Element * | parent () const |
| Get the element containing the property, if any. | |
| bool | setParent (Element *parent) |
| Change the parent, only if the new parent doesn't already have a property with the same name. | |
| void | resize (size_t s) |
| Resize the property. More... | |
Protected Attributes | |
| QString | _name |
| TYPE | _fileType |
| TYPE | _memType |
| TYPE | _sizeType |
| KIND | _kind |
| Element * | _parent |
| void * | _content |
| size_t | _size |
Class representing a property in an element.
Constructor of a property.
| name | Name of the property |
| el | Element containing the property |
The name of the property must be unique in the element. If this is not the case, the property won't be attached to the element.
| void mgx::util::PlyFile::Property::allocate | ( | size_t | size | ) |
Allocate the memory for the property, as long as memType is not INVALID_TYPE.
All the vectors are initialized with default-constructed values.
| void mgx::util::PlyFile::Property::resize | ( | size_t | s | ) |
Resize the property.
If the property is already allocated, it should leep the min(size,s) first property values.
| void mgx::util::PlyFile::Property::setKind | ( | KIND | k | ) |
Change the kind of the property.
| void mgx::util::PlyFile::Property::setMemType | ( | TYPE | mt | ) |
Change the memory type of the property.
If the property is already allocated, the existing values will be converted to the new type.
1.8.11