ACF $AcfVersion:0$
CJsonMemoryWriteArchiveTest.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 <QtCore/QObject>
7#include <QtTest/QtTest>
8
9// ACF includes
14#include <iser/IArchive.h>
15#include <iser/CArchiveTag.h>
16
17
18class Model: virtual public iser::ISerializable
19{
20public:
21 bool Serialize(iser::IArchive& archive) override
22 {
23 static iser::CArchiveTag typeTag("Type", "Type of the meta information");
24 bool retVal = archive.BeginTag(typeTag);
25 retVal = retVal && archive.Process(value);
26 retVal = retVal && archive.EndTag(typeTag);
27
28 return retVal;
29 }
30
31 int value = 0;
32};
33
34class CJsonMemoryWriteArchiveTest : public QObject
35{
36 Q_OBJECT
37private slots:
38 void initTestCase();
39
40 void WriteTest();
41 void ReadTest();
42 void ParamsSetSerializeTest();
43 void ObjectContainerSerializeTest();
44 void EscapingTest();
45 void InvalidReadStateTest();
46 void DoTest();
47
48private:
50 QByteArray m_buffer = "";
51 const QByteArray m_id = "12345678";
52};
bool Serialize(iser::IArchive &archive) override
Load or store state of this object as a archive stream.
Implementation of the basic document's meta information.
Process tag used to group data in archive stream.
Definition CArchiveTag.h:22
Represents an input/output persistence archive for object serialization.
Definition IArchive.h:164
virtual bool Process(bool &value)=0
Processes (reads or writes) a boolean value.
virtual bool EndTag(const CArchiveTag &tag)=0
Ends a tagged section in the archive.
virtual bool BeginTag(const CArchiveTag &tag)=0
Begins a tagged section in the archive.
Common class for all classes which objects can be archived or restored from archive.