ICF 3.1.1.10
Technical documentation of ICF Libraries
CJsonStringReadArchive.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 <QtCore/QJsonDocument>
11#include <QtCore/QJsonObject>
12#include <QtCore/QJsonArray>
13#include <QtCore/QVector>
14
15// ICF includes
17
18
19namespace iser
20{
21
22
31{
32public:
34
35 CJsonStringReadArchive(const QByteArray& inputString);
36
37 // reimplemented (iser::IArchive)
38 virtual bool BeginTag(const iser::CArchiveTag& tag);
39 virtual bool BeginMultiTag(const iser::CArchiveTag& tag, const iser::CArchiveTag& subTag, int& count);
40 virtual bool EndTag(const iser::CArchiveTag& tag);
41 virtual bool Process(QString& value);
42
43protected:
44 bool ReadStringNode(QString& text);
45
46 // reimplemented (iser::CTextReadArchiveBase)
47 virtual bool ReadTextNode(QByteArray& text);
48
49private:
50 QJsonDocument m_document;
51
52 QVector<QJsonObject::const_iterator> m_objectsStack;
53
54 bool m_allowAttribute; // indicate if attribute outputting is allowed now
55
56 QByteArray m_currentAttribute;
57
58 typedef QList<const iser::CArchiveTag*> TagsList;
59 TagsList m_tagsStack;
60};
61
62
63} // namespace iser
64
65
Process tag used to group data in archive stream.
Definition CArchiveTag.h:25
Implementation of an ICF archive deserializing from a JSON string.
virtual bool EndTag(const iser::CArchiveTag &tag)
End of archive tag.
bool ReadStringNode(QString &text)
virtual bool Process(QString &value)
virtual bool BeginTag(const iser::CArchiveTag &tag)
Begin of archive tag.
CJsonStringReadArchive(const QByteArray &inputString)
virtual bool ReadTextNode(QByteArray &text)
Read single unformatted text node.
virtual bool BeginMultiTag(const iser::CArchiveTag &tag, const iser::CArchiveTag &subTag, int &count)
Common archive implementation of text-based reading archives.
Contains general persistence mechanism with basic archives implementations.

© Witold Gantzke and Kirill Lepskiy