Rebel Fork Framework
Urho3D::ArchiveBaseT< BlockType, IsInputBool, IsHumanReadableBool > Class Template Reference

Archive implementation helper (template). Provides default block-dependent Archive implementation for most cases. More...

#include <Urho3D/IO/ArchiveBase.h>

Inheritance diagram for Urho3D::ArchiveBaseT< BlockType, IsInputBool, IsHumanReadableBool >:
Urho3D::ArchiveBase Urho3D::Archive Urho3D::MovableNonCopyable

Public Member Functions

Archive implementation
bool IsInput () const final
 
bool IsHumanReadable () const final
 
bool IsUnorderedAccessSupportedInCurrentBlock () const final
 
bool HasElementOrBlock (const char *name) const final
 
ea::string GetCurrentBlockPath () const final
 Return current string stack.
 
void EndBlock () noexcept override
 End archive block. May postpone ArchiveException until later.
 
- Public Member Functions inherited from Urho3D::ArchiveBase
ContextGetContext () final
 Get context.
 
ea::string_view GetName () const override
 Return name of the archive if applicable.
 
unsigned GetChecksum () override
 Return a checksum if applicable.
 
bool IsEOF () const final
 Whether the archive can no longer be serialized.
 
void Flush () final
 Flush all pending events. Should be called at least once before destructor.
 
unsigned SerializeVersion (unsigned version) final
 Serialize version number. 0 is invalid version.
 
ArchiveException IOFailureException (ea::string_view elementName) const
 
ArchiveException DuplicateElementException (ea::string_view elementName) const
 
ArchiveException ElementNotFoundException (ea::string_view elementName) const
 
ArchiveException ElementNotFoundException (ea::string_view elementName, unsigned elementIndex) const
 
ArchiveException UnexpectedElementValueException (ea::string_view elementName) const
 
ArchiveException UnexpectedEOFException (ea::string_view elementName) const
 
- Public Member Functions inherited from Urho3D::Archive
virtual void BeginBlock (const char *name, unsigned &sizeHint, bool safe, ArchiveBlockType type)=0
 
ArchiveBlock OpenBlock (const char *name, unsigned sizeHint, bool safe, ArchiveBlockType type)
 
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.
 
ArchiveBlock OpenSequentialBlock (const char *name)
 Open Sequential block. Will be automatically closed when returned object is destroyed. More...
 
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.
 

Protected Types

using Block = BlockType
 

Protected Member Functions

Block & GetCurrentBlock ()
 
const Block & GetCurrentBlock () const
 
void CheckIfRootBlockOpen () const
 
void CheckBeforeBlock (const char *elementName)
 
void CheckBeforeElement (const char *elementName)
 
 ArchiveBase (Context *context)
 
- Protected Member Functions inherited from Urho3D::ArchiveBase
 ArchiveBase (Context *context)
 
void SetDelayedException (std::exception_ptr ptr)
 
void FlushDelayedException ()
 
void CheckIfNotEOF (ea::string_view elementName) const
 
void CheckBlockOrElementName (ea::string_view elementName) const
 
void CloseArchive ()
 
void ReadBytesFromHexString (ea::string_view elementName, const ea::string &string, void *bytes, unsigned size)
 
- Protected Member Functions inherited from Urho3D::MovableNonCopyable
 MovableNonCopyable (MovableNonCopyable &&other)=default
 
MovableNonCopyableoperator= (MovableNonCopyable &&other)=default
 
 MovableNonCopyable (const MovableNonCopyable &other)=delete
 
MovableNonCopyableoperator= (const MovableNonCopyable &other)=delete
 

Protected Attributes

ea::vector< Block > stack_
 

Private Attributes

friend BlockType
 

Additional Inherited Members

- Static Public Member Functions inherited from Urho3D::Archive
static bool ValidateName (ea::string_view name)
 Validate element or block name.
 
- Static Protected Attributes inherited from Urho3D::ArchiveBase
static constexpr const char * rootBlockName = "Root"
 
static constexpr const char * versionElementName = "Version"
 

Detailed Description

template<class BlockType, bool IsInputBool, bool IsHumanReadableBool>
class Urho3D::ArchiveBaseT< BlockType, IsInputBool, IsHumanReadableBool >

Archive implementation helper (template). Provides default block-dependent Archive implementation for most cases.

Member Function Documentation

◆ HasElementOrBlock()

template<class BlockType , bool IsInputBool, bool IsHumanReadableBool>
bool Urho3D::ArchiveBaseT< BlockType, IsInputBool, IsHumanReadableBool >::HasElementOrBlock ( const char *  name) const
inlinefinalvirtual

Return whether the element or block with given name is present. Should be called only if both IsInput and IsUnorderedAccessSupportedInCurrentBlock are true.

Implements Urho3D::Archive.

◆ IsHumanReadable()

template<class BlockType , bool IsInputBool, bool IsHumanReadableBool>
bool Urho3D::ArchiveBaseT< BlockType, IsInputBool, IsHumanReadableBool >::IsHumanReadable ( ) const
inlinefinalvirtual

Whether the human-readability is preferred over performance and output size.

  • Binary serialization is disfavored.
  • String hashes are serialized as strings, if possible.
  • Enumerators serialized as strings, if possible.
  • Simple compound types like Vector3 are serialized as formatted strings instead of blocks.

Implements Urho3D::Archive.

◆ IsInput()

template<class BlockType , bool IsInputBool, bool IsHumanReadableBool>
bool Urho3D::ArchiveBaseT< BlockType, IsInputBool, IsHumanReadableBool >::IsInput ( ) const
inlinefinalvirtual

Whether the archive is in input mode. It is guaranteed that input archive doesn't read from any variable. It is guaranteed that output archive doesn't write to any variable. It is save to cast away const-ness when serializing into output archive.

Implements Urho3D::Archive.

◆ IsUnorderedAccessSupportedInCurrentBlock()

template<class BlockType , bool IsInputBool, bool IsHumanReadableBool>
bool Urho3D::ArchiveBaseT< BlockType, IsInputBool, IsHumanReadableBool >::IsUnorderedAccessSupportedInCurrentBlock ( ) const
inlinefinalvirtual

Return whether the unordered element access is supported in currently open block. Always false if current block is not Unordered. Always false for some archive types.

Implements Urho3D::Archive.


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