ACF $AcfVersion:0$
CCompactXmlWriteArchiveBase.h
Go to the documentation of this file.
1// SPDX-License-Identifier: LGPL-2.1-or-later OR GPL-2.0-or-later OR GPL-3.0-or-later OR LicenseRef-ACF-Commercial
2#pragma once
3
4
5// Qt includes
6#include <QtXml/QDomDocument>
7#include <QtXml/QDomNode>
8#include <QtCore/QXmlStreamWriter>
9#include <QtCore/QFile>
10
11// ACF includes
14
15#include <iser/iser.h>
16
17
18namespace iser
19{
20
21
28{
29public:
31
33
34 // reimplemented (iser::IArchive)
35 virtual bool IsTagSkippingSupported() const override;
36 virtual bool BeginTag(const iser::CArchiveTag& tag) override;
37 virtual bool BeginMultiTag(const iser::CArchiveTag& tag, const iser::CArchiveTag& subTag, int& count) override;
38 virtual bool EndTag(const iser::CArchiveTag& tag) override;
39 virtual bool Process(QString& value) override;
41
42protected:
44 const iser::IVersionInfo* versionInfoPtr,
45 bool serializeHeader,
46 const iser::CArchiveTag& rootTag);
47 bool InitArchive(QIODevice* devicePtr);
48 bool Flush();
49
50 bool WriteStringNode(const QString& text);
51
52 // reimplemented (iser::CTextWriteArchiveBase)
53 virtual bool WriteTextNode(const QByteArray& text) override;
54
55 QXmlStreamWriter m_xmlWriter;
56
57private:
58 QByteArray m_currentAttribute;
59
60 bool m_serializeHeader;
61 iser::CArchiveTag m_rootTag;
62
63 bool m_isSeparatorNeeded; // idicate that separator must be added before something is outputted
64 bool m_allowAttribute; // indicate if attribute outputting is allowed now
65
66 QList<const iser::CArchiveTag*> m_tagsStack;
67};
68
69
70} // namespace iser
71
72
73
74
Process tag used to group data in archive stream.
Definition CArchiveTag.h:22
Base class of compact XML write archive.
virtual bool BeginMultiTag(const iser::CArchiveTag &tag, const iser::CArchiveTag &subTag, int &count) override
Begins a tagged section containing multiple elements of the same type.
virtual bool IsTagSkippingSupported() const override
Checks if skipping to the end of a tag on EndTag() is supported.
bool InitArchive(QIODevice *devicePtr)
bool WriteStringNode(const QString &text)
virtual bool Process(QString &value) override
Process primitive type.
CCompactXmlWriteArchiveBase(const iser::IVersionInfo *versionInfoPtr, bool serializeHeader, const iser::CArchiveTag &rootTag)
virtual bool WriteTextNode(const QByteArray &text) override
Write single unformatted text node.
virtual bool BeginTag(const iser::CArchiveTag &tag) override
Begins a tagged section in the archive.
virtual bool EndTag(const iser::CArchiveTag &tag) override
Ends a tagged section in the archive.
Common archive implementation of text-based storing archives.
virtual bool Process(bool &value) override
Processes (reads or writes) a boolean value.
Base class for all XML implementations for ACF documents.
Provides access to version information.
Contains general persistence mechanism with basic archives implementations.