FastInfosetStreamWriter Class

FastInfosetStreamWriter represents a writer that provides a fast, non-cached, forward-only way to generate FastInfoset stream or file. More...

Header: #include <FastInfosetStreamWriter>
Inherits: IXmlStreamWriter

Public Functions

FastInfosetStreamWriter(QIODevice *device, QObject *parent = Q_NULL)
FastInfosetStreamWriter(const QString &fileName, QObject *parent = Q_NULL)
FastInfosetStreamWriter(QObject *parent = Q_NULL)
virtual ~FastInfosetStreamWriter()
const QString &encoding() const
FastInfoset::ErrorCode error() const
QString errorString() const
void setEncoding(const QString &encoding)
void writeBase64(const QByteArray &value)
void writeCurrentToken(const FastInfosetStreamReader &reader)
void writeEmptyElement(const QString &prefix, const QString &namespaceUri, const QString &name)
void writeEncodedAttribute(const QString &prefix, const QString &namespaceUri, const QString &name, const QVariant &value, FastInfoset::EncodingAlgorithmId id)
void writeEncodedAttribute(const QString &qualifiedName, const QVariant &value, FastInfoset::EncodingAlgorithmId id)
void writeEncodedAttribute(const QString &namespaceUri, const QString &name, const QVariant &value, FastInfoset::EncodingAlgorithmId id)
void writeEncodedCharacters(const QString &text, FastInfoset::EncodingAlgorithmId id)
void writeStartElement(const QString &prefix, const QString &namespaceUri, const QString &name)

Reimplemented Public Functions

virtual bool autoFormatting() const override
virtual int autoFormattingIndent() const override
virtual QIODevice *device() const override
virtual bool hasError() const override
virtual void setAutoFormatting(bool) override
virtual void setAutoFormattingIndent(int spacesOrTabs) override
virtual void setDevice(QIODevice *device) override
virtual void writeAttribute(const QString &qualifiedName, const QString &value) override
virtual void writeAttribute(const QString &namespaceUri, const QString &name, const QString &value) override
virtual void writeAttribute(const QXmlStreamAttribute &attribute) override
virtual void writeAttributeValue(const QString &qualifiedName, const QVariant &value) override
virtual void writeAttributeValue(const QString &namespaceUri, const QString &name, const QVariant &value) override
virtual void writeAttributes(const QXmlStreamAttributes &attributes) override
virtual void writeCDATA(const QString &text) override
virtual void writeComment(const QString &text) override
virtual void writeCurrentToken(const QXmlStreamReader &reader) override
virtual void writeDTD(const QString &name, const QString &publicId, const QString &systemId) override
virtual void writeDefaultNamespace(const QString &namespaceUri) override
virtual void writeEmptyElement(const QString &qualifiedName) override
virtual void writeEmptyElement(const QString &namespaceUri, const QString &name) override
virtual void writeEndDocument() override
virtual void writeEndElement() override
virtual void writeEntityReference(const QString &name) override
virtual void writeNamespace(const QString &namespaceUri, const QString &prefix = QString()) override
virtual void writeProcessingInstruction(const QString &target, const QString &data = QString()) override
virtual void writeStartDocument(const QString &version, bool standalone) override
virtual void writeStartDocument() override
virtual void writeStartDocument(const QString &version) override
virtual void writeStartElement(const QString &qualifiedName) override
virtual void writeStartElement(const QString &namespaceUri, const QString &name) override
virtual void writeTextElement(const QString &qualifiedName, const QString &text) override
virtual void writeTextElement(const QString &namespaceUri, const QString &name, const QString &text) override

Detailed Description

FastInfosetStreamWriter is the counterpart to FastInfosetStreamReader for writing FastInfoset data. Like its related class, it operates on a QIODevice specified with setDevice(). The API is simple and straightforward: for every XML token or event you want to write, the writer provides a specialized function. FastInfosetStreamWriter it is an analog for QXmlStreamWriter from QtXml module.

Member Function Documentation

FastInfosetStreamWriter::FastInfosetStreamWriter(QIODevice *device, QObject *parent = Q_NULL)

Constructs a FastInfoset stream writer with the given parent that will be forward a FastInfoset stream to the output device.

FastInfosetStreamWriter::FastInfosetStreamWriter(const QString &fileName, QObject *parent = Q_NULL)

Constructs a FastInfoset stream writer with the given parent that will be forward a FastInfoset stream to the file fileName.

FastInfosetStreamWriter::FastInfosetStreamWriter(QObject *parent = Q_NULL)

Constructs a FastInfoset stream writer with the given parent.

See also setDevice.

[virtual] FastInfosetStreamWriter::~FastInfosetStreamWriter()

Destructor.

[override virtual] bool FastInfosetStreamWriter::autoFormatting() const

See also setAutoFormatting().

[override virtual] int FastInfosetStreamWriter::autoFormattingIndent() const

See also setAutoFormattingIndent().

[override virtual] QIODevice *FastInfosetStreamWriter::device() const

Returns an output device what used to store FastInfoset stream.

See also setDevice().

const QString &FastInfosetStreamWriter::encoding() const

Returns an encoding for FastInfoset stream.

See also setEncoding().

FastInfoset::ErrorCode FastInfosetStreamWriter::error() const

Returns the type of the current error, or FastInfoset::FSINoError if no error occurred.

See also errorString() and hasError().

QString FastInfosetStreamWriter::errorString() const

Returns the last error message that was set by FastInfoset writer.

See also error() and hasError().

[override virtual] bool FastInfosetStreamWriter::hasError() const

Returns true if an error has occurred, otherwise false.

See also errorString() and error().

[override virtual] void FastInfosetStreamWriter::setAutoFormatting(bool)

See also autoFormatting().

[override virtual] void FastInfosetStreamWriter::setAutoFormattingIndent(int spacesOrTabs)

See also autoFormattingIndent().

[override virtual] void FastInfosetStreamWriter::setDevice(QIODevice *device)

Sets an output device to the writer.

See also device().

void FastInfosetStreamWriter::setEncoding(const QString &encoding)

Sets an encoding for FastInfoset stream. You can use UTF8 or UTF16BE encoding only.

See also encoding().

[override virtual] void FastInfosetStreamWriter::writeAttribute(const QString &qualifiedName, const QString &value)

[override virtual] void FastInfosetStreamWriter::writeAttribute(const QString &namespaceUri, const QString &name, const QString &value)

[override virtual] void FastInfosetStreamWriter::writeAttribute(const QXmlStreamAttribute &attribute)

This is an overloaded function.

Writes the attribute.

This function can only be called after writeStartElement() before any content is written, or after writeEmptyElement().

[override virtual] void FastInfosetStreamWriter::writeAttributeValue(const QString &qualifiedName, const QVariant &value)

[override virtual] void FastInfosetStreamWriter::writeAttributeValue(const QString &namespaceUri, const QString &name, const QVariant &value)

[override virtual] void FastInfosetStreamWriter::writeAttributes(const QXmlStreamAttributes &attributes)

Writes the attribute vector attributes.

This function can only be called after writeStartElement() before any content is written, or after writeEmptyElement().

See also writeAttribute() and writeNamespace().

void FastInfosetStreamWriter::writeBase64(const QByteArray &value)

Writes value as a base64 text data to the FastInfoset stream. It is more fast than writeCharacters(text, AlgorithmBase64).

See also writeCDATA() and writeCharacters().

[override virtual] void FastInfosetStreamWriter::writeCDATA(const QString &text)

Writes text as CDATA section.

See also writeCharacters().

[override virtual] void FastInfosetStreamWriter::writeComment(const QString &text)

Writes text as XML comment, where text must not contain the forbidden sequence "--" or end with "-". Note that XML does not provide any way to escape "-" in a comment.

void FastInfosetStreamWriter::writeCurrentToken(const FastInfosetStreamReader &reader)

Writes the current state of the reader. All possible valid states are supported.

The purpose of this function is to support chained processing of XML data.

See also QXmlStreamReader::tokenType().

[override virtual] void FastInfosetStreamWriter::writeCurrentToken(const QXmlStreamReader &reader)

This is an overloaded function.

Writes the current state of the reader. All possible valid states are supported.

The purpose of this function is to support chained processing of XML data.

See also QXmlStreamReader::tokenType().

[override virtual] void FastInfosetStreamWriter::writeDTD(const QString &name, const QString &publicId, const QString &systemId)

Writes a DTD section. The name represents the name of the DTD, publicId represents the public id of the DTD and systemId represents the system id from the XML 1.0 specification.

[override virtual] void FastInfosetStreamWriter::writeDefaultNamespace(const QString &namespaceUri)

Writes a default namespace declaration for namespaceUri.

If writeStartElement() or writeEmptyElement() was called, the declaration applies to the current element; otherwise it applies to the next child element.

Note that the namespaces http://www.w3.org/XML/1998/namespace (bound to xmlns) and http://www.w3.org/2000/xmlns/ (bound to xml) by definition cannot be declared as default.

void FastInfosetStreamWriter::writeEmptyElement(const QString &prefix, const QString &namespaceUri, const QString &name)

Writes an empty element with name, prefixed for the specified namespaceUri and prefix. Subsequent calls to writeAttribute() will add attributes to this element.

See also writeNamespace().

[override virtual] void FastInfosetStreamWriter::writeEmptyElement(const QString &qualifiedName)

This is an overloaded function.

Writes an empty element with qualified name qualifiedName. Subsequent calls to writeAttribute() will add attributes to this element.

[override virtual] void FastInfosetStreamWriter::writeEmptyElement(const QString &namespaceUri, const QString &name)

This is an overloaded function.

Writes an empty element with name, prefixed for the specified namespaceUri. Subsequent calls to writeAttribute() will add attributes to this element.

