Rebel Fork Framework
Urho3D::Archive Class Referenceabstract

#include <Urho3D/IO/Archive.h>

Inheritance diagram for Urho3D::Archive:
Urho3D::ArchiveBase Urho3D::ArchiveBaseT< BlockType, IsInputBool, false > Urho3D::ArchiveBaseT< BinaryInputArchiveBlock, IsInputBool, false > Urho3D::ArchiveBaseT< BinaryOutputArchiveBlock, IsInputBool, false > Urho3D::ArchiveBaseT< BlockType, IsInputBool, true > Urho3D::ArchiveBaseT< JSONInputArchiveBlock, IsInputBool, true > Urho3D::ArchiveBaseT< JSONOutputArchiveBlock, IsInputBool, true > Urho3D::ArchiveBaseT< XMLInputArchiveBlock, IsInputBool, true > Urho3D::ArchiveBaseT< XMLOutputArchiveBlock, IsInputBool, true > Urho3D::ArchiveBaseT< BlockType, IsInputBool, IsHumanReadableBool >

Public Member Functions

virtual ContextGetContext ()=0
 Get context.
 
virtual ea::string_view GetName () const =0
 Return name of the archive if applicable.
 
virtual unsigned GetChecksum ()=0
 Return a checksum if applicable.
 
virtual bool IsInput () const =0
 
virtual bool IsHumanReadable () const =0
 
virtual bool IsUnorderedAccessSupportedInCurrentBlock () const =0
 
virtual bool HasElementOrBlock (const char *name) const =0
 
virtual bool IsEOF () const =0
 Whether the archive can no longer be serialized.
 
virtual ea::string GetCurrentBlockPath () const =0
 Return current string stack.
 
virtual void BeginBlock (const char *name, unsigned &sizeHint, bool safe, ArchiveBlockType type)=0
 
virtual void EndBlock () noexcept=0
 End archive block. May postpone ArchiveException until later.
 
virtual void Flush ()=0
 Flush all pending events. Should be called at least once before destructor.
 
ArchiveBlock OpenBlock (const char *name, unsigned sizeHint, bool safe, ArchiveBlockType type)
 
Serialize primitive element
virtual void Serialize (const char *name, bool &value)=0
 
virtual void Serialize (const char *name, signed char &value)=0
 
virtual void Serialize (const char *name, unsigned char &value)=0
 
virtual void Serialize (const char *name, short &value)=0
 
virtual void Serialize (const char *name, unsigned short &value)=0
 
virtual void Serialize (const char *name, int &value)=0
 
virtual void Serialize (const char *name, unsigned int &value)=0
 
virtual void Serialize (const char *name, long long &value)=0
 
virtual void Serialize (const char *name, unsigned long long &value)=0
 
virtual void Serialize (const char *name, float &value)=0
 
virtual void Serialize (const char *name, double &value)=0
 
virtual void Serialize (const char *name, ea::string &value)=0
 
virtual void SerializeBytes (const char *name, void *bytes, unsigned size)=0
 Serialize bytes. Size is not encoded and should be provided externally!
 
virtual void SerializeVLE (const char *name, unsigned &value)=0
 Serialize Variable Length Encoded unsigned integer, up to 29 significant bits.
 
virtual unsigned SerializeVersion (unsigned version)=0
 Serialize version number. 0 is invalid version.
 
ArchiveBlock OpenSequentialBlock (const char *name)
 Open Sequential block. Will be automatically closed when returned object is destroyed.
 
ArchiveBlock OpenUnorderedBlock (const char *name)
 Open Unordered block. Will be automatically closed when returned object is destroyed.
 
ArchiveBlock OpenArrayBlock (const char *name, unsigned sizeHint=0)
 Open Array block. Will be automatically closed when returned object is destroyed.
 
ArchiveBlock OpenSafeSequentialBlock (const char *name)
 Open safe Sequential block. Will be automatically closed when returned object is destroyed.
 
ArchiveBlock OpenSafeUnorderedBlock (const char *name)
 Open safe Unordered block. Will be automatically closed when returned object is destroyed.
 

