Accelerated Computation Engine
Public Types | Public Member Functions | Static Public Member Functions | Friends | List of all members
EMetadata Class Reference

#include <emetadata.h>

Public Types

enum  Type {
  Null, Bool, Double, String,
  Bytes, Array, Object
}
 

Public Member Functions

EMetadataoperator= (const EMetadata &object)
 
EMetadataoperator= (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 EMetaArraytoArray () const
 
const EMetaObjecttoObject () const
 
bool & toBool ()
 
double & toDouble ()
 
QString & toString ()
 
QByteArray & toBytes ()
 
EMetaArraytoArray ()
 
EMetaObjecttoObject ()
 

Static Public Member Functions

static QString typeName (Type type)
 

Friends

EDebugoperator<< (EDebug &debug, const EMetadata *const meta)
 

Detailed Description

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.

Member Enumeration Documentation

◆ Type

Defines all possible types a metadata object can contain.

Enumerator
Null 

Defines the object is empty and contains no data.

Defines the object is a Boolean.

Bool 

Defines the object is a real number.

Double 

Defines the object is a string.

String 

Defines the object is an array of bytes. The QByteArray type is used to store this type.

Bytes 

Defines the object is an array of additional metadata objects.

Array 

Defines the object is a mapping of additional metadata objects. The mapping is done using strings as keywords.

Constructor & Destructor Documentation

◆ EMetadata() [1/9]

EMetadata::EMetadata ( Type  type = Null)

Constructs a new metadata object of the type specified.

Parameters
typeThe type this new object will become.

◆ EMetadata() [2/9]

EMetadata::EMetadata ( double  value)

Constructs a new metadata object of the double type, setting its initial value to the one given.

Parameters
valueInitial value of this new metadata object.

◆ EMetadata() [3/9]

EMetadata::EMetadata ( const QString &  value)

Constructs a new metadata object of the string type, setting its initial value to the one given.

Parameters
valueInitial value of this new metadata object.

◆ EMetadata() [4/9]

EMetadata::EMetadata ( const QByteArray &  value)

Constructs a new metadata object of the byte array type, setting its initial value to the one given.

Parameters
valueInitial value of this new metadata object.

◆ EMetadata() [5/9]

EMetadata::EMetadata ( const EMetaArray value)

Constructs a new metadata object of the array type, setting its initial value to the one given.

Parameters
valueInitial value of this new metadata object.

◆ EMetadata() [6/9]

EMetadata::EMetadata ( const EMetaObject value)

Constructs a new metadata object of the object type, setting its initial value to the one given.

Parameters
valueInitial value of this new metadata object.

◆ EMetadata() [7/9]

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.

Parameters
valueJSON value that is used to construct this new metadata object.

◆ EMetadata() [8/9]

EMetadata::EMetadata ( const EMetadata object)

This creates a new metadata object that is a direct copy of the one supplied.

Parameters
objectThe metadata object that is copied.

◆ EMetadata() [9/9]

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.

Parameters
objectThe metadata object whose data is taken.

◆ ~EMetadata()

EMetadata::~EMetadata ( )

Deletes any data this object may contain.

Member Function Documentation

◆ isArray()

bool EMetadata::isArray ( ) const

Tests if this metadata is an array type.

Returns
True if this metadata is an array type or false otherwise.

◆ isBool()

bool EMetadata::isBool ( ) const

Tests if this metadata is a boolean type.

Returns
True if this metadata is a boolean type or false otherwise.

◆ isBytes()

bool EMetadata::isBytes ( ) const

Tests if this metadata is a byte array type.

Returns
True if this metadata is a byte type or false otherwise.

◆ isDouble()

bool EMetadata::isDouble ( ) const

Tests if this metadata is a double (real number) type.

Returns
True if this metadata is a double type or false otherwise.

◆ isNull()

bool EMetadata::isNull ( ) const

Tests if this metadata is a null type.

Returns
True if this metadata is a null type or false otherwise.

◆ isObject()

bool EMetadata::isObject ( ) const

Tests if this metadata is an object type.

Returns
True if this metadata is an object type.

◆ isString()

bool EMetadata::isString ( ) const

Tests if this metadata is a string type.

Returns
True if this metadata is a string type or false otherwise.

◆ operator=() [1/2]

EMetadata & EMetadata::operator= ( const EMetadata object)

Set this object's data as a copy of the supplied metadata object.

Parameters
objectThe metadata object that is copied.
Returns
Reference to this object.

◆ operator=() [2/2]

EMetadata & EMetadata::operator= ( EMetadata &&  object)

Take the data of another metadata object and set this object's data with it.

Parameters
objectThe metadata object whose data is taken.
Returns
Reference to this object.

◆ toArray() [1/2]

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.

Returns
Read only reference to this object's meta array.

◆ toArray() [2/2]

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.

Returns
Reference to this object's meta array.

◆ toBool() [1/2]

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.

Returns
Read only reference to this object's boolean data.

◆ toBool() [2/2]

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.

Returns
Reference to this object's boolean data.

◆ toBytes() [1/2]

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.

Returns
Read only reference to this object's byte array data.

◆ toBytes() [2/2]

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.

Returns
Reference to this object's byte array data.

◆ toDouble() [1/2]

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.

Returns
Read only reference to this object's double data.

◆ toDouble() [2/2]

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.

Returns
Reference to this object's double data.

◆ toJson()

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.

Returns
JSON value of this metadata object.

◆ toObject() [1/2]

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.

Returns
Read only reference to this object's meta object.

◆ toObject() [2/2]

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.

Returns
Reference to this object's meta object.

◆ toString() [1/2]

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.

Returns
Read only reference to this object's string data.

◆ toString() [2/2]

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.

Returns
Reference to this object's string data.

◆ type()

EMetadata::Type EMetadata::type ( ) const

Returns the type for this metadata.

Returns
This type for this metadata.

◆ typeName()

QString EMetadata::typeName ( Type  type)
static

Returns the name of the given type as a string.

Parameters
typeType to be given name of.
Returns
Name of the given type.

Friends And Related Function Documentation

◆ operator<<

EDebug& operator<< ( EDebug debug,
const EMetadata *const  meta 
)
friend

Writes a metadata object to the debug stream for debugging output.

Parameters
debugThe debug object which has the given metadata object value streamed to it.
metaThe metadata value that is streamed to the given debug object.
Returns
Reference to the debug object.

The documentation for this class was generated from the following files: