ACF $AcfVersion:0$
Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Attributes | List of all members
iser::CArchiveBase Class Reference

Base implementation of iser::IArchive interface. More...

#include <CArchiveBase.h>

Inheritance diagram for iser::CArchiveBase:
iser::IArchive istd::ILogger istd::IPolymorphic istd::IPolymorphic iser::CReadArchiveBase iser::CWriteArchiveBase iser::CBinaryReadArchiveBase iser::CTextReadArchiveBase iser::CBinaryWriteArchiveBase iser::CTextWriteArchiveBase ifile::CFileReadArchive iser::CMemoryReadArchive iqt::CSettingsReadArchive iser::CCompactXmlReadArchiveBase iser::CJsonReadArchiveBase iser::CXmlReadArchiveBase ifile::CFileWriteArchive iser::CMemoryWriteArchive iqt::CSettingsWriteArchive iser::CCompactXmlWriteArchiveBase iser::CJsonWriteArchiveBase iser::CXmlWriteArchiveBase

Public Member Functions

virtual bool IsTagSkippingSupported () const override
 Checks if skipping to the end of a tag on EndTag() is supported.
 
virtual bool BeginMultiTag (const CArchiveTag &tag, const CArchiveTag &subTag, int &count) override
 Begins a tagged section containing multiple elements of the same type.
 
- Public Member Functions inherited from iser::IArchive
virtual bool IsStoring () const =0
 Checks if this archive is in storing (writing) or loading (reading) mode.
 
virtual const IVersionInfoGetVersionInfo () const =0
 Gets version information for the archived stream.
 
virtual bool BeginTag (const CArchiveTag &tag)=0
 Begins a tagged section in the archive.
 
virtual bool EndTag (const CArchiveTag &tag)=0
 Ends a tagged section in the archive.
 
virtual bool Process (bool &value)=0
 Processes (reads or writes) a boolean value.
 
virtual bool Process (char &value)=0
 Process primitive type.
 
virtual bool Process (quint8 &value)=0
 Process primitive type.
 
virtual bool Process (qint8 &value)=0
 Process primitive type.
 
virtual bool Process (quint16 &value)=0
 Process primitive type.
 
virtual bool Process (qint16 &value)=0
 Process primitive type.
 
virtual bool Process (quint32 &value)=0
 Process primitive type.
 
virtual bool Process (qint32 &value)=0
 Process primitive type.
 
virtual bool Process (quint64 &value)=0
 Process primitive type.
 
virtual bool Process (qint64 &value)=0
 Process primitive type.
 
virtual bool Process (float &value)=0
 Process primitive type.
 
virtual bool Process (double &value)=0
 Process primitive type.
 
virtual bool Process (QByteArray &value)=0
 Process primitive type.
 
virtual bool Process (QString &value)=0
 Process primitive type.
 
template<typename Primitive >
bool TagAndProcess (const CArchiveTag &tag, Primitive &value)
 
virtual bool ProcessData (void *dataPtr, int size)=0
 Process binary data block.
 
virtual bool ProcessBits (void *dataPtr, int bitsCount, int bytesCount)=0
 Process binary data block.
 
- Public Member Functions inherited from istd::IPolymorphic
virtual ~IPolymorphic ()
 

Static Public Member Functions

static const CArchiveTagGetAcfRootTag ()
 

Protected Member Functions

 CArchiveBase ()
 
- Protected Member Functions inherited from istd::ILogger
virtual void DecorateMessage (IInformationProvider::InformationCategory category, int id, int flags, QString &message, QString &messageSource) const
 Decorate message parts before outputting.
 
virtual bool IsLogConsumed (const IInformationProvider::InformationCategory *categoryPtr=NULL, const int *flagsPtr=NULL) const
 Check if any log message is consumed.
 
virtual bool SendLogMessage (IInformationProvider::InformationCategory category, int id, const QString &message, const QString &messageSource, int flags=0) const
 Send any message to log.
 

