Specialized type of property for arrays.
More...
#include <arrayproperty.hpp>
|
| | ArrayProperty (IdRef name, ValueKind elementType, bool dynamic) |
| | Construct the property from its description. More...
|
| |
|
virtual | ~ArrayProperty () |
| | Destructor.
|
| |
| ValueKind | elementType () const |
| | Get the type of the array elements. More...
|
| |
| bool | dynamic () const |
| | Check if the array is dynamic. More...
|
| |
| size_t | size (const UserObject &object) const |
| | Get the current size of the array. More...
|
| |
| void | resize (const UserObject &object, size_t newSize) const |
| | Resize the array. More...
|
| |
| Value | get (const UserObject &object, size_t index) const |
| | Get an element of the array for a given object. More...
|
| |
| void | set (const UserObject &object, size_t index, const Value &value) const |
| | Set an element of the array for a given object. More...
|
| |
| void | insert (const UserObject &object, size_t before, const Value &value) const |
| | Insert a new element into the array. More...
|
| |
| void | remove (const UserObject &object, size_t index) const |
| | Remove an element from the array. More...
|
| |
| void | accept (ClassVisitor &visitor) const override |
| | Accept the visitation of a ClassVisitor. More...
|
| |
|
virtual | ~Property () |
| | Destructor.
|
| |
| IdReturn | name () const |
| | Get the name of the property. More...
|
| |
| ValueKind | kind () const |
| | Get the type of the property. More...
|
| |
| virtual bool | isReadable () const |
| | Check if the property can be read. More...
|
| |
| virtual bool | isWritable () const |
| | Check if the property can be written. More...
|
| |
| Value | get (const UserObject &object) const |
| | Get the current value of the property for a given object. More...
|
| |
| void | set (const UserObject &object, const Value &value) const |
| | Set the current value of the property for a given object. More...
|
| |
Specialized type of property for arrays.
◆ ArrayProperty()
| ponder::ArrayProperty::ArrayProperty |
( |
IdRef |
name, |
|
|
ValueKind |
elementType, |
|
|
bool |
dynamic |
|
) |
| |
Construct the property from its description.
- Parameters
-
| name | Name of the property |
| elementType | Type of the property |
| dynamic | Tells if the array is dynamic or not |
◆ accept()
| void ponder::ArrayProperty::accept |
( |
ClassVisitor & |
visitor | ) |
const |
|
overridevirtual |
◆ dynamic()
| bool ponder::ArrayProperty::dynamic |
( |
| ) |
const |
Check if the array is dynamic.
If the array is not dynamic, the insert and remove functions are disabled.
- Returns
- True if the array is dynamic, false otherwise
◆ elementType()
| ValueKind ponder::ArrayProperty::elementType |
( |
| ) |
const |
Get the type of the array elements.
- Returns
- Type of elements
◆ get()
| Value ponder::ArrayProperty::get |
( |
const UserObject & |
object, |
|
|
size_t |
index |
|
) |
| const |
Get an element of the array for a given object.
- Parameters
-
| object | Object |
| index | Index of the element to get |
- Returns
- Value of the index-th element
- Exceptions
-
◆ insert()
| void ponder::ArrayProperty::insert |
( |
const UserObject & |
object, |
|
|
size_t |
before, |
|
|
const Value & |
value |
|
) |
| const |
Insert a new element into the array.
This function will throw an error if the array is not dynamic
- Parameters
-
| object | Object |
| before | Index before which the new element will be inserted |
| value | Value of the element to insert |
- Exceptions
-
◆ remove()
| void ponder::ArrayProperty::remove |
( |
const UserObject & |
object, |
|
|
size_t |
index |
|
) |
| const |
Remove an element from the array.
This function will throw an error if the array is not dynamic
- Parameters
-
| object | Object |
| index | Index of the element to remove |
- Exceptions
-
◆ resize()
| void ponder::ArrayProperty::resize |
( |
const UserObject & |
object, |
|
|
size_t |
newSize |
|
) |
| const |
Resize the array.
If size is lesser than the current size of the array, the last elements will be removed; if size is greater than the current size of the array, default-constructed elements will be added at the end.
This function will throw an error if the array is not dynamic
- Parameters
-
| object | Object |
| newSize | New size of the array |
- Exceptions
-
| InvalidObject | object has an invalid value |
| InvalidAccess | array is not writable or not dynamic |
| InvalidIndex | index is out of range |
◆ set()
| void ponder::ArrayProperty::set |
( |
const UserObject & |
object, |
|
|
size_t |
index, |
|
|
const Value & |
value |
|
) |
| const |
Set an element of the array for a given object.
- Parameters
-
| object | Object |
| index | Index of the element to get |
| value | New value to assign to the element |
- Exceptions
-
◆ size()
| size_t ponder::ArrayProperty::size |
( |
const UserObject & |
object | ) |
const |
Get the current size of the array.
- Parameters
-
- Returns
- Number of elements in the array
- Exceptions
-
The documentation for this class was generated from the following file:
- include/ponder/arrayproperty.hpp