ACF $AcfVersion:0$
CMemoryReadArchive.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// ACF includes
7
8
9namespace iser
10{
11
12
13class ISerializable;
14class CMemoryWriteArchive;
15
16
24{
25public:
27
29 const void* bufferPtr,
30 int bufferSize,
31 bool serializeHeader = true);
33 const CMemoryWriteArchive& writeArchive,
34 bool serializeHeader = true);
35
39 virtual void ResetPosition();
40
45 virtual bool IsValid() const;
46
47 // reimplemented (iser::IArchive)
48 virtual bool ProcessData(void* data, int size) override;
49
50 // static methods
54 static bool CloneObjectByArchive(const ISerializable& source, ISerializable& result);
55
56protected:
57 // reimplemented (iser::CArchiveBase)
58 virtual int GetMaxStringLength() const override;
59
63 const quint8* m_bufferPtr;
64
69
74
79
84};
85
86
87} // namespace iser
88
89
Base class for archive implementations reading data based on its binary representation.
Implementation of archive using memory buffer to read the persistent objects.
static bool CloneObjectByArchive(const ISerializable &source, ISerializable &result)
Clone serializable objects using iser::CMemoryWriteArchive and iser::CMemoryReadArchive archives.
virtual bool ProcessData(void *data, int size) override
Process binary data block.
int m_readPosition
Current position in the buffer from which data will be read next.
CMemoryReadArchive(const void *bufferPtr, int bufferSize, bool serializeHeader=true)
bool m_isValid
Indicates whether the archive is in valid state.
virtual int GetMaxStringLength() const override
Get maximal allowed string size.
CBinaryReadArchiveBase BaseClass
CMemoryReadArchive(const CMemoryWriteArchive &writeArchive, bool serializeHeader=true)
int m_bufferSize
Size of the memory buffer used for reading data.
int m_startPosition
Start position of actual data in the buffer (after header, if any)
virtual bool IsValid() const
Returns true if the archive is in valid state and internal position cursor has not reached end of arc...
const quint8 * m_bufferPtr
Pointer to the memory buffer used for reading data.
virtual void ResetPosition()
Seeks internal cursor to the begin of data.
Implementation of archive using memory buffer to store the persistent objects.
Common class for all classes which objects can be archived or restored from archive.
Contains general persistence mechanism with basic archives implementations.