Static Protected Attributes

static CArchiveTag s_acfRootTag
 

Additional Inherited Members

- Public Types inherited from iser::IArchive
enum  MessageId { MI_TAG_ERROR = 0x3f320a0 , MI_TAG_SKIPPED }
 

Detailed Description

Base implementation of iser::IArchive interface.

It provides standard implementation of some methods and standard tags.

Definition at line 20 of file CArchiveBase.h.

Constructor & Destructor Documentation

◆ CArchiveBase()

iser::CArchiveBase::CArchiveBase ( )
inlineprotected

Definition at line 32 of file CArchiveBase.h.

Member Function Documentation

◆ BeginMultiTag()

virtual bool iser::CArchiveBase::BeginMultiTag ( const CArchiveTag tag,
const CArchiveTag subTag,
int &  count 
)
overridevirtual

Begins a tagged section containing multiple elements of the same type.

BeginMultiTag is used for serializing collections, arrays, or lists where you have multiple items of the same structure. The count parameter works differently for reading vs. writing:

  • Writing: Pass the number of elements you will serialize
  • Reading: The archive sets count to the number of elements stored
Parameters
tagMain container tag for the entire collection
subTagTag type for each individual element in the collection
count[in/out] For writing: number of elements to serialize For reading: set by archive to number of stored elements
Returns
true if successful, false on error
// Writing a list
if (archive.IsStoring()) {
int count = m_items.count();
archive.BeginMultiTag(listTag, itemTag, count);
for (const Item& item : m_items) {
archive.BeginTag(itemTag);
item.Serialize(archive);
archive.EndTag(itemTag);
}
archive.EndTag(listTag);
}
// Reading a list
else {
int count;
archive.BeginMultiTag(listTag, itemTag, count);
m_items.clear();
for (int i = 0; i < count; ++i) {
archive.BeginTag(itemTag);
Item item;
item.Serialize(archive);
m_items.append(item);
archive.EndTag(itemTag);
}
archive.EndTag(listTag);
}
See also
BeginTag(), EndTag()

Implements iser::IArchive.

Reimplemented in iser::CXmlReadArchiveBase, iser::CXmlWriteArchiveBase, iqt::CSettingsReadArchive, iqt::CSettingsWriteArchive, iser::CCompactXmlReadArchiveBase, iser::CCompactXmlWriteArchiveBase, iser::CJsonReadArchiveBase, and iser::CJsonWriteArchiveBase.

◆ GetAcfRootTag()

static const CArchiveTag & iser::CArchiveBase::GetAcfRootTag ( )
static

◆ IsTagSkippingSupported()

virtual bool iser::CArchiveBase::IsTagSkippingSupported ( ) const
overridevirtual

Checks if skipping to the end of a tag on EndTag() is supported.

Some archive types (like XML) support skipping unread content within a tag, allowing forward compatibility. When reading an archive created by a newer version that added fields, this feature lets you skip unknown data.

Returns
true if the archive supports tag skipping, false otherwise
Note
Binary archives typically don't support skipping, requiring all data to be read sequentially.
XML and JSON archives usually support skipping.
if (archive.IsTagSkippingSupported()) {
// Can safely skip new fields added in future versions
} else {
// Must read all data in exact order
}
See also
EndTag()

Implements iser::IArchive.

Reimplemented in ifile::CFileReadArchive, ifile::CFileWriteArchive, iser::CCompactXmlReadArchiveBase, iser::CCompactXmlWriteArchiveBase, iser::CJsonWriteArchiveBase, iser::CXmlReadArchiveBase, and iser::CXmlWriteArchiveBase.

Member Data Documentation

◆ s_acfRootTag

CArchiveTag iser::CArchiveBase::s_acfRootTag
staticprotected

Definition at line 35 of file CArchiveBase.h.


The documentation for this class was generated from the following file: