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
|
A class for executing javascript programs in a background worker thread. More...
#include <ZScriptWorker.h>
Public Slots | |
void | execScript (qulonglong requestID, const QString &script, QString userData=QString()) |
Executes the specified javascript program in the current thread and sends the execComplete signal when processing is complete. More... | |
void | onStarted () |
Called when QThread has started running. More... | |
Signals | |
void | execComplete (qulonglong requestID, QString result, QString userData) |
Sent when the a javascript program execution started with execScript() has been completed. More... | |
Public Member Functions | |
ZScriptWorker (ZScriptThread *container=nullptr, QObject *parent=nullptr) | |
virtual | ~ZScriptWorker () |
Protected Member Functions | |
void | initGlobalSpace () |
Protected Attributes | |
QJSEngine * | m_engine |
The javascript engine for background processing. More... | |
QString | m_script |
The most recent script that was executed. More... | |
QJSValue | m_result |
Result returned by the most recent script execution. More... | |
QJSValue | m_error |
A template javascript Error object. More... | |
ZblApp * | m_app |
An object to represent the running Zuble application. More... | |
ZblJsonHelper * | m_json |
An object to perform QJSValue/JSON data conversions on the fly. More... | |
Friends | |
class | ZScriptThread |
A class for executing javascript programs in a background worker thread.
This class executes in the background thread and encapsulates the QJSEngine instance associated with the background javascript program. As such it holds the javascript program execution state.
Definition at line 51 of file ZScriptWorker.h.
|
explicit |
Definition at line 43 of file ZScriptWorker.cpp.
|
virtual |
Definition at line 54 of file ZScriptWorker.cpp.
|
signal |
Sent when the a javascript program execution started with execScript() has been completed.
requestID | user-defined integer value that was passed to execScript() |
result | The javascript program execution result value in JSON format. Should be a string array or an object. Other data types won't survive JSON conversion. |
When executing a function call this will be the function return value. When JSON conversion fails this will be undefined.
An Error object is returned when an error has occurred during script processing or execution.
userData | user-defined JSON string that was passed to execScript(). Contents may have been modified by script execution. |
This may be used to hold context over a sequence of multiple script executions that are working on the same data set. Simply pass the userData object to each call to execScript() that was returned by the previous execComplete for that data set.
Referenced by execScript(), and Zbl::ZScriptThread::ZScriptThread().
|
slot |
Executes the specified javascript program in the current thread and sends the execComplete signal when processing is complete.
script | Holds a string containing the javascript program to execute. |
userData | passed to the script |
Definition at line 69 of file ZScriptWorker.cpp.
|
protected |
Definition at line 59 of file ZScriptWorker.cpp.
Referenced by ZScriptWorker().
|
slot |
Called when QThread has started running.
Definition at line 64 of file ZScriptWorker.cpp.
Referenced by Zbl::ZScriptThread::ZScriptThread().
|
friend |
Definition at line 53 of file ZScriptWorker.h.
|
protected |
An object to represent the running Zuble application.
Definition at line 147 of file ZScriptWorker.h.
Referenced by execScript(), initGlobalSpace(), and ZScriptWorker().
|
protected |
The javascript engine for background processing.
Definition at line 119 of file ZScriptWorker.h.
Referenced by execScript(), initGlobalSpace(), and ZScriptWorker().
|
protected |
A template javascript Error object.
We make copies of this to propagate errors that don't originate in the QJSEngine itself.
Definition at line 141 of file ZScriptWorker.h.
Referenced by ZScriptWorker().
|
protected |
An object to perform QJSValue/JSON data conversions on the fly.
Definition at line 154 of file ZScriptWorker.h.
Referenced by execScript(), ZScriptWorker(), and ~ZScriptWorker().
|
protected |
Result returned by the most recent script execution.
Definition at line 132 of file ZScriptWorker.h.
Referenced by execScript().
|
protected |
The most recent script that was executed.
Definition at line 125 of file ZScriptWorker.h.
Referenced by execScript().
Zuble documentation copyright © 2019 Bob Dinitto. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Zuble is a derivative work of Qt version 5. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.