WARNING: USE THIS SOFTWARE AT YOUR OWN RISK! THIS IS EXPERIMENTAL SOFTWARE NOT INTENDED FOR PRODUCTION USE! Zuble is currently an early stage prototype. As such Zuble is minimally tested and inherently unstable. It is provided for experimental, development, and demonstration purposes only. Zuble QML Types   |  Zuble C++ Classes   |  Zuble Overview
Zuble  0.1
Zuble Framework C++/QML extension API
Public Member Functions | Protected Attributes | Friends | List of all members
Zbl::ZblFactory Class Reference

An object factory that creates new instances of objects defined by a Zuble sprocket. Used primarily to construct sprocket objects in Zuble background threads. More...

#include <ZblFactory.h>

Inheritance diagram for Zbl::ZblFactory:
Inheritance graph
[legend]
Collaboration diagram for Zbl::ZblFactory:
Collaboration graph
[legend]

Public Member Functions

 ZblFactory (int importVersionMajor, int importVersionMinor, QObject *parent=0)
 Object constructor. More...
 
QObject * createObject (const char *qmlName)
 Locates the Sprocket object's constructor for the specified QML type and calls it, returning the resulting object. More...
 
int importVersionMajor ()
 returns the major import version number More...
 
int importVersionMinor ()
 returns the minor import version number More...
 

Protected Attributes

int m_importVersionMajor
 major version number of the import More...
 
int m_importVersionMinor
 minor version number of the import More...
 
sprocketObjectMap m_objectFunctions
 Maps QML type names to appropriate version-specific Sprocket object constructors. More...
 

Friends

class ZblCog
 

Detailed Description

An object factory that creates new instances of objects defined by a Zuble sprocket. Used primarily to construct sprocket objects in Zuble background threads.

A sprocket is a QML plugin that extends the Zuble core plugin. Sprockets implement the Zbl::ZblSprocket interface so javascript background threads can obtain instances of the objects they define. This is necessary because javascript background threads can't create objects using QQMLEngine.

ZblFactory mimics QQMLEngine's versioning semantics such that when an object of the import version is not available the highest version of the object that is less than the import version is created instead. Objects with version numbers higher than the import version are hidden.

ZblFactory objects are reentrant. Each ZblFactory object serves a single javascript background thread.

Definition at line 54 of file ZblFactory.h.

Constructor & Destructor Documentation

◆ ZblFactory()

Zbl::ZblFactory::ZblFactory ( int  importVersionMajor,
int  importVersionMinor,
QObject *  parent = 0 
)
explicit

Object constructor.

Parameters
importVersionMajormajor version of the import
importVersionMinorminor version of the import
parentparent QObject or NULL if no object parent

Definition at line 34 of file ZblFactory.cpp.

Member Function Documentation

◆ createObject()

QObject * Zbl::ZblFactory::createObject ( const char *  qmlName)

Locates the Sprocket object's constructor for the specified QML type and calls it, returning the resulting object.

Parameters
qmlNameQML type name of the Sprocket object to construct
Returns
the new QObject, or NULL if no object could be constructed

Definition at line 45 of file ZblFactory.cpp.

◆ importVersionMajor()

int Zbl::ZblFactory::importVersionMajor ( )
inline

returns the major import version number

Definition at line 86 of file ZblFactory.h.

◆ importVersionMinor()

int Zbl::ZblFactory::importVersionMinor ( )
inline

returns the minor import version number

Definition at line 91 of file ZblFactory.h.

Friends And Related Function Documentation

◆ ZblCog

friend class ZblCog
friend

Definition at line 56 of file ZblFactory.h.

Member Data Documentation

◆ m_importVersionMajor

int Zbl::ZblFactory::m_importVersionMajor
protected

major version number of the import

Definition at line 104 of file ZblFactory.h.

Referenced by importVersionMajor().

◆ m_importVersionMinor

int Zbl::ZblFactory::m_importVersionMinor
protected

minor version number of the import

Definition at line 110 of file ZblFactory.h.

Referenced by importVersionMinor().

◆ m_objectFunctions

sprocketObjectMap Zbl::ZblFactory::m_objectFunctions
protected

Maps QML type names to appropriate version-specific Sprocket object constructors.

Definition at line 117 of file ZblFactory.h.

Referenced by Zbl::ZblCog::createFactory(), and createObject().


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