ICF 3.1.1.10
Technical documentation of ICF Libraries
CCompactXmlReadArchiveBase.h
Go to the documentation of this file.
1/********************************************************************************
2** This file is part of the ICF Framework. Copyright (C) Witold Gantzke & Kirill Lepskiy
3** ICF Framework may be used under the terms of the LGPL License v. 2.1 by the Free Software Foundation.
4********************************************************************************/
5
6#pragma once
7
8
9// Qt includes
10#include <QtXml/QDomDocument>
11#include <QtXml/QDomNode>
12
13// ICF includes
16
17#include <iser/iser.h>
18
19
20namespace iser
21{
22
23
28{
29public:
31
33 bool serializeHeader = true,
34 const CArchiveTag& rootTag = s_acfRootTag);
35
36 // reimplemented (iser::IArchive)
37 bool IsTagSkippingSupported() const override;
39 const iser::CArchiveTag& listTag,
40 const iser::CArchiveTag& subTag,
41 int count,
42 std::function<bool(int, iser::IArchive&)> iterArchiveFn,
43 std::function<bool(int)> resizeFn = nullptr) override;
45 const iser::CArchiveTag& listTag,
46 const iser::CArchiveTag& groupTag,
47 int count,
48 std::function<bool(int, iser::IArchive&)> groupArchiveFn,
49 std::function<bool(int)> resizeFn = nullptr) override;
51 bool ProcessLeaf(const CArchiveTag& tag, QString& value) override;
52
53protected:
54 bool ReadStringNode(QString& text);
55 bool SetContent(QIODevice* devicePtr);
56 bool BeginCountTag(const CArchiveTag& mainTag, const CArchiveTag& subTag, int& count);
57
58 // reimplemented (iser::CTextReadArchiveBase)
59 bool ReadTextNode(QByteArray& text) override;
60 bool BeginTag(const CArchiveTag& tag) override;
61 bool EndTag(const CArchiveTag& tag) override;
62
63 // reimplemented (istd::ILogger)
66 int id,
67 int flags,
68 QString& message,
69 QString& messageSource) const override;
70
71 QDomDocument m_document;
72 QDomElement m_currentParent;
73
74private:
75 QByteArray m_currentAttribute;
76
77 bool m_serializeHeader;
78 CArchiveTag m_rootTag;
79
80 bool m_allowAttribute; // indicate if attribute outputting is allowed now
81
82 typedef QList<const CArchiveTag*> TagsList;
83 TagsList m_tagsStack;
84};
85
86
87} // namespace iser
88
89
static CArchiveTag s_acfRootTag
Process tag used to group data in archive stream.
Definition CArchiveTag.h:25
Qt-based implementation of archive reading from XML file.
bool ProcessGroupList(const iser::CArchiveTag &listTag, const iser::CArchiveTag &groupTag, int count, std::function< bool(int, iser::IArchive &)> groupArchiveFn, std::function< bool(int)> resizeFn=nullptr) override
bool BeginCountTag(const CArchiveTag &mainTag, const CArchiveTag &subTag, int &count)
bool ReadTextNode(QByteArray &text) override
Read single unformatted text node.
bool SetContent(QIODevice *devicePtr)
bool EndTag(const CArchiveTag &tag) override
End of archive tag.
bool ProcessLeaf(const CArchiveTag &tag, QString &value) override
Process primitive type.
bool BeginTag(const CArchiveTag &tag) override
Begin of archive tag.
void DecorateMessage(istd::IInformationProvider::InformationCategory category, int id, int flags, QString &message, QString &messageSource) const override
Decorate message parts before outputting.
bool ProcessAnyList(const iser::CArchiveTag &listTag, const iser::CArchiveTag &subTag, int count, std::function< bool(int, iser::IArchive &)> iterArchiveFn, std::function< bool(int)> resizeFn=nullptr) override
CCompactXmlReadArchiveBase(bool serializeHeader=true, const CArchiveTag &rootTag=s_acfRootTag)
bool IsTagSkippingSupported() const override
Check if skiping to the end of tag on EndTag is supported.
bool ReadStringNode(QString &text)
Common archive implementation of text-based reading archives.
bool ProcessLeaf(const CArchiveTag &tag, bool &value) override
Process primitive type.
Base class for all XML implementations for ICF documents.
Represent input/output persistence archive.
Definition IArchive.h:34
InformationCategory
Category of information.
Contains general persistence mechanism with basic archives implementations.

© Witold Gantzke and Kirill Lepskiy