MIRA
|
Meta Type information. More...
#include <serialization/MetaSerializer.h>
Public Types | |
enum | Type { TYPE_INVALID = 0, TYPE_VOID, TYPE_CLASS, TYPE_ATOMIC, TYPE_UINT8, TYPE_INT8, TYPE_UINT16, TYPE_INT16, TYPE_UINT32, TYPE_INT32, TYPE_UINT64, TYPE_INT64, TYPE_FLOAT, TYPE_DOUBLE, TYPE_BOOL, TYPE_STRING, TYPE_ENUMERATION, TYPE_VERSION, LAST_TYPE_FIELD } |
The different types (ranging from fundamental types to user-defined class). More... | |
enum | TypeQualifier { NO_QUALIFIER =0, FIRST_TYPE_QUALIFIER = 0x20, TYPE_COLLECTION = FIRST_TYPE_QUALIFIER, TYPE_POINTER, TYPE_PROPERTY } |
Additional qualifiers. More... | |
Public Member Functions | |
TypeMeta (uint8 version=2) | |
template<typename Reflector > | |
void | reflect (Reflector &r) |
template<typename BinaryStream > | |
void | reflect (ConcreteBinaryDeserializer< BinaryStream, 0 > &r) |
template<typename BinaryStream > | |
void | reflect (ConcreteBinarySerializer< BinaryStream, 0 > &r) |
void | addQualifier (TypeQualifier qualifier) |
Adds a type qualifier. More... | |
void | setBaseAtomicType (Type type) |
Sets the datatype to one of the built-in atomic types (TYPE_INT,FLOAT, etc). More... | |
void | setAtomicType (const std::string &typenam) |
Sets an atomic type with the specified typename. More... | |
template<typename T > | |
void | setAtomicType () |
Same as above, but typename is extracted from T. More... | |
void | setClassType (const std::string &identifier) |
Sets the data type to TYPE_CLASS and sets the class identifier. More... | |
template<typename T > | |
void | setType () |
Sets the datatype. More... | |
Type | getType () const |
Returns the type flag which is the first item in the vector. More... | |
bool | hasQualifier () const |
Returns true, if the type meta contains qualifiers. More... | |
int | qualifierCount () const |
Returns the number of qualifiers. More... | |
TypeQualifier | getQualifier (int i=0) const |
Returns the i-th type qualifier, or NO_QUALIFIER if there is no such qualifier. More... | |
void | removeQualifiers (int n) |
Removes the n last qualifiers. More... | |
const std::string & | getIdentifier () const |
Returns the identifier of the user-defined atomic type or class type. More... | |
std::string | getTypename () const |
Returns the typename. More... | |
std::string | toString () const |
Converts the whole type information including qualifiers to a human-readable string. More... | |
int | size () const |
Returns the number of items (the type item + qualifier items) More... | |
uint8 | version () const |
Returns the metatype format version. More... | |
Public Attributes | |
T | elements |
STL member. More... | |
Meta Type information.
This includes the datatype itself (int, float, ... string or user-defined class), in the case of a class, the class identifier, and optional qualifiers that specify if the type is a pointer, a collection, etc.
The TypeMeta is realized as vector of flags. The first item in the vector indicates the data type. This first type item can be followed by multiple qualifier items.
enum Type |
The different types (ranging from fundamental types to user-defined class).
Only one such type flag is allowed per TypeMeta.
enum TypeQualifier |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Adds a type qualifier.
Note, that the data type must have been set already.
|
inline |
Sets the datatype to one of the built-in atomic types (TYPE_INT,FLOAT, etc).
void setAtomicType | ( | const std::string & | typenam | ) |
Sets an atomic type with the specified typename.
This can be a built-in atomic type like int, float, etc. or a user defined atomic type.
|
inline |
Same as above, but typename is extracted from T.
|
inline |
Sets the data type to TYPE_CLASS and sets the class identifier.
|
inline |
Sets the datatype.
This automatically differentiates between atomic types and class types.
|
inline |
Returns the type flag which is the first item in the vector.
|
inline |
Returns true, if the type meta contains qualifiers.
|
inline |
Returns the number of qualifiers.
|
inline |
Returns the i-th type qualifier, or NO_QUALIFIER if there is no such qualifier.
|
inline |
Removes the n last qualifiers.
If n is larger than the number of qualifiers, all qualifiers are removed.
|
inline |
Returns the identifier of the user-defined atomic type or class type.
For built-in atomic types (int,float) this returns an empty string.
std::string getTypename | ( | ) | const |
Returns the typename.
For user-defined atomic types and class types this is the previously set identifier. For built-in types this is the typename.
std::string toString | ( | ) | const |
Converts the whole type information including qualifiers to a human-readable string.
|
inline |
Returns the number of items (the type item + qualifier items)
|
inline |
Returns the metatype format version.
|
inherited |
STL member.