BinaryFileWriter: interface for writing to binary files, bit by bit or byte by byte.
More...
#include <binary_file_writer.h>
BinaryFileWriter: interface for writing to binary files, bit by bit or byte by byte.
Wraps an ofstream in binary mode.
◆ BinaryFileWriter()
BinaryFileWriter::BinaryFileWriter |
( |
const std::string & |
fileName | ) |
|
Constructs a new BinaryFileWriter by opening the given filename.
- Parameters
-
fileName | File to be opened. |
◆ ~BinaryFileWriter()
BinaryFileWriter::~BinaryFileWriter |
( |
| ) |
|
Destroys an BinaryFileWriter: the destructor here ensures that all remaining bits are written to the file before closing the file.
If the file was already closed, nothing is done.
◆ close()
void BinaryFileWriter::close |
( |
| ) |
|
◆ writeBit()
void BinaryFileWriter::writeBit |
( |
bool |
bit | ) |
|
Writes the next bit of the file.
- Parameters
-
bit | The bit to be written. |
◆ writeByte()
void BinaryFileWriter::writeByte |
( |
char |
byte | ) |
|
Writes the next byte to the file.
- Parameters
-
byte | The byte to be written. |
◆ writeCurrentByte()
void BinaryFileWriter::writeCurrentByte |
( |
| ) |
|
|
private |
Writes the current byte to the file.
◆ currentBit_
int BinaryFileWriter::currentBit_ |
|
private |
The current bit within the currentByte that is being written.
◆ currentByte_
char BinaryFileWriter::currentByte_ |
|
private |
The current byte to write bits into.
◆ file_
The documentation for this class was generated from the following files: