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 Types | Public Slots | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Static Protected Attributes | Properties | List of all members
Zbl::ZTextStream Class Reference

Reads and writes UTF-8 text to an i/o stream. More...

#include <ZTextStream.h>

Inheritance diagram for Zbl::ZTextStream:
Inheritance graph
Collaboration diagram for Zbl::ZTextStream:
Collaboration graph

Public Types

enum  RealNumberNotation { SmartNotation = QTextStream::SmartNotation, FixedNotation = QTextStream::FixedNotation, ScientificNotation = QTextStream::ScientificNotation }
enum  FieldAlignment { AlignLeft = QTextStream::AlignLeft, AlignRight = QTextStream::AlignRight, AlignCenter = QTextStream::AlignCenter, AlignAccountingStyle = QTextStream::AlignAccountingStyle }
enum  Status { Ok = QTextStream::Ok, ReadPastEnd = QTextStream::ReadPastEnd, ReadCorruptData = QTextStream::ReadCorruptData, WriteFailed = QTextStream::WriteFailed }
enum  NumberFlag {
  ShowBase =QTextStream::ShowBase, ForcePoint = QTextStream::ForcePoint, ForceSign = QTextStream::ForceSign, UppercaseBase = QTextStream::UppercaseBase,
  UppercaseDigits = QTextStream::UppercaseDigits
typedef QSharedPointer< QTextStream > QTextStreamPtr

Public Slots

void getQDevice (QIODevice **device)

Public Member Functions

