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
|
This class provides access to the QXMLQuery class from Javascript. More...
#include <ZxQuery.h>
Classes | |
class | ResourceUrlFile |
A class for opening XQuery resource files. More... | |
Signals | |
void | focusUrlChanged (bool focusOK) |
void | queryUrlChanged (bool queryOK) |
Public Member Functions | |
ZxQuery (QObject *parent=0) | |
ZxQuery (const ZxQuery &source, QObject *parent=0) | |
ZxQuery (const QXmlNamePool &np, QObject *parent=0) | |
Q_INVOKABLE QObject * | evaluateToItems () |
Evaluates the current XQuery to a ZxResultItems object and returns that object. More... | |
Q_INVOKABLE QStringList | evaluateToStringList () |
Evaluates the current XQuery to a QStringList object and returns that object. More... | |
Q_INVOKABLE QString | evaluateToXml () |
Evaluates the current XQuery to an XML string. More... | |
Q_INVOKABLE QObject * | getCopy () |
Returns a ZxQuery object that is a copy of this object. More... | |
Q_INVOKABLE QObject * | getNamePoolCopy () |
Returns a ZxQuery object that uses the same QXmlNamePool as this object. More... | |
Q_INVOKABLE void | bindVariable (const QString &localName, QObject *zXmlItem) |
Binds an XQuery variable with a value. More... | |
Q_INVOKABLE void | loadQueryText (const QString &fileUri) |
Appends the contents of the specified file to the current contents of the query text buffer. More... | |
Q_INVOKABLE void | concatQueryText (const QString &text) |
Appends the specified text to the current contents of the query text buffer. More... | |
Q_INVOKABLE void | commitQueryText () |
Sends the current query text buffer to the XQuery processor. More... | |
Q_INVOKABLE void | bindSymbol (const QString &symbolName, const QString &symbolText) |
Binds the specified symbol name to the specified text. More... | |
Q_INVOKABLE QString | getSymbolText (const QString &symbolName) |
obtain the text that will be substituted for the specified symbol when loading text into the query text buffer. More... | |
Q_INVOKABLE void | removeSymbol (const QString &symbolName) |
Removes the specified symbol from the symbol substitution map. More... | |
void | setQueryUrl (const QString &url) |
sets the XQuery query url and calls setQuery on the encapsulated QXmlQuery object. More... | |
const QString | getQueryUrl () |
returns the query URL of the XQuery object More... | |
void | setFocusUrl (const QString &url) |
sets the XQuery focus url and calls setQuery on the encapsulated QXmlQuery object. More... | |
const QString | getFocusUrl () |
returns the focus item the XQuery object More... | |
void | setFocusItem (QObject *item) |
sets the XQuery focus item More... | |
QObject * | getFocusItem () |
returns the focus URL of the XQuery object More... | |
void | setFocusText (const QString &text) |
sets the XQuery focus url and calls setQuery on the encapsulated QXmlQuery object. More... | |
const QString | getFocusText () |
returns the focus text of the XQuery object More... | |
void | setQueryText (const QString &text) |
Copies the specified text to the query text buffer and calls setQuery on the encapsulated QXmlQuery object. DO NOT call commitQuery(), query is committed immediately. More... | |
const QString | getQueryText () |
returns the text of the query More... | |
void | setSymbolSubstitution (bool enabled) |
enables symbol substitution mechanism for query text buffer. More... | |
const bool | getSymbolSubstitution () |
returns the symbol substituion mode More... | |
QXmlNamePool | getNamePool () const |
Obtains the XML name pool for the encapsulated QXmlQuery object. More... | |
Static Public Member Functions | |
static void | registerType () |
Registers ZxQuery as a QML type. More... | |
Protected Attributes | |
QXmlQuery | m_query |
The encapsulated QXmlQuery object. More... | |
QUrl | m_queryUrl |
The URL of the source query file;. More... | |
QString | m_queryText |
The source text of the query. More... | |
QString | m_focusText |
The focus URL. More... | |
QXmlItem | m_xmlItem |
The focus item. More... | |
ResourceUrlFile | m_focusFile |
Pointer to a QFile object that will be used as the XQuery focus document. More... | |
ResourceUrlFile | m_queryFile |
Pointer to a QFile object that will be used as the XQuery query text. More... | |
bool | m_enableSymbols |
Enables query text buffer symbol substitution when true, disables it when false. More... | |
QMap< QString, QString > | m_symbols |
Query text symbol substitution map. More... | |
Properties | |
QString | queryUrl |
set/get the query url More... | |
QObject | focusItem |
set/get the focus url More... | |
QString | focusUrl |
set/get the focus url TBD: READING DOESN'T WORK More... | |
QString | focusText |
set/get the focus text More... | |
QString | queryText |
set/get the query text More... | |
bool | substituteSymbols |
Query text buffer symbol substitution is enabled when true, disabled when false. More... | |
This class provides access to the QXMLQuery class from Javascript.
|
explicit |
Definition at line 44 of file ZxQuery.cpp.
Referenced by getCopy(), and getNamePoolCopy().
|
explicit |
Definition at line 49 of file ZxQuery.cpp.
|
explicit |
Definition at line 62 of file ZxQuery.cpp.
void Zbl::ZxQuery::bindSymbol | ( | const QString & | symbolName, |
const QString & | symbolText | ||
) |
Binds the specified symbol name to the specified text.
The query text buffer supports an optional symbol substitution mechanism that allows the programmer to embed symbols in the query text that can later be substituted with dynamically generated text. Symbols are substituted at the time text is loaded into the text query buffer but only if symbol substitution mode is enabled.
To use this mechanism call this method to bind symbol names to the substituted text, ensure symbol substitution mode is enabled, and then load query text containing symbols. When the query text had been finalized by loading or concatenation call the commitQueryText() method to commit the query to the XQuery processor.
symbolName | name of the symbol that will be replaced with the specified text |
symbolText | text that will be substituted for the named symbol when the query text buffer is loaded |
Definition at line 507 of file ZxQuery.cpp.
void Zbl::ZxQuery::bindVariable | ( | const QString & | localName, |
QObject * | zXmlItem | ||
) |
Binds an XQuery variable with a value.
localName | Name of the variable |
zXmlItem | A ZxItem object containing the value to bind to localName |
Definition at line 419 of file ZxQuery.cpp.
void Zbl::ZxQuery::commitQueryText | ( | ) |
Sends the current query text buffer to the XQuery processor.
When using loadQueryText() or concatQueryText() this method must be called to send the query text buffer to the XQuery processor.
Definition at line 494 of file ZxQuery.cpp.
void Zbl::ZxQuery::concatQueryText | ( | const QString & | text | ) |
Appends the specified text to the current contents of the query text buffer.
The query buffer IS NOT sent to the XQuery processor automatically. You must explicitly call commitQuery() to send query buffer to XQuery processor when using this method.
text | The text to append to query buffer. |
Definition at line 484 of file ZxQuery.cpp.
QObject * Zbl::ZxQuery::evaluateToItems | ( | ) |
Evaluates the current XQuery to a ZxResultItems object and returns that object.
Definition at line 259 of file ZxQuery.cpp.
QStringList Zbl::ZxQuery::evaluateToStringList | ( | ) |
Evaluates the current XQuery to a QStringList object and returns that object.
Definition at line 307 of file ZxQuery.cpp.
Referenced by Zbl::ZSettings::realizeSettings().
QString Zbl::ZxQuery::evaluateToXml | ( | ) |
Evaluates the current XQuery to an XML string.
Definition at line 326 of file ZxQuery.cpp.
|
signal |
Referenced by setFocusUrl().
QObject * Zbl::ZxQuery::getCopy | ( | ) |
Returns a ZxQuery object that is a copy of this object.
Definition at line 348 of file ZxQuery.cpp.
QObject * Zbl::ZxQuery::getFocusItem | ( | ) |
const QString Zbl::ZxQuery::getFocusText | ( | ) |
const QString Zbl::ZxQuery::getFocusUrl | ( | ) |
QXmlNamePool Zbl::ZxQuery::getNamePool | ( | ) | const |
Obtains the XML name pool for the encapsulated QXmlQuery object.
Definition at line 343 of file ZxQuery.cpp.
Referenced by Zbl::ZxItem::elementById(), and Zbl::ZxItem::getLocalName().
QObject * Zbl::ZxQuery::getNamePoolCopy | ( | ) |
Returns a ZxQuery object that uses the same QXmlNamePool as this object.
Definition at line 353 of file ZxQuery.cpp.
const QString Zbl::ZxQuery::getQueryText | ( | ) |
const QString Zbl::ZxQuery::getQueryUrl | ( | ) |
const bool Zbl::ZxQuery::getSymbolSubstitution | ( | ) |
returns the symbol substituion mode
Definition at line 442 of file ZxQuery.cpp.
QString Zbl::ZxQuery::getSymbolText | ( | const QString & | symbolName | ) |
obtain the text that will be substituted for the specified symbol when loading text into the query text buffer.
Definition at line 512 of file ZxQuery.cpp.
void Zbl::ZxQuery::loadQueryText | ( | const QString & | fileUri | ) |
Appends the contents of the specified file to the current contents of the query text buffer.
The query buffer IS NOT sent to the XQuery processor automatically. You must explicitly call commitQuery() to send query buffer to XQuery processor when using this method.
fileUri | The file or resource url to load. |
Definition at line 447 of file ZxQuery.cpp.
|
signal |
Referenced by setQueryUrl().
|
static |
Registers ZxQuery as a QML type.
Definition at line 252 of file ZxQuery.cpp.
Referenced by Zbl::Zblcore::registerTypes().
void Zbl::ZxQuery::removeSymbol | ( | const QString & | symbolName | ) |
Removes the specified symbol from the symbol substitution map.
The specified symbol will no longer be substituted when the query text buffer is loaded.
Definition at line 517 of file ZxQuery.cpp.
void Zbl::ZxQuery::setFocusItem | ( | QObject * | item | ) |
sets the XQuery focus item
item | a ZxItem object that will become the focus of the query |
Definition at line 185 of file ZxQuery.cpp.
void Zbl::ZxQuery::setFocusText | ( | const QString & | text | ) |
sets the XQuery focus url and calls setQuery on the encapsulated QXmlQuery object.
the | URL of the query file |
Definition at line 167 of file ZxQuery.cpp.
Referenced by Zbl::ZSettings::realizeSettings().
void Zbl::ZxQuery::setFocusUrl | ( | const QString & | url | ) |
sets the XQuery focus url and calls setQuery on the encapsulated QXmlQuery object.
the | URL of the query file |
Definition at line 121 of file ZxQuery.cpp.
Referenced by Zbl::ZSettings::realizeSettings().
void Zbl::ZxQuery::setQueryText | ( | const QString & | text | ) |
Copies the specified text to the query text buffer and calls setQuery on the encapsulated QXmlQuery object. DO NOT call commitQuery(), query is committed immediately.
Pass an empty string to clear the text buffer. QXmlQuery object state will not be affected.
the | text of the query |
Definition at line 219 of file ZxQuery.cpp.
Referenced by Zbl::ZSettings::realizeSettings().
void Zbl::ZxQuery::setQueryUrl | ( | const QString & | url | ) |
sets the XQuery query url and calls setQuery on the encapsulated QXmlQuery object.
This method bypasses the query text buffer and as a side effect clears it.
the | URL of the query file |
Definition at line 68 of file ZxQuery.cpp.
void Zbl::ZxQuery::setSymbolSubstitution | ( | bool | enabled | ) |
enables symbol substitution mechanism for query text buffer.
enabled | true to turn on symbol substitution, false to disable it; |
Definition at line 437 of file ZxQuery.cpp.
|
protected |
Enables query text buffer symbol substitution when true, disables it when false.
Definition at line 492 of file ZxQuery.h.
Referenced by getSymbolSubstitution(), and setSymbolSubstitution().
|
protected |
Pointer to a QFile object that will be used as the XQuery focus document.
This is to work around the limitation that QXmlQuery can't open a Qt binary resource url ie: qrc:/some/resource/file.xml
Definition at line 476 of file ZxQuery.h.
Referenced by getFocusUrl(), setFocusText(), setFocusUrl(), and ZxQuery().
|
protected |
The focus URL.
The focus text;
Definition at line 458 of file ZxQuery.h.
Referenced by getFocusText(), and setFocusText().
|
protected |
The encapsulated QXmlQuery object.
Definition at line 434 of file ZxQuery.h.
Referenced by bindVariable(), commitQueryText(), evaluateToItems(), evaluateToStringList(), evaluateToXml(), getNamePool(), getNamePoolCopy(), setFocusItem(), setFocusText(), setFocusUrl(), setQueryText(), and setQueryUrl().
|
protected |
Pointer to a QFile object that will be used as the XQuery query text.
This is to work around the limitation that QXmlQuery can't open a Qt binary resource url ie: qrc:/some/resource/file.xml
Definition at line 487 of file ZxQuery.h.
Referenced by setQueryUrl().
|
protected |
The source text of the query.
Definition at line 446 of file ZxQuery.h.
Referenced by commitQueryText(), concatQueryText(), getQueryText(), loadQueryText(), setQueryText(), and setQueryUrl().
|
protected |
The URL of the source query file;.
Definition at line 440 of file ZxQuery.h.
Referenced by evaluateToItems(), evaluateToStringList(), evaluateToXml(), getQueryUrl(), setQueryText(), and ZxQuery().
|
protected |
Query text symbol substitution map.
Definition at line 497 of file ZxQuery.h.
Referenced by bindSymbol(), getSymbolText(), and removeSymbol().
|
protected |
|
readwrite |
|
readwrite |
|
readwrite |
|
readwrite |
|
readwrite |
|
readwrite |
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.