Accelerated Computation Engine
|
#include <emetadata.h>
Public Types | |
enum | Type { Null, Bool, Double, String, Bytes, Array, Object } |
Public Member Functions | |
EMetadata & | operator= (const EMetadata &object) |
EMetadata & | operator= (EMetadata &&object) |
EMetadata (Type type=Null) | |
EMetadata (double value) | |
EMetadata (const QString &value) | |
EMetadata (const QByteArray &value) | |
EMetadata (const EMetaArray &value) | |
EMetadata (const EMetaObject &value) | |
EMetadata (const QJsonValue &value) | |
EMetadata (const EMetadata &object) | |
EMetadata (EMetadata &&object) | |
~EMetadata () | |
QJsonValue | toJson () const |
EMetadata::Type | type () const |
bool | isNull () const |
bool | isBool () const |
bool | isDouble () const |
bool | isString () const |
bool | isBytes () const |
bool | isArray () const |
bool | isObject () const |
const bool & | toBool () const |
const double & | toDouble () const |
const QString & | toString () const |
const QByteArray & | toBytes () const |
const EMetaArray & | toArray () const |
const EMetaObject & | toObject () const |
bool & | toBool () |
double & | toDouble () |
QString & | toString () |
QByteArray & | toBytes () |
EMetaArray & | toArray () |
EMetaObject & | toObject () |
Static Public Member Functions | |
static QString | typeName (Type type) |
Friends | |
EDebug & | operator<< (EDebug &debug, const EMetadata *const meta) |
This holds a single metadata value. It is designed as a variant class which means it can hold any possible value type supported by the metadata system. Because this can be an array or object it can possibly hold additional metadata objects as children. Care should be taken to not attempt to convert a metadata object to a type that it is not. If the object attempts to convert itself to a type it is not an exception will be thrown.
enum EMetadata::Type |
Defines all possible types a metadata object can contain.
Constructs a new metadata object of the type specified.
type | The type this new object will become. |
EMetadata::EMetadata | ( | double | value | ) |
Constructs a new metadata object of the double type, setting its initial value to the one given.
value | Initial value of this new metadata object. |
EMetadata::EMetadata | ( | const QString & | value | ) |
Constructs a new metadata object of the string type, setting its initial value to the one given.
value | Initial value of this new metadata object. |
EMetadata::EMetadata | ( | const QByteArray & | value | ) |
Constructs a new metadata object of the byte array type, setting its initial value to the one given.
value | Initial value of this new metadata object. |
EMetadata::EMetadata | ( | const EMetaArray & | value | ) |
Constructs a new metadata object of the array type, setting its initial value to the one given.
value | Initial value of this new metadata object. |
EMetadata::EMetadata | ( | const EMetaObject & | value | ) |
Constructs a new metadata object of the object type, setting its initial value to the one given.
value | Initial value of this new metadata object. |
EMetadata::EMetadata | ( | const QJsonValue & | value | ) |
Constructs a new metadata object from the given JSON value. If the JSON is an array or object this will recursively create all children metadata mirroring the structure of the given JSON.
value | JSON value that is used to construct this new metadata object. |
EMetadata::EMetadata | ( | const EMetadata & | object | ) |
This creates a new metadata object that is a direct copy of the one supplied.
object | The metadata object that is copied. |
EMetadata::EMetadata | ( | EMetadata && | object | ) |
This creates a new metadata object that takes possession of the data of the one supplied as an argument. The argument's type is changed to Null.
object | The metadata object whose data is taken. |
EMetadata::~EMetadata | ( | ) |
Deletes any data this object may contain.
bool EMetadata::isArray | ( | ) | const |
Tests if this metadata is an array type.
bool EMetadata::isBool | ( | ) | const |
Tests if this metadata is a boolean type.
bool EMetadata::isBytes | ( | ) | const |
Tests if this metadata is a byte array type.
bool EMetadata::isDouble | ( | ) | const |
Tests if this metadata is a double (real number) type.
bool EMetadata::isNull | ( | ) | const |
Tests if this metadata is a null type.
bool EMetadata::isObject | ( | ) | const |
Tests if this metadata is an object type.
bool EMetadata::isString | ( | ) | const |
Tests if this metadata is a string type.
Set this object's data as a copy of the supplied metadata object.
object | The metadata object that is copied. |
Take the data of another metadata object and set this object's data with it.
object | The metadata object whose data is taken. |
const EMetaArray & EMetadata::toArray | ( | ) | const |
Returns a read only reference to this object's data cast as a meta array. If This metadata is not an array type then an exception is thrown.
EMetaArray & EMetadata::toArray | ( | ) |
Returns a reference to this object's data cast as a meta array. If This metadata is not an array type then an exception is thrown.
const bool & EMetadata::toBool | ( | ) | const |
Returns a read only reference to this object's data cast as a boolean. If This metadata is not a boolean type then an exception is thrown.
bool & EMetadata::toBool | ( | ) |
Returns a reference to this object's data cast as a boolean. If This metadata is not a boolean type then an exception is thrown.
const QByteArray & EMetadata::toBytes | ( | ) | const |
Returns a read only reference to this object's data cast as a byte array. If This metadata is not a byte type then an exception is thrown.
QByteArray & EMetadata::toBytes | ( | ) |
Returns a reference to this object's data cast as a byte array. If This metadata is not a byte type then an exception is thrown.
const double & EMetadata::toDouble | ( | ) | const |
Returns a read only reference to this object's data cast as a double. If This metadata is not a double type then an exception is thrown.
double & EMetadata::toDouble | ( | ) |
Returns a reference to this object's data cast as a double. If This metadata is not a double type then an exception is thrown.
QJsonValue EMetadata::toJson | ( | ) | const |
Returns the JSON equivalent to this metadata excluding any byte array types because JSON does not support that. If this metadata is an array or object then all children are recursively copied into JSON format and returned with the root JSON value.
const EMetaObject & EMetadata::toObject | ( | ) | const |
Returns a read only reference to this object's data cast as a meta object. If This metadata is not an object type then an exception is thrown.
EMetaObject & EMetadata::toObject | ( | ) |
Returns a reference to this object's data cast as a meta object. If This metadata is not an object type then an exception is thrown.
const QString & EMetadata::toString | ( | ) | const |
Returns a read only reference to this object's data cast as a string. If This metadata is not a string type then an exception is thrown.
QString & EMetadata::toString | ( | ) |
Returns a reference to this object's data cast as a string. If This metadata is not a string type then an exception is thrown.
EMetadata::Type EMetadata::type | ( | ) | const |
Returns the type for this metadata.
|
static |
Returns the name of the given type as a string.
type | Type to be given name of. |
Writes a metadata object to the debug stream for debugging output.
debug | The debug object which has the given metadata object value streamed to it. |
meta | The metadata value that is streamed to the given debug object. |