![]() |
SCENE C++ API
2.0.31
|
Storage class which may contain different common data types. More...
#include <lsattribute.h>
Public Member Functions | |
LSAttribute () | |
Constructs an invalid attribute. More... | |
virtual | ~LSAttribute () |
Destroys the attribute. More... | |
LSAttribute (const LSAttribute &attribute) | |
Constructs a attribute containing a copy of the attribute attribute. More... | |
template<class T > | |
LSAttribute (const T &value) | |
Constructs an LSAttribute of the type defined by the constructor parameter. More... | |
bool | isValid () const |
Checks whether the attribute is valid. More... | |
template<class T > | |
T | getValue () const |
Gets the attribute value. More... | |
template<class T > | |
void | setValue (const T &value) |
Sets the attribute value. More... | |
LSString | toString () const |
Gets the attribute value as a string representation. More... | |
bool | fromString (LSString value) |
Sets the attribute value based on the string value. More... | |
LSString | getType () const |
Gets the type of the attribute value. More... | |
bool | hasType (LSString type) const |
Checks whether the attribute value is of a given type. More... | |
template<class T > | |
bool | hasType () const |
Checks whether the attribute value is of a given type. More... | |
LSAttribute & | operator= (const LSAttribute &from) |
Assignment Operator. More... | |
void * | operator new (size_t tSize) |
Default allocation function. More... | |
void | operator delete (void *p) |
Default deallocation function. More... | |
Storage class which may contain different common data types.
The LSAttribute class is a storage class which is able to store a single value of type getType(). All types can also be serialized to strings and read from strings using the toString() and fromString() methods.
LSAttribute | ( | ) |
Constructs an invalid attribute.
|
virtual |
Destroys the attribute.
LSAttribute | ( | const LSAttribute & | attribute | ) |
Constructs a attribute containing a copy of the attribute attribute.
LSAttribute | ( | const T & | value | ) |
Constructs an LSAttribute of the type defined by the constructor parameter.
For a list of possible value types see value types.
bool isValid | ( | ) | const |
Checks whether the attribute is valid.
T getValue | ( | ) | const |
Gets the attribute value.
If the attribute value isn't of the type T a default instance of the type T will be returned. You can test whether the attribute value is of a certain type using the hasType() function. For a list of possible value types see value types.
void setValue | ( | const T & | value | ) |
Sets the attribute value.
If a value of a different type than the current attribute type is assigned the attribute type will change. For a list of possible value types see value types.
LSString toString | ( | ) | const |
Gets the attribute value as a string representation.
bool fromString | ( | LSString | value | ) |
Sets the attribute value based on the string value.
LSString getType | ( | ) | const |
Gets the type of the attribute value.
bool hasType | ( | LSString | type | ) | const |
Checks whether the attribute value is of a given type.
bool hasType | ( | ) | const |
Checks whether the attribute value is of a given type.
The template type T is used for the check. For a list of possible value types see value types.
LSAttribute& operator= | ( | const LSAttribute & | from | ) |
Assignment Operator.
Assigns the value of the given attribute to this attribute. This also sets the attribute type of this attribute to the type of the attribute from which the values is assigned.
void* operator new | ( | size_t | tSize | ) |
Default allocation function.
Overloaded in order to always allocate LSString objects in the context of this module.
void operator delete | ( | void * | p | ) |
Default deallocation function.
Overloaded in order to always deallocate LSString objects in the context of this module.