Nuria Framework - Core
Core module of the NuriaProject Framework
 All Classes Functions Typedefs Enumerations Enumerator Groups
Public Member Functions | List of all members
Nuria::QtMetaObjectWrapper Class Reference

QtMetaObjectWrapper lets you use a QMetaObject as Nuria::MetaObject. More...

#include <qtmetaobjectwrapper.hpp>

Inheritance diagram for Nuria::QtMetaObjectWrapper:
Nuria::RuntimeMetaObject Nuria::MetaObject

Public Member Functions

 QtMetaObjectWrapper (const QMetaObject *metaObject)
 
 ~QtMetaObjectWrapper () override
 
- Public Member Functions inherited from Nuria::RuntimeMetaObject
 RuntimeMetaObject (const QByteArray &name)
 
 ~RuntimeMetaObject ()
 
void setQtMetaTypeId (int valueTypeId)
 
void setQtMetaTypePointerId (int pointerTypeId)
 
void setAnnotations (const AnnotationMap &annotations)
 
void setBaseClasses (const QVector< QByteArray > &bases)
 
void setInstanceDeleter (InstanceDeleter deleter)
 
void addMethod (MetaMethod::Type type, const QByteArray &name, const QByteArray &returnType, const QVector< QByteArray > &argumentNames, const QVector< QByteArray > &argumentTypes, const AnnotationMap &annotations, InvokeCreator invokeCreator)
 
void addEnum (const QByteArray &name, const AnnotationMap &annotations, const QMap< QByteArray, int > &keyValueMap)
 
void addField (const QByteArray &name, const QByteArray &valueType, const AnnotationMap &annotations, FieldGetter getter, FieldSetter setter)
 
void addField (const QByteArray &name, const QByteArray &valueType, const AnnotationMap &annotations, FieldGetter getter)
 
void finalize ()
 
- Public Member Functions inherited from Nuria::MetaObject
 MetaObject ()
 
virtual ~MetaObject ()
 
QByteArray className ()
 
int metaTypeId ()
 
int pointerMetaTypeId ()
 
QVector< QByteArray > parents ()
 
int annotationCount ()
 
MetaAnnotation annotation (int idx) const
 
int annotationLowerBound (const QByteArray &name) const
 
int annotationUpperBound (const QByteArray &name) const
 
int methodCount ()
 
MetaMethod method (int idx)
 
int methodLowerBound (const QByteArray &name)
 
int methodUpperBound (const QByteArray &name)
 
MetaMethod method (const QVector< QByteArray > &prototype)
 
void destroyInstance (void *instance)
 
int fieldCount ()
 
MetaField field (int idx)
 
MetaField fieldByName (const QByteArray &name)
 
int enumCount ()
 
MetaEnum enumAt (int idx)
 
MetaEnum enumByName (const QByteArray &name)
 

Additional Inherited Members

- Public Types inherited from Nuria::RuntimeMetaObject
enum  InvokeAction { InvokeAction::Invoke, InvokeAction::UnsafeInvoke, InvokeAction::ArgumentTest }
 
typedef QMultiMap< QByteArray,
QVariant > 
AnnotationMap
 
typedef std::function
< Callback(void
*, InvokeAction) > 
InvokeCreator
 
typedef std::function
< QVariant(void *) > 
FieldGetter
 
typedef std::function< bool(void
*, const QVariant &) > 
FieldSetter
 
typedef std::function< void(void *) > InstanceDeleter
 
- Public Types inherited from Nuria::MetaObject
enum  GateMethod {
  ClassName = 0, MetaTypeId = 1, PointerMetaTypeId = 2, BaseClasses = 3,
  AnnotationCount = 4, MethodCount = 5, FieldCount = 6, EnumCount = 7,
  AnnotationName = 10, AnnotationValue = 11, MethodName = 20, MethodType = 21,
  MethodReturnType = 22, MethodArgumentNames = 23, MethodArgumentTypes = 24, MethodCallback = 25,
  MethodUnsafeCallback = 26, MethodArgumentTest = 27, FieldName = 30, FieldType = 31,
  FieldRead = 32, FieldWrite = 33, FieldAccess = 34, EnumName = 40,
  EnumElementCount = 41, EnumElementKey = 42, EnumElementValue = 43, DestroyInstance = 50
}
 
- Static Public Member Functions inherited from Nuria::MetaObject
template<typename T >
static MetaObjectof ()
 
static MetaObjectbyName (const QByteArray &type)
 
static MetaObjectMap typesInheriting (const QByteArray &typeName)
 
static MetaObjectMap typesWithAnnotation (const QByteArray &name)
 
static MetaObjectMap allTypes ()
 
static void registerMetaObject (MetaObject *object)
 Registers object to the global meta system. More...
 
- Protected Member Functions inherited from Nuria::RuntimeMetaObject
void gateCall (GateMethod method, int category, int index, int nth, void *result, void *additional) override
 

Detailed Description

QtMetaObjectWrapper lets you use a QMetaObject as Nuria::MetaObject.

This class is meant to be used for classes you don't have writing access to (In which case you could simply tag it with NURIA_INTROSPECT) or if you don't want to use Tria. You can also use this class to ease transition to Tria. Note that when using Tria, you won't need to manually export types anymore like you need to when using pure Qt.

Note
You can instruct Tria to generate code for non-tagged classes using -introspect-all or -introspect-inheriting!
It is recommended to use Tria to generate the code instead of using this class.
Behaviour

The wrapper will expose all known public methods (Q_INVOKABLE methods and slots), enums and Qt properties. Information of the base class is not included. Constructors are not exposed.

Annotations stored as Q_CLASSINFO() will be stored as class annotations with the value as QString. To expose methods which are not public slots prefix them with Q_INVOKABLE - This also applies to constructors.

Constructor & Destructor Documentation

Nuria::QtMetaObjectWrapper::QtMetaObjectWrapper ( const QMetaObject *  metaObject)

Creates a instance which is populated by metaObject.

There is no further action required to use the MetaObject.
Nuria::QtMetaObjectWrapper::~QtMetaObjectWrapper ( )
override

Destructor.


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