![]() |
Gamedev Framework (gf)
0.8.0
A C++14 framework for 2D games
|
A binary file that can be read or written. More...
#include <gf/BinaryFile.h>
Public Types | |
| enum | Mode { Mode::Read, Mode::Write, Mode::Append } |
| Open mode for the file. More... | |
Public Member Functions | |
| BinaryFile (const Path &filename, Mode mode) | |
| Constructor. More... | |
| BinaryFile (const BinaryFile &)=delete | |
| Deleted copy constructor. More... | |
| BinaryFile & | operator= (const BinaryFile &)=delete |
| Deleted copy assignment. More... | |
| BinaryFile (BinaryFile &&other) | |
| Move constructor. More... | |
| BinaryFile & | operator= (BinaryFile &&other) |
| Move assignment. More... | |
| ~BinaryFile () | |
| Destructor. More... | |
| std::size_t | write (ArrayRef< uint8_t > buffer) const |
| Write a buffer in the file. More... | |
| std::size_t | write (uint8_t byte) const |
| Write a single byte in the file. More... | |
| std::size_t | read (BufferRef< uint8_t > buffer) const |
| Read from the file into a buffer. More... | |
| std::size_t | read (uint8_t &byte) const |
| Read a single byte from the file. More... | |
| bool | isEof () const |
| Tell if the file is at the end. More... | |
A binary file that can be read or written.
|
strong |
Constructor.
| filename | The filename of the binary file |
| mode | The open mode |
|
delete |
Deleted copy constructor.
| gf::BinaryFile::BinaryFile | ( | BinaryFile && | other | ) |
Move constructor.
| gf::BinaryFile::~BinaryFile | ( | ) |
Destructor.
The file is closed in the destructor.
| bool gf::BinaryFile::isEof | ( | ) | const |
Tell if the file is at the end.
|
delete |
Deleted copy assignment.
| BinaryFile& gf::BinaryFile::operator= | ( | BinaryFile && | other | ) |
Move assignment.
| std::size_t gf::BinaryFile::read | ( | BufferRef< uint8_t > | buffer | ) | const |
Read from the file into a buffer.
| buffer | The buffer to read from the file |
| std::size_t gf::BinaryFile::read | ( | uint8_t & | byte | ) | const |
Read a single byte from the file.
| byte | The byte to read from the file |
| std::size_t gf::BinaryFile::write | ( | ArrayRef< uint8_t > | buffer | ) | const |
Write a buffer in the file.
| buffer | The buffer to write in the file |
| std::size_t gf::BinaryFile::write | ( | uint8_t | byte | ) | const |
Write a single byte in the file.
| byte | The byte to write in the file |
1.8.13