20 #ifndef ANTKEEPER_RESOURCES_PHYSFS_SERIALIZE_CONTEXT_HPP
21 #define ANTKEEPER_RESOURCES_PHYSFS_SERIALIZE_CONTEXT_HPP
59 void open(const std::filesystem::
path&
path) noexcept(false);
64 void close() noexcept;
69 [[nodiscard]]
bool is_open() const noexcept;
71 [[nodiscard]] const std::filesystem::
path&
path() const noexcept override;
72 [[nodiscard]]
bool error() const noexcept override;
73 std::
size_t write8(const std::
byte* data, std::
size_t count) noexcept(false) override;
74 std::
size_t write16_le(const std::
byte* data, std::
size_t count) noexcept(false) override;
75 std::
size_t write16_be(const std::
byte* data, std::
size_t count) noexcept(false) override;
76 std::
size_t write32_le(const std::
byte* data, std::
size_t count) noexcept(false) override;
77 std::
size_t write32_be(const std::
byte* data, std::
size_t count) noexcept(false) override;
78 std::
size_t write64_le(const std::
byte* data, std::
size_t count) noexcept(false) override;
79 std::
size_t write64_be(const std::
byte* data, std::
size_t count) noexcept(false) override;
82 PHYSFS_File* file{
nullptr};
83 std::filesystem::path m_path;
Provides access to a serialization state.
physfs_serialize_context() noexcept=default
Constructs a PhysicsFS serialize context.
std::size_t write8(const std::byte *data, std::size_t count) noexcept(false) override
Writes 8-bit (byte) data.
std::size_t write16_be(const std::byte *data, std::size_t count) noexcept(false) override
Writes 16-bit (word) big-endian data.
std::size_t write32_le(const std::byte *data, std::size_t count) noexcept(false) override
Writes 32-bit (double word) little-endian data.
void close() noexcept
Closes the associated file using PhysicsFS.
std::size_t write64_be(const std::byte *data, std::size_t count) noexcept(false) override
Writes 64-bit (quad word) big-endian data.
std::size_t write64_le(const std::byte *data, std::size_t count) noexcept(false) override
Writes 64-bit (quad word) little-endian data.
bool error() const noexcept override
Returns true if an error occured during a write operation or initialization, false otherwise.
std::size_t write16_le(const std::byte *data, std::size_t count) noexcept(false) override
Writes 16-bit (word) little-endian data.
void open(const std::filesystem::path &path) noexcept(false)
Opens a file using PhysicsFS and associates it with the serialize context.
bool is_open() const noexcept
Returns true if the PhysicsFS file associated with this serialize context is open,...
const std::filesystem::path & path() const noexcept override
Returns the path associated with this serialize context.
std::size_t write32_be(const std::byte *data, std::size_t count) noexcept(false) override
Writes 32-bit (double word) big-endian data.
constexpr int count(T x) noexcept
Returns the number of set bits in a value, known as a population count or Hamming weight.
Provides access to a serialization state.