 ZTextStream (QObject *parent=nullptr)
 ZTextStream (const ZqIODevicePtr device, QObject *parent=nullptr)
 ZTextStream (const ZqStringPtr string, QObject *parent=nullptr)
virtual ~ZTextStream ()
QVariant getTags ()
QObject * getJsDevice ()
bool getAutoDetectUnicode () const
void setAutoDetectUnicode (bool autoDetectOn)
uint getStatus () const
bool atEnd () const
QVariant pos () const
void setFieldAlignment (uint alignment)
uint getFieldAlignment () const
void setPadChar (uint ch)
uint getPadChar () const
void setFieldWidth (int width)
int getFieldWidth () const
void setNumberFlags (uint flags)
uint getNumberFlags () const
void setIntegerBase (int base)
int getIntegerBase () const
void setRealNumberNotation (uint notation)
uint getRealNumberNotation () const
void setRealNumberPrecision (int precision)
int getRealNumberPrecision () const
QString getString () const
Q_INVOKABLE void release ()
Q_INVOKABLE void resetStatus ()
Q_INVOKABLE void reset ()
Q_INVOKABLE void flush ()
Q_INVOKABLE bool seek (QVariant pos)
Q_INVOKABLE void skipWhiteSpace ()
Q_INVOKABLE void setLocale (const QString &locale)
Q_INVOKABLE QString read (qint64 maxSize)
Q_INVOKABLE QString readLine (qint64 maxSize)
Q_INVOKABLE QString readAll ()
Q_INVOKABLE uint readChar ()
Q_INVOKABLE signed short readShort ()
Q_INVOKABLE unsigned short readUShort ()
Q_INVOKABLE signed int readInt ()
Q_INVOKABLE unsigned int readUInt ()
Q_INVOKABLE signed long readLong ()
Q_INVOKABLE unsigned long readULong ()
Q_INVOKABLE qlonglong readLongLong ()
Q_INVOKABLE qulonglong readULongLong ()
Q_INVOKABLE float readFloat ()
Q_INVOKABLE double readDouble ()
Q_INVOKABLE QString readString ()
Q_INVOKABLE QObject * readBytes ()
Q_INVOKABLE bool writeLine (const QString &text)
Q_INVOKABLE bool writeChar (uint data)
Q_INVOKABLE bool writeShort (signed short data)
Q_INVOKABLE bool writeUShort (unsigned short data)
Q_INVOKABLE bool writeInt (signed int data)
Q_INVOKABLE bool writeUInt (unsigned int data)
Q_INVOKABLE bool writeLong (signed long data)
Q_INVOKABLE bool writeULong (unsigned long data)
Q_INVOKABLE bool writeLongLong (qlonglong data)
Q_INVOKABLE bool writeULongLong (qulonglong data)
Q_INVOKABLE bool writeFloat (float data)
Q_INVOKABLE bool writeDouble (double data)
Q_INVOKABLE bool writeString (const QString &text)
Q_INVOKABLE bool writeBytes (QObject *data)

Static Public Member Functions

static void registerType ()
 Registers ZTextStream as a QML type. More...

Protected Member Functions

void createTags ()
void initZioDevice ()
void validateData () const
void validateReadable () const
void validateWritable () const

Protected Attributes

ZqIODevicePtr m_d
QTextStream * m_t
ZqStringPtr m_s
 Pointer to contained ZioDevice object. More...

Static Protected Attributes

static QVariant m_tags
 QVariantMap of QTextStream enumerations for use by Javascript programs. More...


QVariant tags
 A Javascript object containing QFile enumeration values. More...
QObject device
 A ZioDevice object presents this object's QIODevice interface to Javascript programs. More...
bool autoDetectUnicode
bool atEnd
QVariant pos
uint status
uint fieldAlignment
uint padChar
int fieldWidth
uint numberFlags
int integerBase
uint realNumberNotation
int realNumberPrecision
QString string

Detailed Description

Reads and writes UTF-8 text to an i/o stream.

This class presents a Javascript interface to Qt QTextStream objects. The text stream can be connected to either a QIODevice or QString object.

Text can be read and written using either Javascript strings, ZByteArray objects (Javascript wrapper objects for QByteArray) or various size integer, float and double types.

TBD: add ability to write bytes from Javascript array of integers?

Definition at line 49 of file ZTextStream.h.

Member Typedef Documentation

◆ QTextStreamPtr

typedef QSharedPointer<QTextStream> Zbl::ZTextStream::QTextStreamPtr

Definition at line 58 of file ZTextStream.h.

Member Enumeration Documentation

◆ FieldAlignment


Definition at line 72 of file ZTextStream.h.

◆ NumberFlag


Definition at line 87 of file ZTextStream.h.

◆ RealNumberNotation


Definition at line 66 of file ZTextStream.h.

◆ Status


Definition at line 79 of file ZTextStream.h.

Constructor & Destructor Documentation

◆ ZTextStream() [1/3]

Zbl::ZTextStream::ZTextStream ( QObject *  parent = nullptr)

Definition at line 36 of file ZTextStream.cpp.

◆ ZTextStream() [2/3]

Zbl::ZTextStream::ZTextStream ( const ZqIODevicePtr  device,
QObject *  parent = nullptr 

Definition at line 52 of file ZTextStream.cpp.

◆ ZTextStream() [3/3]

Zbl::ZTextStream::ZTextStream ( const ZqStringPtr  string,
QObject *  parent = nullptr 

Definition at line 68 of file ZTextStream.cpp.

◆ ~ZTextStream()

Zbl::ZTextStream::~ZTextStream ( )

Definition at line 84 of file ZTextStream.cpp.

Member Function Documentation

◆ atEnd()

bool Zbl::ZTextStream::atEnd ( ) const

Referenced by getStatus().

◆ createTags()

void Zbl::ZTextStream::createTags ( )

Definition at line 91 of file ZTextStream.cpp.

Referenced by ZTextStream().

◆ flush()

void Zbl::ZTextStream::flush ( )

Definition at line 387 of file ZTextStream.cpp.

◆ getAutoDetectUnicode()

bool Zbl::ZTextStream::getAutoDetectUnicode ( ) const

Definition at line 186 of file ZTextStream.cpp.

Referenced by seek(), and setLocale().

◆ getFieldAlignment()

uint Zbl::ZTextStream::getFieldAlignment ( ) const

Definition at line 261 of file ZTextStream.cpp.

◆ getFieldWidth()

int Zbl::ZTextStream::getFieldWidth ( ) const

Definition at line 278 of file ZTextStream.cpp.

◆ getIntegerBase()

int Zbl::ZTextStream::getIntegerBase ( ) const

Definition at line 329 of file ZTextStream.cpp.

◆ getJsDevice()

QObject * Zbl::ZTextStream::getJsDevice ( )

Definition at line 173 of file ZTextStream.cpp.

◆ getNumberFlags()

uint Zbl::ZTextStream::getNumberFlags ( ) const

Definition at line 227 of file ZTextStream.cpp.

◆ getPadChar()

uint Zbl::ZTextStream::getPadChar ( ) const

Definition at line 312 of file ZTextStream.cpp.

◆ getQDevice

void Zbl::ZTextStream::getQDevice ( QIODevice **  device)

Definition at line 180 of file ZTextStream.cpp.

Referenced by initZioDevice().

◆ getRealNumberNotation()

uint Zbl::ZTextStream::getRealNumberNotation ( ) const

Definition at line 244 of file ZTextStream.cpp.

◆ getRealNumberPrecision()

int Zbl::ZTextStream::getRealNumberPrecision ( ) const

Definition at line 295 of file ZTextStream.cpp.

◆ getStatus()

uint Zbl::ZTextStream::getStatus ( ) const

Definition at line 203 of file ZTextStream.cpp.

◆ getString()

QString Zbl::ZTextStream::getString ( ) const

Definition at line 346 of file ZTextStream.cpp.

◆ getTags()

QVariant Zbl::ZTextStream::getTags ( )

Definition at line 168 of file ZTextStream.cpp.

◆ initZioDevice()

void Zbl::ZTextStream::initZioDevice ( )

Definition at line 121 of file ZTextStream.cpp.

Referenced by ZTextStream().

◆ pos()

QVariant Zbl::ZTextStream::pos ( ) const

Referenced by getStatus().

◆ read()

QString Zbl::ZTextStream::read ( qint64  maxSize)

Definition at line 422 of file ZTextStream.cpp.

◆ readAll()

QString Zbl::ZTextStream::readAll ( )

Definition at line 431 of file ZTextStream.cpp.

◆ readBytes()

QObject * Zbl::ZTextStream::readBytes ( )

Definition at line 485 of file ZTextStream.cpp.

◆ readChar()

readUShort readUInt readULong readULongLong readDouble uint Zbl::ZTextStream::readChar ( )

Definition at line 463 of file ZTextStream.cpp.

◆ readDouble()

Q_INVOKABLE double Zbl::ZTextStream::readDouble ( )

◆ readFloat()

Q_INVOKABLE float Zbl::ZTextStream::readFloat ( )

◆ readInt()

Q_INVOKABLE signed int Zbl::ZTextStream::readInt ( )

◆ readLine()

QString Zbl::ZTextStream::readLine ( qint64  maxSize)

Definition at line 413 of file ZTextStream.cpp.

◆ readLong()

Q_INVOKABLE signed long Zbl::ZTextStream::readLong ( )

◆ readLongLong()

Q_INVOKABLE qlonglong Zbl::ZTextStream::readLongLong ( )

◆ readShort()

Q_INVOKABLE signed short Zbl::ZTextStream::readShort ( )

◆ readString()

QString Zbl::ZTextStream::readString ( )

Definition at line 474 of file ZTextStream.cpp.

◆ readUInt()

Q_INVOKABLE unsigned int Zbl::ZTextStream::readUInt ( )

◆ readULong()

Q_INVOKABLE unsigned long Zbl::ZTextStream::readULong ( )

◆ readULongLong()

Q_INVOKABLE qulonglong Zbl::ZTextStream::readULongLong ( )

◆ readUShort()

Q_INVOKABLE unsigned short Zbl::ZTextStream::readUShort ( )

◆ registerType()

void Zbl::ZTextStream::registerType ( )

Registers ZTextStream as a QML type.

Definition at line 154 of file ZTextStream.cpp.

Referenced by Zbl::Zblcore::registerTypes().

◆ release()

void Zbl::ZTextStream::release ( )

Definition at line 365 of file ZTextStream.cpp.

◆ reset()

void Zbl::ZTextStream::reset ( )

Definition at line 378 of file ZTextStream.cpp.

◆ resetStatus()

void Zbl::ZTextStream::resetStatus ( )

Definition at line 356 of file ZTextStream.cpp.

◆ seek()

bool Zbl::ZTextStream::seek ( QVariant  pos)

Definition at line 396 of file ZTextStream.cpp.

◆ setAutoDetectUnicode()

void Zbl::ZTextStream::setAutoDetectUnicode ( bool  autoDetectOn)

Definition at line 194 of file ZTextStream.cpp.

◆ setFieldAlignment()

void Zbl::ZTextStream::setFieldAlignment ( uint  alignment)

Definition at line 269 of file ZTextStream.cpp.

◆ setFieldWidth()

void Zbl::ZTextStream::setFieldWidth ( int  width)

Definition at line 286 of file ZTextStream.cpp.

◆ setIntegerBase()

void Zbl::ZTextStream::setIntegerBase ( int  base)

Definition at line 337 of file ZTextStream.cpp.

◆ setLocale()

void Zbl::ZTextStream::setLocale ( const QString &  locale)

Definition at line 159 of file ZTextStream.cpp.

◆ setNumberFlags()

void Zbl::ZTextStream::setNumberFlags ( uint  flags)

Definition at line 235 of file ZTextStream.cpp.

◆ setPadChar()

void Zbl::ZTextStream::setPadChar ( uint  ch)

Definition at line 320 of file ZTextStream.cpp.

◆ setRealNumberNotation()

void Zbl::ZTextStream::setRealNumberNotation ( uint  notation)

Definition at line 252 of file ZTextStream.cpp.

◆ setRealNumberPrecision()

void Zbl::ZTextStream::setRealNumberPrecision ( int  precision)

Definition at line 303 of file ZTextStream.cpp.

◆ skipWhiteSpace()

void Zbl::ZTextStream::skipWhiteSpace ( )

Definition at line 404 of file ZTextStream.cpp.

◆ validateData()

void Zbl::ZTextStream::validateData ( ) const

◆ validateReadable()

void Zbl::ZTextStream::validateReadable ( ) const

Definition at line 138 of file ZTextStream.cpp.

Referenced by read(), readAll(), readBytes(), readChar(), readLine(), and readString().

◆ validateWritable()

void Zbl::ZTextStream::validateWritable ( ) const

Definition at line 145 of file ZTextStream.cpp.

Referenced by writeBytes(), writeChar(), writeLine(), and writeString().

◆ writeBytes()

bool Zbl::ZTextStream::writeBytes ( QObject *  data)

Definition at line 531 of file ZTextStream.cpp.

◆ writeChar()

writeUShort writeUInt writeULong writeULongLong writeDouble bool Zbl::ZTextStream::writeChar ( uint  data)

Definition at line 521 of file ZTextStream.cpp.

◆ writeDouble()

Q_INVOKABLE bool Zbl::ZTextStream::writeDouble ( double  data)

◆ writeFloat()

Q_INVOKABLE bool Zbl::ZTextStream::writeFloat ( float  data)

◆ writeInt()

Q_INVOKABLE bool Zbl::ZTextStream::writeInt ( signed int  data)

◆ writeLine()

bool Zbl::ZTextStream::writeLine ( const QString &  text)

Definition at line 556 of file ZTextStream.cpp.

◆ writeLong()

Q_INVOKABLE bool Zbl::ZTextStream::writeLong ( signed long  data)

◆ writeLongLong()

Q_INVOKABLE bool Zbl::ZTextStream::writeLongLong ( qlonglong  data)

◆ writeShort()

Q_INVOKABLE bool Zbl::ZTextStream::writeShort ( signed short  data)

◆ writeString()

bool Zbl::ZTextStream::writeString ( const QString &  text)

Definition at line 546 of file ZTextStream.cpp.

◆ writeUInt()

Q_INVOKABLE bool Zbl::ZTextStream::writeUInt ( unsigned int  data)

◆ writeULong()

Q_INVOKABLE bool Zbl::ZTextStream::writeULong ( unsigned long  data)

◆ writeULongLong()

Q_INVOKABLE bool Zbl::ZTextStream::writeULongLong ( qulonglong  data)

◆ writeUShort()

Q_INVOKABLE bool Zbl::ZTextStream::writeUShort ( unsigned short  data)

Member Data Documentation

◆ m_d

ZqIODevicePtr Zbl::ZTextStream::m_d

Definition at line 217 of file ZTextStream.h.

Referenced by release(), validateData(), validateReadable(), validateWritable(), and ZTextStream().

◆ m_s

ZqStringPtr Zbl::ZTextStream::m_s

Definition at line 222 of file ZTextStream.h.

Referenced by validateData(), and ZTextStream().

◆ m_t

QTextStream* Zbl::ZTextStream::m_t

◆ m_tags

QVariant Zbl::ZTextStream::m_tags

QVariantMap of QTextStream enumerations for use by Javascript programs.

Definition at line 236 of file ZTextStream.h.

Referenced by createTags(), and getTags().

◆ m_zd

ZioDevice* Zbl::ZTextStream::m_zd

Pointer to contained ZioDevice object.

Definition at line 227 of file ZTextStream.h.

Referenced by getJsDevice(), and initZioDevice().

Property Documentation

◆ atEnd

bool Zbl::ZTextStream::atEnd

Definition at line 126 of file ZTextStream.h.

◆ autoDetectUnicode

bool Zbl::ZTextStream::autoDetectUnicode

Definition at line 124 of file ZTextStream.h.

◆ device

QObject Zbl::ZTextStream::device

A ZioDevice object presents this object's QIODevice interface to Javascript programs.

Definition at line 120 of file ZTextStream.h.

◆ fieldAlignment

uint Zbl::ZTextStream::fieldAlignment

Definition at line 130 of file ZTextStream.h.

◆ fieldWidth

int Zbl::ZTextStream::fieldWidth

Definition at line 132 of file ZTextStream.h.

◆ integerBase

int Zbl::ZTextStream::integerBase

Definition at line 134 of file ZTextStream.h.

◆ numberFlags

uint Zbl::ZTextStream::numberFlags

Definition at line 133 of file ZTextStream.h.

◆ padChar

uint Zbl::ZTextStream::padChar

Definition at line 131 of file ZTextStream.h.

◆ pos

QVariant Zbl::ZTextStream::pos

Definition at line 127 of file ZTextStream.h.

◆ realNumberNotation

uint Zbl::ZTextStream::realNumberNotation

Definition at line 135 of file ZTextStream.h.

◆ realNumberPrecision

int Zbl::ZTextStream::realNumberPrecision

Definition at line 136 of file ZTextStream.h.

◆ status

uint Zbl::ZTextStream::status

Definition at line 129 of file ZTextStream.h.

◆ string

QString Zbl::ZTextStream::string

Definition at line 137 of file ZTextStream.h.

◆ tags

QVariant Zbl::ZTextStream::tags

A Javascript object containing QFile enumeration values.

Definition at line 113 of file ZTextStream.h.

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