Antkeeper  0.0.1
Public Member Functions | List of all members
physfs_deserialize_context Class Reference

Deserialize context implementation using PhysicsFS. More...

#include <physfs-deserialize-context.hpp>

Inheritance diagram for physfs_deserialize_context:
deserialize_context

Public Member Functions

 physfs_deserialize_context (const std::filesystem::path &path) noexcept(false)
 Constructs a PhysicsFS deserialize context, opening a file using PhysicsFS and associating it with this deserialize context. More...
 
 physfs_deserialize_context () noexcept=default
 Constructs a PhysicsFS deserialize context. More...
 
virtual ~physfs_deserialize_context ()
 Destructs a PhysicsFS deserialize context, internally closing a file using PhysicsFS. More...
 
void open (const std::filesystem::path &path) noexcept(false)
 Opens a file using PhysicsFS and associates it with the deserialize context. More...
 
void close () noexcept
 Closes the associated file using PhysicsFS. More...
 
bool is_open () const noexcept
 Returns true if the PhysicsFS file associated with this deserialize context is open, false otherwise. More...
 
const std::filesystem::path & path () const noexcept override
 Returns the path associated with this deserialize context. More...
 
bool error () const noexcept override
 Returns true if an error occured during a read operation or initialization, false otherwise. More...
 
bool eof () const noexcept override
 Returns true if the end of a file was reached. More...
 
std::size_t size () const noexcept override
 Returns the size of the file, in bytes. More...
 
std::size_t tell () const override
 Returns the offsets from the start of the file to the current position, in bytes. More...
 
void seek (std::size_t offset) override
 Seeks to a position in the file. More...
 
std::size_t read8 (std::byte *data, std::size_t count) noexcept(false) override
 Reads 8-bit (byte) data. More...
 
std::size_t read16_le (std::byte *data, std::size_t count) noexcept(false) override
 Reads 16-bit (word) little-endian data. More...
 
std::size_t read16_be (std::byte *data, std::size_t count) noexcept(false) override
 Reads 16-bit (word) big-endian data. More...
 
std::size_t read32_le (std::byte *data, std::size_t count) noexcept(false) override
 Reads 32-bit (double word) little-endian data. More...
 
std::size_t read32_be (std::byte *data, std::size_t count) noexcept(false) override
 Reads 32-bit (double word) big-endian data. More...
 
std::size_t read64_le (std::byte *data, std::size_t count) noexcept(false) override
 Reads 64-bit (quad word) little-endian data. More...
 
std::size_t read64_be (std::byte *data, std::size_t count) noexcept(false) override
 Reads 64-bit (quad word) big-endian data. More...
 
- Public Member Functions inherited from deserialize_context
template<std::endian Endian>
std::size_t read16 (std::byte *data, std::size_t count) noexcept(false)
 Reads 16-bit (word) 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...
 
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

Deserialize context implementation using PhysicsFS.

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

Constructor & Destructor Documentation

◆ physfs_deserialize_context() [1/2]

physfs_deserialize_context::physfs_deserialize_context ( const std::filesystem::path &  path)
explicitnoexcept

Constructs a PhysicsFS deserialize context, opening a file using PhysicsFS and associating it with this deserialize context.

Parameters
pathPath to a file to open.
Exceptions
deserialize_errorFile open error.

Definition at line 23 of file physfs-deserialize-context.cpp.

◆ physfs_deserialize_context() [2/2]

physfs_deserialize_context::physfs_deserialize_context ( )
defaultnoexcept

Constructs a PhysicsFS deserialize context.

◆ ~physfs_deserialize_context()

physfs_deserialize_context::~physfs_deserialize_context ( )
virtual

Destructs a PhysicsFS deserialize context, internally closing a file using PhysicsFS.

Definition at line 40 of file physfs-deserialize-context.cpp.

Member Function Documentation

◆ close()

void physfs_deserialize_context::close ( )
noexcept

Closes the associated file using PhysicsFS.

Definition at line 71 of file physfs-deserialize-context.cpp.

◆ eof()

bool physfs_deserialize_context::eof ( ) const
overridevirtualnoexcept

Returns true if the end of a file was reached.

Implements deserialize_context.

Definition at line 97 of file physfs-deserialize-context.cpp.

◆ error()

bool physfs_deserialize_context::error ( ) const
overridevirtualnoexcept

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

Implements deserialize_context.

Definition at line 92 of file physfs-deserialize-context.cpp.

◆ is_open()

bool physfs_deserialize_context::is_open ( ) const
noexcept

Returns true if the PhysicsFS file associated with this deserialize context is open, false otherwise.

Definition at line 82 of file physfs-deserialize-context.cpp.

◆ open()

void physfs_deserialize_context::open ( const std::filesystem::path &  path)
noexcept

Opens a file using PhysicsFS and associates it with the deserialize context.

Parameters
pathPath to a file to open.
Exceptions
deserialize_errorFile open error.

Definition at line 48 of file physfs-deserialize-context.cpp.

◆ path()

const std::filesystem::path & physfs_deserialize_context::path ( ) const
overridevirtualnoexcept

Returns the path associated with this deserialize context.

Implements deserialize_context.

Definition at line 87 of file physfs-deserialize-context.cpp.

◆ read16_be()

std::size_t physfs_deserialize_context::read16_be ( std::byte *  data,
std::size_t  count 
)
overridevirtualnoexcept

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.

Implements deserialize_context.

Definition at line 177 of file physfs-deserialize-context.cpp.

◆ read16_le()

std::size_t physfs_deserialize_context::read16_le ( std::byte *  data,
std::size_t  count 
)
overridevirtualnoexcept

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.

Implements deserialize_context.

Definition at line 158 of file physfs-deserialize-context.cpp.

◆ read32_be()

std::size_t physfs_deserialize_context::read32_be ( std::byte *  data,
std::size_t  count 
)
overridevirtualnoexcept

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.

Implements deserialize_context.

Definition at line 215 of file physfs-deserialize-context.cpp.

◆ read32_le()

std::size_t physfs_deserialize_context::read32_le ( std::byte *  data,
std::size_t  count 
)
overridevirtualnoexcept

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.

Implements deserialize_context.

Definition at line 196 of file physfs-deserialize-context.cpp.

◆ read64_be()

std::size_t physfs_deserialize_context::read64_be ( std::byte *  data,
std::size_t  count 
)
overridevirtualnoexcept

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.

Implements deserialize_context.

Definition at line 253 of file physfs-deserialize-context.cpp.

◆ read64_le()

std::size_t physfs_deserialize_context::read64_le ( std::byte *  data,
std::size_t  count 
)
overridevirtualnoexcept

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.

Implements deserialize_context.

Definition at line 234 of file physfs-deserialize-context.cpp.

◆ read8()

std::size_t physfs_deserialize_context::read8 ( std::byte *  data,
std::size_t  count 
)
overridevirtualnoexcept

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.

Implements deserialize_context.

Definition at line 136 of file physfs-deserialize-context.cpp.

◆ seek()

void physfs_deserialize_context::seek ( std::size_t  offset)
overridevirtual

Seeks to a position in the file.

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

Implements deserialize_context.

Definition at line 125 of file physfs-deserialize-context.cpp.

◆ size()

std::size_t physfs_deserialize_context::size ( ) const
overridevirtualnoexcept

Returns the size of the file, in bytes.

Implements deserialize_context.

Definition at line 102 of file physfs-deserialize-context.cpp.

◆ tell()

std::size_t physfs_deserialize_context::tell ( ) const
overridevirtual

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

Exceptions
deserialize_errorTell error.

Implements deserialize_context.

Definition at line 113 of file physfs-deserialize-context.cpp.


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