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 | Static Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | Friends | List of all members
Zbl::ZblSprocket Class Reference

This class holds the state for managing a Zuble sprocket. More...

#include <ZblSprocket.h>

Public Member Functions

 ZblSprocket (QString uri, int versionMajor, int versionMinor)
 Object constructor. More...
 
const QString & uri () const
 returns the Sprocket plugin's uri More...
 
int versionMajor () const
 returns the Sprocket plugin's major version number More...
 
int versionMinor () const
 returns the Sprocket plugin's minor version number More...
 
const QString sprocketTag () const
 returns a string in the form of "<uri>:<majorVersion>:<minorVersion>" More...
 
bool registerSprocketObject (const char *uri, int versionMajor, int versionMinor, const char *qmlName, sprocketObjectConstructor createFunc)
 Creates a new ZblSprockOb Sprocket object constructor and adds it to the Sprocket's object foundary. More...
 

Static Public Member Functions

static const QString sprocketTag (const char *uri, int versionMajor, int versionMinor)
 returns a string in the form of "<uri>:<majorVersion>:<minorVersion>" More...
 
static const QString sprocketTag (const ZblSprocket *sprocket)
 returns a string in the form of "<uri>:<majorVersion>:<minorVersion>" More...
 

Protected Member Functions

int versionKey (int versionMajor, int versionMinor)
 Computes a version key for the specified version number. More...
 
ZblSprockObfindSprock (int versionMajor, int versionMinor, const char *qmlName)
 Locates a version-specific Sprocket object constructor in the Sprocket's object foundry based on the QML type name version semantics. More...
 
bool insertSprock (ZblSprockOb *sprock)
 Adds a Sprocket constructor object to the Sprocket's object foundry. More...
 

Protected Attributes

QString m_uri
 Sprocket plugin uri. More...
 
int m_versionMajor
 Sprocket plugin major version number. More...
 
int m_versionMinor
 Sprocket plugin minor version number. More...
 
sprocketFoundryMap m_objects
 Maps object QML names to maps of sprocket object foundaries. Each foundary contains a separate object construction wrapper for each version of the named object. More...
 

Private Member Functions

 ZblSprocket ()
 

Friends

class ZblCog
 

Detailed Description

This class holds the state for managing a Zuble sprocket.

Definition at line 38 of file ZblSprocket.h.

Constructor & Destructor Documentation

◆ ZblSprocket() [1/2]

Zbl::ZblSprocket::ZblSprocket ( )
inlineexplicitprivate

Definition at line 43 of file ZblSprocket.h.

◆ ZblSprocket() [2/2]

Zbl::ZblSprocket::ZblSprocket ( QString  uri,
int  versionMajor,
int  versionMinor 
)
inline

Object constructor.

Parameters
uriSprocket plugin's uri
versionMajorSprocket library major version number
versionMinorSprocket library minor version number

Definition at line 52 of file ZblSprocket.h.

Member Function Documentation

◆ findSprock()

ZblSprockOb * Zbl::ZblSprocket::findSprock ( int  versionMajor,
int  versionMinor,
const char *  qmlName 
)
protected

Locates a version-specific Sprocket object constructor in the Sprocket's object foundry based on the QML type name version semantics.

Parameters
versionMajorQML import major version
versionMinorQML import minor version
qmlNameQML object type name
Returns
pointer to a Sprocket object constructor, or NULL if the constructor object could not be created

Definition at line 80 of file ZblSprocket.cpp.

Referenced by Zbl::ZblCog::createFactory(), registerSprocketObject(), and versionKey().

◆ insertSprock()

bool Zbl::ZblSprocket::insertSprock ( ZblSprockOb sprock)
protected

Adds a Sprocket constructor object to the Sprocket's object foundry.

Parameters
sprockSprocket constructor object
Returns
true if constructor object added successfully, false if an error occurred

Definition at line 134 of file ZblSprocket.cpp.

Referenced by registerSprocketObject(), and versionKey().

◆ registerSprocketObject()

bool Zbl::ZblSprocket::registerSprocketObject ( const char *  uri,
int  versionMajor,
int  versionMinor,
const char *  qmlName,
sprocketObjectConstructor  createFunc 
)

