Antkeeper  0.0.1
Public Member Functions | List of all members
deserialize_context Struct Referenceabstract

Provides access to a deserialization state. More...

#include <deserialize-context.hpp>

Inheritance diagram for deserialize_context:
physfs_deserialize_context

Public Member Functions

virtual const std::filesystem::path & path () const noexcept=0
 Returns the path associated with this deserialize context. More...
 
virtual bool error () const noexcept=0
 Returns true if an error occured during a read operation or initialization, false otherwise. More...
 
virtual bool eof () const noexcept=0
 Returns true if the end of a file was reached. More...
 
virtual std::size_t size () const noexcept=0
 Returns the size of the file, in bytes. More...
 
virtual std::size_t tell () const =0
 Returns the offsets from the start of the file to the current position, in bytes. More...
 
virtual void seek (std::size_t offset)=0
 Seeks to a position in the file. More...
 
virtual std::size_t read8 (std::byte *data, std::size_t count) noexcept(false)=0
 Reads 8-bit (byte) data. More...
 
virtual std::size_t read16_le (std::byte *data, std::size_t count) noexcept(false)=0
 Reads 16-bit (word) little-endian data. More...
 
virtual std::size_t read16_be (std::byte *data, std::size_t count) noexcept(false)=0
 Reads 16-bit (word) big-endian data. More...
 
template<std::endian Endian>
std::size_t read16 (std::byte *data, std::size_t count) noexcept(false)
 Reads 16-bit (word) data. More...
 
virtual std::size_t read32_le (std::byte *data, std::size_t count) noexcept(false)=0
 Reads 32-bit (double word) little-endian data. More...
 
virtual std::size_t read32_be (std::byte *data, std::size_t count) noexcept(false)=0
 Reads 32-bit (double word) big-endian data. More...
 
template<std::endian Endian>
std::size_t read32 (std::byte *data, std::size_t count) noexcept(false)
 Reads 32-bit (double word) data. More...
 
virtual std::size_t read64_le (std::byte *data, std::size_t count) noexcept(false)=0
 Reads 64-bit (quad word) little-endian data. More...
 
virtual std::size_t read64_be (std::byte *data, std::size_t count) noexcept(false)=0
 Reads 64-bit (quad word) big-endian data. More...
 
template<std::endian Endian>
std::size_t read64 (std::byte *data, std::size_t count) noexcept(false)
 Reads 64-bit (quad word) data. More...
 

Detailed Description

Provides access to a deserialization state.

Definition at line 30 of file deserialize-context.hpp.

Member Function Documentation

◆ eof()

virtual bool deserialize_context::eof ( ) const
pure virtualnoexcept

Returns true if the end of a file was reached.

Implemented in physfs_deserialize_context.

◆ error()

virtual bool deserialize_context::error ( ) const
pure virtualnoexcept

Returns true if an error occured during a read operation or initialization, false otherwise.

Implemented in physfs_deserialize_context.

◆ path()

virtual const std::filesystem::path& deserialize_context::path ( ) const
pure virtualnoexcept

Returns the path associated with this deserialize context.

Implemented in physfs_deserialize_context.

◆ read16()

template<std::endian Endian>
std::size_t deserialize_context::read16 ( std::byte *  data,
std::size_t  count 
)
inlinenoexcept

Reads 16-bit (word) data.

Template Parameters
EndianEndianness of the read operation.
Parameters
[out]dataPointer to data destination.
[in]countNumber of words to read.
Returns
Number of words read.
Exceptions
deserialize_errorRead error.

Definition at line 118 of file deserialize-context.hpp.

◆ read16_be()

virtual std::size_t deserialize_context::read16_be ( std::byte *  data,
std::size_t  count 
)
pure virtualnoexcept

Reads 16-bit (word) big-endian data.

Parameters
[out]dataPointer to data destination.
[in]countNumber of words to read.
Returns
Number of words read.
Exceptions
deserialize_errorRead error.

Implemented in physfs_deserialize_context.

◆ read16_le()

