26 file = PHYSFS_openWrite(
path.string().c_str());
56 file = PHYSFS_openWrite(
path.string().c_str());
73 m_error = !PHYSFS_close(file);
96 const PHYSFS_sint64
status = PHYSFS_writeBytes(file, data,
count);
117 const PHYSFS_uint16* data16 =
reinterpret_cast<const PHYSFS_uint16*
>(data);
119 for (std::size_t i = 0; i <
count; ++i)
121 if (!PHYSFS_writeULE16(file, *data16))
136 const PHYSFS_uint16* data16 =
reinterpret_cast<const PHYSFS_uint16*
>(data);
138 for (std::size_t i = 0; i <
count; ++i)
140 if (!PHYSFS_writeUBE16(file, *data16))
155 const PHYSFS_uint32* data32 =
reinterpret_cast<const PHYSFS_uint32*
>(data);
157 for (std::size_t i = 0; i <
count; ++i)
159 if (!PHYSFS_writeULE32(file, *data32))
174 const PHYSFS_uint32* data32 =
reinterpret_cast<const PHYSFS_uint32*
>(data);
176 for (std::size_t i = 0; i <
count; ++i)
178 if (!PHYSFS_writeUBE32(file, *data32))
193 const PHYSFS_uint64* data64 =
reinterpret_cast<const PHYSFS_uint64*
>(data);
195 for (std::size_t i = 0; i <
count; ++i)
197 if (!PHYSFS_writeULE64(file, *data64))
212 const PHYSFS_uint64* data64 =
reinterpret_cast<const PHYSFS_uint64*
>(data);
214 for (std::size_t i = 0; i <
count; ++i)
216 if (!PHYSFS_writeUBE64(file, *data64))
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,...
virtual ~physfs_serialize_context()
Destructs a PhysicsFS serialize context, internally closing a file using PhysicsFS.
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.
An exception of this type is thrown when an error occurs during serialization.
status
Behavior tree node return status enumerations.
constexpr int count(T x) noexcept
Returns the number of set bits in a value, known as a population count or Hamming weight.