![]() |
MAGE
v0.171.0
Matthias Advanced Game Engine
|
#include <binary_reader.hpp>
Public Member Functions | |
| BinaryReader & | operator= (const BinaryReader &reader)=delete |
| BinaryReader & | operator= (BinaryReader &&reader) noexcept |
| void | ReadFromFile (std::filesystem::path path, bool big_endian) |
| void | ReadFromMemory (gsl::span< const U8 > input, bool big_endian) |
Protected Member Functions | |
| BinaryReader () | |
| BinaryReader (const BinaryReader &reader)=delete | |
| BinaryReader (BinaryReader &&reader) noexcept | |
| ~BinaryReader () | |
| const std::filesystem::path & | GetPath () const noexcept |
| bool | ContainsChars () const noexcept |
| NotNull< const_zstring > | ReadChars (std::size_t size) |
| template<typename T > | |
| const T | Read () |
Private Member Functions | |
| virtual void | ReadData ()=0 |
Private Attributes | |
| std::filesystem::path | m_path |
| bool | m_big_endian |
| const U8 * | m_pos |
| const U8 * | m_end |
| UniquePtr< U8[] > | m_data |
A class of readers for reading binary files.
|
protected |
Constructs a binary reader.
|
protecteddelete |
Constructs a binary reader from the given binary reader.
| [in] | reader | A reference to the binary reader to copy. |
|
protecteddefaultnoexcept |
Constructs a binary reader by moving the given binary reader.
| [in] | reader | A reference to the binary reader to move. |
|
protecteddefault |
Destructs this binary reader.
|
protectednoexcept |
Checks if there are characters left to read by this binary reader.
true if there are characters left to read by this binary reader. false otherwise.
|
protectednoexcept |
Returns the current path of this binary reader.
|
delete |
Copies the given binary reader to this binary reader.
| [in] | reader | A reference to a binary reader to copy. |
|
defaultnoexcept |
Moves the given binary reader to this binary reader.
| [in] | reader | A reference to a binary reader to move. |
|
protected |
Reads a T value.
| T | The data type. |
T value read. | Exception | Failed to read a T value. |
|
protected |
Reads an array of byte characters.
| size | The number of bytes to read. |
| Exception | Failed to read size bytes. |
|
privatepure virtual |
Starts reading.
| Exception | Failed to read from the given file. |
| void mage::BinaryReader::ReadFromFile | ( | std::filesystem::path | path, |
| bool | big_endian | ||
| ) |
Reads from the given file associated with the given path.
| [in] | path | The path. |
| [in] | big_endian | Flag indicating whether the given byte array should be interpreted as big endian or not (i.e. little endian). |
| Exception | Failed to read from the file. |
| void mage::BinaryReader::ReadFromMemory | ( | gsl::span< const U8 > | input, |
| bool | big_endian | ||
| ) |
Reads the input string.
| [in] | input | The input byte string. |
| [in] | big_endian | Flag indicating whether the given byte array should be interpreted as big endian or not (i.e. little endian). |
| Exception | Failed to read from the given input string. |
|
private |
A flag indicating whether the current data of this binary reader should be interpreted as big endian or not (i.e. little endian).
A pointer to the data to read of this binary reader.
|
private |
A pointer to the end position of this binary reader.
|
private |
The current path of this binary reader.
|
private |
A pointer to the current position of this binary reader.