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

Provides access to a serialization state. More...

#include <physfs-serialize-context.hpp>

Inheritance diagram for physfs_serialize_context:
serialize_context

Public Member Functions

 physfs_serialize_context (const std::filesystem::path &path) noexcept(false)
 Constructs a PhysicsFS serialize context, opening a file using PhysicsFS and associating it with this serialize context. More...
 
 physfs_serialize_context () noexcept=default
 Constructs a PhysicsFS serialize context. More...
 
virtual ~physfs_serialize_context ()
 Destructs a PhysicsFS serialize 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 serialize 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 serialize context is open, false otherwise. More...
 
const std::filesystem::path & path () const noexcept override
 Returns the path associated with this serialize context. More...
 
bool error () const noexcept override
 Returns true if an error occured during a write operation or initialization, false otherwise. More...
 
std::size_t write8 (const std::byte *data, std::size_t count) noexcept(false) override
 Writes 8-bit (byte) data. More...
 
std::size_t write16_le (const std::byte *data, std::size_t count) noexcept(false) override
 Writes 16-bit (word) little-endian data. More...
 
std::size_t write16_be (const std::byte *data, std::size_t count) noexcept(false) override
 Writes 16-bit (word) big-endian data. More...
 
std::size_t write32_le (const std::byte *data, std::size_t count) noexcept(false) override
 Writes 32-bit (double word) little-endian data. More...
 
std::size_t write32_be (const std::byte *data, std::size_t count) noexcept(false) override
 Writes 32-bit (double word) big-endian data. More...
 
std::size_t write64_le (const std::byte *data, std::size_t count) noexcept(false) override
 Writes 64-bit (quad word) little-endian data. More...
 
std::size_t write64_be (const std::byte *data, std::size_t count) noexcept(false) override
 Writes 64-bit (quad word) big-endian data. More...
 
- Public Member Functions inherited from serialize_context
template<std::endian Endian>
std::size_t write16 (const std::byte *data, std::size_t count) noexcept(false)
 Writes 16-bit (word) data. More...
 
template<std::endian Endian>
std::size_t write32 (const std::byte *data, std::size_t count) noexcept(false)
 Writes 32-bit (double word) data. More...
 
template<std::endian Endian>
std::size_t write64 (const std::byte *data, std::size_t count) noexcept(false)
 Writes 64-bit (quad word) data. More...
 

Detailed Description

Provides access to a serialization state.

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

Constructor & Destructor Documentation

◆ physfs_serialize_context() [1/2]

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

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

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

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

◆ physfs_serialize_context() [2/2]

physfs_serialize_context::physfs_serialize_context ( )
defaultnoexcept

Constructs a PhysicsFS serialize context.

◆ ~physfs_serialize_context()

physfs_serialize_context::~physfs_serialize_context ( )
virtual

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

Definition at line 39 of file physfs-serialize-context.cpp.

Member Function Documentation

◆ close()

void physfs_serialize_context::close ( )
noexcept

Closes the associated file using PhysicsFS.

Definition at line 69 of file physfs-serialize-context.cpp.

◆ error()

bool physfs_serialize_context::error ( ) const
overridevirtualnoexcept

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

Implements serialize_context.

Definition at line 89 of file physfs-serialize-context.cpp.

◆ is_open()

bool physfs_serialize_context::is_open ( ) const
noexcept

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

Definition at line 79 of file physfs-serialize-context.cpp.

◆ open()

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

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

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

Definition at line 47 of file physfs-serialize-context.cpp.

◆ path()

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

Returns the path associated with this serialize context.

Implements serialize_context.

Definition at line 84 of file physfs-serialize-context.cpp.

◆ write16_be()

std::size_t physfs_serialize_context::write16_be ( const std::byte *  data,
std::size_t  count 
)
overridevirtualnoexcept

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

Parameters
dataPointer to data source.
countNumber of words to write.
Returns
Number of words written.
Exceptions
serialize_errorWrite error.

Implements serialize_context.

Definition at line 134 of file physfs-serialize-context.cpp.

◆ write16_le()

std::size_t physfs_serialize_context::write16_le ( const std::byte *  data,
std::size_t  count 
)
overridevirtualnoexcept

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

Parameters
dataPointer to data source.
countNumber of words to write.
Returns
Number of words written.
Exceptions
serialize_errorWrite error.

Implements serialize_context.

Definition at line 115 of file physfs-serialize-context.cpp.

◆ write32_be()

std::size_t physfs_serialize_context::write32_be ( const std::byte *  data,
std::size_t  count 
)
overridevirtualnoexcept

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

Parameters
dataPointer to data source.
countNumber of double words to write.
Returns
Number of double words written.
Exceptions
serialize_errorWrite error.

Implements serialize_context.

Definition at line 172 of file physfs-serialize-context.cpp.

◆ write32_le()

std::size_t physfs_serialize_context::write32_le ( const std::byte *  data,
std::size_t  count 
)
overridevirtualnoexcept

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

Parameters
dataPointer to data source.
countNumber of double words to write.
Returns
Number of double words written.
Exceptions
serialize_errorWrite error.

Implements serialize_context.

Definition at line 153 of file physfs-serialize-context.cpp.

◆ write64_be()

std::size_t physfs_serialize_context::write64_be ( const std::byte *  data,
std::size_t  count 
)
overridevirtualnoexcept

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

Parameters
dataPointer to data source.
countNumber of quad words to write.
Returns
Number of quad words written.
Exceptions
serialize_errorWrite error.

Implements serialize_context.

Definition at line 210 of file physfs-serialize-context.cpp.

◆ write64_le()

std::size_t physfs_serialize_context::write64_le ( const std::byte *  data,
std::size_t  count 
)
overridevirtualnoexcept

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

Parameters
dataPointer to data source.
countNumber of quad words to write.
Returns
Number of quad words written.
Exceptions
serialize_errorWrite error.

Implements serialize_context.

Definition at line 191 of file physfs-serialize-context.cpp.

◆ write8()

std::size_t physfs_serialize_context::write8 ( const std::byte *  data,
std::size_t  count 
)
overridevirtualnoexcept

Writes 8-bit (byte) data.

Parameters
dataPointer to data source.
countNumber of bytes to write.
Returns
Number of bytes written.
Exceptions
serialize_errorWrite error.

Implements serialize_context.

Definition at line 94 of file physfs-serialize-context.cpp.


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