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 javascript wrapper for QIODevice. More...
#include <ZioDevice.h>
Public Types | |
enum | OpenMode { NotOpen = QIODevice::NotOpen, ReadOnly = QIODevice::ReadOnly, WriteOnly = QIODevice::WriteOnly, ReadWrite = QIODevice::ReadWrite, Append = QIODevice::Append, Truncate = QIODevice::Truncate, Text = QIODevice::Text, Unbuffered = QIODevice::Unbuffered } |
Signals | |
void | getCurrentDevice (QIODevice **device) const |
Connected devices should listen to this signal and respond by returning a pointer to the QIODevice object for which this ZioDevice object is currently providing a Javascript interface. More... | |
Public Member Functions | |
ZioDevice (QObject *parent=0) | |
bool | isOpen () const |
int | openMode () const |
bool | getTextMode () const |
void | setTextMode (bool textModeEnabled) |
bool | isSequential () |
bool | isWritable () const |
bool | isReadable () const |
bool | atEnd () const |
qint64 | size () const |
qint64 | pos () const |
qint64 | bytesAvailable () const |
qint64 | bytesToWrite () const |
QVariant | getTags () |
QString | getErrorString () |
Q_INVOKABLE bool | seek (qint64 pos) |
Q_INVOKABLE qint64 | writeString (const QString &text) |
Write a string to the device. More... | |
Q_INVOKABLE qint64 | writeBytes (const QObject *data) |
Write the contents of a ZByteArray to the device. More... | |
Q_INVOKABLE bool | waitForBytesWritten (int msecs) |
Q_INVOKABLE bool | waitForReadyRead (int msecs) |
Q_INVOKABLE void | reset () |
Q_INVOKABLE void | close () |
Static Public Member Functions | |
static void | registerType () |
Registers ZioDevice as a QML type. More... | |
Protected Member Functions | |
QIODevice * | connectedDevice () const |
Emits the getCurrentDevice signal and returns the resulting device, or else throws an exception if a device is not returned in response to the signal. More... | |
void | createTags () |
Initializes QIODevice enumeration tags. More... | |
Static Protected Attributes | |
static QVariant | m_tags |
A QVariant containing a QVariantMap of QIODevice enumerations for use by background Javascript threads. More... | |
Properties | |
bool | isOpen |
Returns true if the device is open; otherwise returns false. More... | |
int | openMode |
Returns the mode in which the device has been opened; i.e. ReadOnly or WriteOnly. More... | |
bool | textMode |
Sets and gets the text mode flag. When set sequences are converted to/from when reading/writing the device on Windows. More... | |
bool | isSequential |
bool | writable |
Returns true if the device is writable, false otherwise. More... | |
bool | readable |
Returns true if the device is readable, false otherwise. More... | |
bool | atEnd |
Returns true if the current read and write position is at the end of the device. More... | |
qint64 | size |
For open random-access devices, this function returns the size of the device. For open sequential devices, bytesAvailable() is returned. More... | |
qint64 | pos |
qint64 | bytesAvailable |
qint64 | bytesToWrite |
QString | errorString |
QVariant | tags |
Enumerator | |
---|---|
NotOpen | |
ReadOnly | |
WriteOnly | |
ReadWrite | |
Append | |
Truncate | |
Text | |
Unbuffered |
Definition at line 46 of file ZioDevice.h.
|
explicit |
Definition at line 36 of file ZioDevice.cpp.
bool Zbl::ZioDevice::atEnd | ( | ) | const |
Referenced by isReadable().
qint64 Zbl::ZioDevice::bytesAvailable | ( | ) | const |
Referenced by setTextMode().
qint64 Zbl::ZioDevice::bytesToWrite | ( | ) | const |
Referenced by setTextMode().
void Zbl::ZioDevice::close | ( | ) |
Definition at line 227 of file ZioDevice.cpp.
|
protected |
Emits the getCurrentDevice signal and returns the resulting device, or else throws an exception if a device is not returned in response to the signal.
Definition at line 192 of file ZioDevice.cpp.
Referenced by createTags(), getTextMode(), isReadable(), isWritable(), seek(), setTextMode(), waitForBytesWritten(), waitForReadyRead(), writeBytes(), and writeString().
|
protected |
Initializes QIODevice enumeration tags.
Definition at line 56 of file ZioDevice.cpp.
Referenced by ZioDevice().
|
signal |
Connected devices should listen to this signal and respond by returning a pointer to the QIODevice object for which this ZioDevice object is currently providing a Javascript interface.
for example:
QFile f = new QFile(); device = qobject_cast<QIODevice>(f);
ZioDevice can't cache the pointer to QIODevice because some classes, such as QTextStream, allow the QIODevice object to be reset (i.e. via the QTextStream::setDevice method).
device | A pointer to a pointer to a QIODevice object. The connected slot should write the pointer to its class's QIODevice object to this location. |
Referenced by close(), connectedDevice(), getErrorString(), and reset().
QString Zbl::ZioDevice::getErrorString | ( | ) |
Definition at line 203 of file ZioDevice.cpp.
Referenced by writeBytes(), and writeString().
QVariant Zbl::ZioDevice::getTags | ( | ) |
Definition at line 305 of file ZioDevice.cpp.
bool Zbl::ZioDevice::getTextMode | ( | ) | const |
Definition at line 96 of file ZioDevice.cpp.
bool Zbl::ZioDevice::isOpen | ( | ) | const |
Referenced by createTags().
bool Zbl::ZioDevice::isReadable | ( | ) | const |
Definition at line 173 of file ZioDevice.cpp.
bool Zbl::ZioDevice::isSequential | ( | ) |
Referenced by setTextMode().
bool Zbl::ZioDevice::isWritable | ( | ) | const |
Definition at line 163 of file ZioDevice.cpp.
int Zbl::ZioDevice::openMode | ( | ) | const |
Referenced by createTags().
qint64 Zbl::ZioDevice::pos | ( | ) | const |
Referenced by setTextMode().
|
static |
Registers ZioDevice as a QML type.
Definition at line 48 of file ZioDevice.cpp.
Referenced by Zbl::Zblcore::registerTypes().
void Zbl::ZioDevice::reset | ( | ) |
Definition at line 215 of file ZioDevice.cpp.
bool Zbl::ZioDevice::seek | ( | qint64 | pos | ) |
Definition at line 239 of file ZioDevice.cpp.
void Zbl::ZioDevice::setTextMode | ( | bool | textModeEnabled | ) |
Definition at line 105 of file ZioDevice.cpp.
qint64 Zbl::ZioDevice::size | ( | ) | const |
Referenced by setTextMode().
bool Zbl::ZioDevice::waitForBytesWritten | ( | int | msecs | ) |
Definition at line 247 of file ZioDevice.cpp.
bool Zbl::ZioDevice::waitForReadyRead | ( | int | msecs | ) |
Definition at line 255 of file ZioDevice.cpp.
qint64 Zbl::ZioDevice::writeBytes | ( | const QObject * | data | ) |
Write the contents of a ZByteArray to the device.
Definition at line 280 of file ZioDevice.cpp.
qint64 Zbl::ZioDevice::writeString | ( | const QString & | text | ) |
Write a string to the device.
Definition at line 263 of file ZioDevice.cpp.
|
staticprotected |
A QVariant containing a QVariantMap of QIODevice enumerations for use by background Javascript threads.
This is needed because background Javascript threads can't use QQmlEngine's type system.
Definition at line 233 of file ZioDevice.h.
Referenced by createTags(), and getTags().
|
read |
Returns true if the current read and write position is at the end of the device.
Definition at line 103 of file ZioDevice.h.
|
read |
Definition at line 125 of file ZioDevice.h.
|
read |
Definition at line 130 of file ZioDevice.h.
|
read |
Definition at line 133 of file ZioDevice.h.
|
read |
Returns true if the device is open; otherwise returns false.
Definition at line 71 of file ZioDevice.h.
|
read |
Definition at line 87 of file ZioDevice.h.
|
read |
Returns the mode in which the device has been opened; i.e. ReadOnly or WriteOnly.
Definition at line 77 of file ZioDevice.h.
|
read |
Definition at line 120 of file ZioDevice.h.
|
read |
Returns true if the device is readable, false otherwise.
Definition at line 97 of file ZioDevice.h.
|
read |
For open random-access devices, this function returns the size of the device. For open sequential devices, bytesAvailable() is returned.
If the device is closed, the size returned will not reflect the actual size of the device.
Definition at line 115 of file ZioDevice.h.
|
read |
Definition at line 134 of file ZioDevice.h.
|
readwrite |
Sets and gets the text mode flag. When set
sequences are converted to/from
when reading/writing the device on Windows.
Definition at line 84 of file ZioDevice.h.
|
read |
Returns true if the device is writable, false otherwise.
Definition at line 92 of file ZioDevice.h.
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.