virtual std::size_t deserialize_context::read16_le ( std::byte *  data,
std::size_t  count 
)
pure virtualnoexcept

Reads 16-bit (word) little-endian data.

Parameters
[out]dataPointer to data destination.
[in]countNumber of words to read.
Returns
Number of words read.
Exceptions
deserialize_errorRead error.

Implemented in physfs_deserialize_context.

◆ read32()

template<std::endian Endian>
std::size_t deserialize_context::read32 ( std::byte *  data,
std::size_t  count 
)
inlinenoexcept

Reads 32-bit (double word) data.

Template Parameters
EndianEndianness of the read operation.
Parameters
[out]dataPointer to data destination.
[in]countNumber of double words to read.
Returns
Number of double words read.
Exceptions
deserialize_errorRead error.

Definition at line 167 of file deserialize-context.hpp.

◆ read32_be()

virtual std::size_t deserialize_context::read32_be ( std::byte *  data,
std::size_t  count 
)
pure virtualnoexcept

Reads 32-bit (double word) big-endian data.

Parameters
[out]dataPointer to data destination.
[in]countNumber of double words to read.
Returns
Number of double words read.
Exceptions
deserialize_errorRead error.

Implemented in physfs_deserialize_context.

◆ read32_le()

virtual std::size_t deserialize_context::read32_le ( std::byte *  data,
std::size_t  count 
)
pure virtualnoexcept

Reads 32-bit (double word) little-endian data.

Parameters
[out]dataPointer to data destination.
[in]countNumber of double words to read.
Returns
Number of double words read.
Exceptions
deserialize_errorRead error.

Implemented in physfs_deserialize_context.

◆ read64()

template<std::endian Endian>
std::size_t deserialize_context::read64 ( std::byte *  data,
std::size_t  count 
)
inlinenoexcept

Reads 64-bit (quad word) data.

Template Parameters
EndianEndianness of the read operation.
Parameters
[out]dataPointer to data destination.
[in]countNumber of quad words to read.
Returns
Number of quad words read.
Exceptions
deserialize_errorRead error.

Definition at line 216 of file deserialize-context.hpp.

◆ read64_be()

virtual std::size_t deserialize_context::read64_be ( std::byte *  data,
std::size_t  count 
)
pure virtualnoexcept

Reads 64-bit (quad word) big-endian data.

Parameters
[out]dataPointer to data destination.
[in]countNumber of quad words to read.
Returns
Number of quad words read.
Exceptions
deserialize_errorRead error.

Implemented in physfs_deserialize_context.

◆ read64_le()

virtual std::size_t deserialize_context::read64_le ( std::byte *  data,
std::size_t  count 
)
pure virtualnoexcept

Reads 64-bit (quad word) little-endian data.

Parameters
[out]dataPointer to data destination.
[in]countNumber of quad words to read.
Returns
Number of quad words read.
Exceptions
deserialize_errorRead error.

Implemented in physfs_deserialize_context.

◆ read8()

virtual std::size_t deserialize_context::read8 ( std::byte *  data,
std::size_t  count 
)
pure virtualnoexcept

Reads 8-bit (byte) data.

Parameters
[out]dataPointer to data destination.
[in]countNumber of bytes to read.
Returns
Number of bytes read.
Exceptions
deserialize_errorRead error.

Implemented in physfs_deserialize_context.

◆ seek()

virtual void deserialize_context::seek ( std::size_t  offset)
pure virtual

Seeks to a position in the file.

Parameters
offsetOffset from the start of the file, in bytes.
Exceptions
deserialize_errorSeek error.

Implemented in physfs_deserialize_context.

◆ size()

virtual std::size_t deserialize_context::size ( ) const
pure virtualnoexcept

Returns the size of the file, in bytes.

Implemented in physfs_deserialize_context.

◆ tell()

virtual std::size_t deserialize_context::tell ( ) const
pure virtual

Returns the offsets from the start of the file to the current position, in bytes.

Exceptions
deserialize_errorTell error.

Implemented in physfs_deserialize_context.


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