ACF $AcfVersion:0$
IArchive.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/QByteArray>
7
8// Qt includes
9#include <QtCore/QString>
10
11
12// ACF includes
13#include <istd/IPolymorphic.h>
14
15
16namespace iser
17{
18
19
20class IVersionInfo;
21class CArchiveTag;
22
23
163class IArchive: virtual public istd::IPolymorphic
164{
165public:
167 {
168 MI_TAG_ERROR = 0x3f320a0,
170 };
171
205 virtual bool IsStoring() const = 0;
206
230 virtual bool IsTagSkippingSupported() const = 0;
231
251 virtual const IVersionInfo& GetVersionInfo() const = 0;
252
280 virtual bool BeginTag(const CArchiveTag& tag) = 0;
281
328 virtual bool BeginMultiTag(const CArchiveTag& tag, const CArchiveTag& subTag, int& count) = 0;
329
357 virtual bool EndTag(const CArchiveTag& tag) = 0;
358
369 virtual bool Process(bool& value) = 0;
370
374 virtual bool Process(char& value) = 0;
375
379 virtual bool Process(quint8& value) = 0;
380
384 virtual bool Process(qint8& value) = 0;
385
389 virtual bool Process(quint16& value) = 0;
390
394 virtual bool Process(qint16& value) = 0;
395
399 virtual bool Process(quint32& value) = 0;
400
404 virtual bool Process(qint32& value) = 0;
405
409 virtual bool Process(quint64& value) = 0;
410
414 virtual bool Process(qint64& value) = 0;
415
419 virtual bool Process(float& value) = 0;
420
424 virtual bool Process(double& value) = 0;
425
429 virtual bool Process(QByteArray& value) = 0;
430
434 virtual bool Process(QString& value) = 0;
435
436 template<typename Primitive>
437 bool TagAndProcess(const CArchiveTag& tag, Primitive& value){
438 static_assert(!std::is_const_v<Primitive>, "Input value is const-qualified");
439
440 return BeginTag(tag) && Process(value) && EndTag(tag);
441 }
442
448 virtual bool ProcessData(void* dataPtr, int size) = 0;
449
456 virtual bool ProcessBits(void* dataPtr, int bitsCount, int bytesCount) = 0;
457};
458
459
460} // namespace iser
461
462
463
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 IsTagSkippingSupported() const =0
Checks if skipping to the end of a tag on EndTag() is supported.
virtual const IVersionInfo & GetVersionInfo() const =0
Gets version information for the archived stream.
virtual bool Process(bool &value)=0
Processes (reads or writes) a boolean value.
virtual bool Process(qint64 &value)=0
Process primitive type.
virtual bool EndTag(const CArchiveTag &tag)=0
Ends a tagged section in the archive.
virtual bool Process(float &value)=0
Process primitive type.
virtual bool Process(char &value)=0
Process primitive type.
virtual bool Process(quint16 &value)=0
Process primitive type.
virtual bool Process(double &value)=0
Process primitive type.
bool TagAndProcess(const CArchiveTag &tag, Primitive &value)
Definition IArchive.h:437
virtual bool Process(quint8 &value)=0
Process primitive type.
virtual bool Process(qint8 &value)=0
Process primitive type.
virtual bool Process(quint64 &value)=0
Process primitive type.
virtual bool Process(quint32 &value)=0
Process primitive type.
virtual bool Process(QByteArray &value)=0
Process primitive type.
virtual bool BeginMultiTag(const CArchiveTag &tag, const CArchiveTag &subTag, int &count)=0
Begins a tagged section containing multiple elements of the same type.
virtual bool Process(qint16 &value)=0
Process primitive type.
virtual bool ProcessData(void *dataPtr, int size)=0
Process binary data block.
virtual bool IsStoring() const =0
Checks if this archive is in storing (writing) or loading (reading) mode.
virtual bool Process(QString &value)=0
Process primitive type.
virtual bool ProcessBits(void *dataPtr, int bitsCount, int bytesCount)=0
Process binary data block.
virtual bool Process(qint32 &value)=0
Process primitive type.
virtual bool BeginTag(const CArchiveTag &tag)=0
Begins a tagged section in the archive.
Provides access to version information.
Base interface for all used interfaces and implementations.
Contains general persistence mechanism with basic archives implementations.