See also writeNamespace().

void FastInfosetStreamWriter::writeEncodedAttribute(const QString &prefix, const QString &namespaceUri, const QString &name, const QVariant &value, FastInfoset::EncodingAlgorithmId id)

Writes an attribute with name and value, prefixed for the specified namespaceUri and prefix. Parameter id is used to encode attribute's value to decrease size of the output stream. By default encoding algorithm is not used.

This function can only be called after writeStartElement() before any content is written, or after writeEmptyElement().

See also FastInfoset::EncodingAlgorithmId.

void FastInfosetStreamWriter::writeEncodedAttribute(const QString &qualifiedName, const QVariant &value, FastInfoset::EncodingAlgorithmId id)

This is an overloaded function.

Writes an attribute with qualifiedName. Parameter id is used to encode attribute's value to decrease size of the output stream. By default encoding algorithm is not used.

This function can only be called after writeStartElement() before any content is written, or after writeEmptyElement().

See also FastInfoset::EncodingAlgorithmId.

void FastInfosetStreamWriter::writeEncodedAttribute(const QString &namespaceUri, const QString &name, const QVariant &value, FastInfoset::EncodingAlgorithmId id)

This is an overloaded function.

Writes an attribute with name and value, prefixed for the specified namespaceUri. Parameter id is used to encode attribute's value to decrease size of the output stream. By default encoding algorithm is not used.

This function can only be called after writeStartElement() before any content is written, or after writeEmptyElement().

See also FastInfoset::EncodingAlgorithmId.

void FastInfosetStreamWriter::writeEncodedCharacters(const QString &text, FastInfoset::EncodingAlgorithmId id)

Writes text as a characters data to the FastInfoset stream. Parameter id is used to encode attribute's value to decrease size of the output stream. By default encoding algorithm is not used.

See also writeCDATA().

[override virtual] void FastInfosetStreamWriter::writeEndDocument()

Closes all remaining open start elements and closes the FastInfoset stream. Note that the output device is still open for writing.

See also writeStartDocument().

[override virtual] void FastInfosetStreamWriter::writeEndElement()

Closes the previous start element.

See also writeStartElement().

[override virtual] void FastInfosetStreamWriter::writeEntityReference(const QString &name)

Writes the entity reference name to the stream.

[override virtual] void FastInfosetStreamWriter::writeNamespace(const QString &namespaceUri, const QString &prefix = QString())

Writes a namespace declaration for namespaceUri with prefix. If prefix is empty, FastInfosetStreamWriter assigns a unique prefix consisting of the letter 'n' followed by a number.

If writeStartElement() or writeEmptyElement() was called, the declaration applies to the current element; otherwise it applies to the next child element.

Note that the prefix xml is both predefined and reserved for http://www.w3.org/XML/1998/namespace, which in turn cannot be bound to any other prefix. The prefix xmlns and its URI http://www.w3.org/2000/xmlns/ are used for the namespace mechanism itself and thus completely forbidden in declarations.

[override virtual] void FastInfosetStreamWriter::writeProcessingInstruction(const QString &target, const QString &data = QString())

Writes an XML processing instruction with target and data, where data must not contain the sequence "?>".

[override virtual] void FastInfosetStreamWriter::writeStartDocument(const QString &version, bool standalone)

Writes a document start with the version number version and a standalone attribute standalone.

See also writeEndDocument().

[override virtual] void FastInfosetStreamWriter::writeStartDocument()

This is an overloaded function.

Writes a document start with the version number "1.0" and UTF8 encoding.

See also writeEndDocument().

[override virtual] void FastInfosetStreamWriter::writeStartDocument(const QString &version)

This is an overloaded function.

Writes a document start with the version number version.

See also writeEndDocument().

void FastInfosetStreamWriter::writeStartElement(const QString &prefix, const QString &namespaceUri, const QString &name)

Writes a start element with name, prefixed for the specified namespaceUri and prefix. Subsequent calls to writeAttribute() will add attributes to this element.

See also writeNamespace(), writeEndElement(), and writeEmptyElement().

[override virtual] void FastInfosetStreamWriter::writeStartElement(const QString &qualifiedName)

This is an overloaded function.

Writes a start element with qualifiedName. Subsequent calls to writeAttribute() will add attributes to this element.

See also writeEndElement() and writeEmptyElement().

[override virtual] void FastInfosetStreamWriter::writeStartElement(const QString &namespaceUri, const QString &name)

This is an overloaded function.

Writes a start element with name, prefixed for the specified namespaceUri. Subsequent calls to writeAttribute() will add attributes to this element.

See also writeNamespace(), writeEndElement(), and writeEmptyElement().

[override virtual] void FastInfosetStreamWriter::writeTextElement(const QString &qualifiedName, const QString &text)

[override virtual] void FastInfosetStreamWriter::writeTextElement(const QString &namespaceUri, const QString &name, const QString &text)