Static Public Member Functions

static bool ValidateName (ea::string_view name)
 Validate element or block name.
 

Detailed Description

Archive interface.

  • Archive is a hierarchical structure of blocks and elements.
  • Archive must have exactly one root block.
  • Any block may contain other blocks or elements of any type.
  • Any block or element may have name. Use C++ naming conventions for identifiers, arbitrary strings are not allowed. Name "key" is reserved.
  • Unsafe block must not be closed until all the items are serialized.

Member Function Documentation

◆ BeginBlock()

virtual void Urho3D::Archive::BeginBlock ( const char *  name,
unsigned &  sizeHint,
bool  safe,
ArchiveBlockType  type 
)
pure virtual

Begin archive block. Size is required for Array blocks. It is guaranteed that errors occurred during serialization of the safe block don't affect data outside of the block.

Implemented in Urho3D::BinaryOutputArchive, Urho3D::BinaryInputArchive, Urho3D::JSONOutputArchive, Urho3D::JSONInputArchive, Urho3D::XMLOutputArchive, and Urho3D::XMLInputArchive.

◆ EndBlock()

◆ Flush()

virtual void Urho3D::Archive::Flush ( )
pure virtual

Flush all pending events. Should be called at least once before destructor.

Implemented in Urho3D::ArchiveBase.

◆ GetChecksum()

virtual unsigned Urho3D::Archive::GetChecksum ( )
pure virtual

Return a checksum if applicable.

Implemented in Urho3D::BinaryOutputArchive, Urho3D::BinaryInputArchive, and Urho3D::ArchiveBase.

◆ GetContext()

virtual Context * Urho3D::Archive::GetContext ( )
pure virtual

Get context.

Implemented in Urho3D::ArchiveBase.

◆ GetCurrentBlockPath()

◆ GetName()

◆ HasElementOrBlock()

◆ IsEOF()

virtual bool Urho3D::Archive::IsEOF ( ) const
pure virtual

Whether the archive can no longer be serialized.

Implemented in Urho3D::ArchiveBase.

◆ IsHumanReadable()

virtual bool Urho3D::Archive::IsHumanReadable ( ) const
pure virtual

◆ IsInput()

◆ IsUnorderedAccessSupportedInCurrentBlock()

◆ OpenBlock()

ArchiveBlock Urho3D::Archive::OpenBlock ( const char *  name,
unsigned  sizeHint,
bool  safe,
ArchiveBlockType  type 
)
inline

Do BeginBlock and return the guard that will call EndBlock automatically on destruction. Return null block in case of error.

◆ OpenSequentialBlock()

ArchiveBlock Urho3D::Archive::OpenSequentialBlock ( const char *  name)
inline

Open Sequential block. Will be automatically closed when returned object is destroyed.

Open block helpers

◆ SerializeBytes()

virtual void Urho3D::Archive::SerializeBytes ( const char *  name,
void *  bytes,
unsigned  size 
)
pure virtual

Serialize bytes. Size is not encoded and should be provided externally!

Implemented in Urho3D::BinaryOutputArchive, Urho3D::BinaryInputArchive, Urho3D::JSONOutputArchive, Urho3D::JSONInputArchive, Urho3D::XMLOutputArchive, and Urho3D::XMLInputArchive.

◆ SerializeVersion()

virtual unsigned Urho3D::Archive::SerializeVersion ( unsigned  version)
pure virtual

Serialize version number. 0 is invalid version.

Implemented in Urho3D::ArchiveBase.

◆ SerializeVLE()

virtual void Urho3D::Archive::SerializeVLE ( const char *  name,
unsigned &  value 
)
pure virtual

Serialize Variable Length Encoded unsigned integer, up to 29 significant bits.

Implemented in Urho3D::BinaryOutputArchive, Urho3D::BinaryInputArchive, Urho3D::JSONOutputArchive, Urho3D::JSONInputArchive, Urho3D::XMLOutputArchive, and Urho3D::XMLInputArchive.


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