ACF $AcfVersion:0$
CCompactXmlReadArchiveBase.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
9// ACF includes
12
13#include <iser/iser.h>
14
15
16namespace iser
17{
18
19
26{
27public:
29 bool serializeHeader = true,
30 const iser::CArchiveTag& rootTag = s_acfRootTag);
31
32 // reimplemented (iser::IArchive)
33 virtual bool IsTagSkippingSupported() const override;
34 virtual bool BeginTag(const iser::CArchiveTag& tag) override;
35 virtual bool BeginMultiTag(const iser::CArchiveTag& tag, const iser::CArchiveTag& subTag, int& count) override;
36 virtual bool EndTag(const iser::CArchiveTag& tag) override;
37 virtual bool Process(QString& value) override;
39
40protected:
41 bool ReadStringNode(QString& text);
42
43 bool SetContent(QIODevice* devicePtr);
44
45 // reimplemented (iser::CTextReadArchiveBase)
46 virtual bool ReadTextNode(QByteArray& text) override;
47
48 virtual void DecorateMessage(
50 int id,
51 int flags,
52 QString& message,
53 QString& messageSource) const override;
54
55 QDomDocument m_document;
56 QDomElement m_currentParent;
57
58private:
59 QByteArray m_currentAttribute;
60
61 bool m_serializeHeader;
62 iser::CArchiveTag m_rootTag;
63
64 bool m_isNewFormat; // idicate that new format is enabled
65 bool m_allowAttribute; // indicate if attribute outputting is allowed now
66
67 typedef QList<const iser::CArchiveTag*> TagsList;
68 TagsList m_tagsStack;
69};
70
71
72} // namespace iser
73
74
75
76
static CArchiveTag s_acfRootTag
Process tag used to group data in archive stream.
Definition CArchiveTag.h:22
Qt-based implementation of archive reading from XML file.
CCompactXmlReadArchiveBase(bool serializeHeader=true, const iser::CArchiveTag &rootTag=s_acfRootTag)
bool SetContent(QIODevice *devicePtr)
virtual bool IsTagSkippingSupported() const override
Checks if skipping to the end of a tag on EndTag() is supported.
virtual bool EndTag(const iser::CArchiveTag &tag) override
Ends a tagged section in the 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 ReadTextNode(QByteArray &text) override
Read single unformatted text node.
bool ReadStringNode(QString &text)
virtual bool BeginTag(const iser::CArchiveTag &tag) override
Begins a tagged section in the archive.
virtual void DecorateMessage(istd::IInformationProvider::InformationCategory category, int id, int flags, QString &message, QString &messageSource) const override
Decorate message parts before outputting.
virtual bool Process(QString &value) override
Process primitive type.
Common archive implementation of text-based reading archives.
Base class for all XML implementations for ACF documents.
virtual bool Process(bool &value)=0
Processes (reads or writes) a boolean value.
InformationCategory
Category of information.
Contains general persistence mechanism with basic archives implementations.