Creates a new ZblSprockOb Sprocket object constructor and adds it to the Sprocket's object foundary.

Note that versionMajor and versionMinor should be the same as those passed in the object's qmlRegisterType() function call to ensure the same object is created in both foreground (objects created by QML) and background (objects created by Zuble) threads.

See also
Zbl::sprocketObjectConstructor
Parameters
uriSprocket plugin's uri
versionMajorobject's QML type major version number
versionMinorobject's QML type minor version number
qmlNameobject's QML type name
createFuncobject's constructor function
Returns
true if object registered successfully, false if registration failed

Definition at line 45 of file ZblSprocket.cpp.

Referenced by Zbl::ZblCog::registerSprocketObject(), and sprocketTag().

◆ sprocketTag() [1/3]

const QString Zbl::ZblSprocket::sprocketTag ( ) const
inline

returns a string in the form of "<uri>:<majorVersion>:<minorVersion>"

Definition at line 90 of file ZblSprocket.h.

Referenced by insertSprock(), Zbl::ZblCog::isMappedResource(), Zbl::ZblCog::mapResource(), Zbl::ZblCog::registerResource(), Zbl::ZblCog::registerSprocket(), and sprocketTag().

◆ sprocketTag() [2/3]

const QString Zbl::ZblSprocket::sprocketTag ( const char *  uri,
int  versionMajor,
int  versionMinor 
)
static

returns a string in the form of "<uri>:<majorVersion>:<minorVersion>"

Definition at line 166 of file ZblSprocket.cpp.

◆ sprocketTag() [3/3]

const QString Zbl::ZblSprocket::sprocketTag ( const ZblSprocket sprocket)
static

returns a string in the form of "<uri>:<majorVersion>:<minorVersion>"

Definition at line 178 of file ZblSprocket.cpp.

◆ uri()

const QString& Zbl::ZblSprocket::uri ( ) const
inline

returns the Sprocket plugin's uri

Definition at line 72 of file ZblSprocket.h.

Referenced by sprocketTag(), and ZblSprocket().

◆ versionKey()

int Zbl::ZblSprocket::versionKey ( int  versionMajor,
int  versionMinor 
)
inlineprotected

Computes a version key for the specified version number.

Keys are computed as [(majorVersion * 10) + minorVersion]

Parameters
versionMajormajor version number
versionMinorminor version number
Returns
computed version key

Definition at line 146 of file ZblSprocket.h.

Referenced by findSprock(), and insertSprock().

◆ versionMajor()

int Zbl::ZblSprocket::versionMajor ( ) const
inline

returns the Sprocket plugin's major version number

Definition at line 78 of file ZblSprocket.h.

Referenced by sprocketTag(), and ZblSprocket().

◆ versionMinor()

int Zbl::ZblSprocket::versionMinor ( ) const
inline

returns the Sprocket plugin's minor version number

Definition at line 84 of file ZblSprocket.h.

Referenced by sprocketTag(), versionKey(), and ZblSprocket().

Friends And Related Function Documentation

◆ ZblCog

friend class ZblCog
friend

Definition at line 40 of file ZblSprocket.h.

Member Data Documentation

◆ m_objects

sprocketFoundryMap Zbl::ZblSprocket::m_objects
protected

Maps object QML names to maps of sprocket object foundaries. Each foundary contains a separate object construction wrapper for each version of the named object.

Definition at line 197 of file ZblSprocket.h.

Referenced by Zbl::ZblCog::createFactory(), findSprock(), and insertSprock().

◆ m_uri

QString Zbl::ZblSprocket::m_uri
protected

Sprocket plugin uri.

Definition at line 179 of file ZblSprocket.h.

Referenced by uri(), and ZblSprocket().

◆ m_versionMajor

int Zbl::ZblSprocket::m_versionMajor
protected

Sprocket plugin major version number.

Definition at line 184 of file ZblSprocket.h.

Referenced by versionMajor(), and ZblSprocket().

◆ m_versionMinor

int Zbl::ZblSprocket::m_versionMinor
protected

Sprocket plugin minor version number.

Definition at line 189 of file ZblSprocket.h.

Referenced by versionMinor(), and ZblSprocket().


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