|
LibCppBinary
Modern cross-platform C++ binary parsing library
|
Abstract base class representing a binary stream. More...
#include <Stream.h>
Public Member Functions | |
| virtual | ~Stream ()=default |
| Default destructor; properly destroys the instance. | |
| virtual void | Read (DataField *field) const =0 |
| Reads data from the stream into the specified field. | |
| virtual void | Read (DataStructure *structure) const =0 |
| Reads data from stream into the specified data structure. | |
| virtual std::shared_ptr< ChunkHeader > | FindNextChunk (std::string id) const =0 |
| Finds the next chunk header with the specified ID. | |
| virtual void | Write (const DataField *field)=0 |
| Writes data to the stream from the specified field. | |
| virtual void | Write (const DataStructure *structure)=0 |
| Writes the specified structure to the stream. | |
| virtual size_t | Position () const =0 |
| Gets the current position in the stream. | |
| virtual void | SetPosition (size_t position) const =0 |
| Sets the current position in the stream. | |
| virtual size_t | Beginning () const =0 |
| Gets the beginning position of the file. | |
| virtual size_t | End () const =0 |
| Gets the end position of the file. | |
Abstract base class representing a binary stream.
Classes that represent a binary stream should derive from this class. This class accepts pointers to instances of DataField and other types composed of data fields for reading and writing to and from the binary data source.
|
virtualdefault |
Default destructor; properly destroys the instance.
|
pure virtual |
Gets the beginning position of the file.
Implemented in Binary::BufferStream, and Binary::StandardFileStream.
|
pure virtual |
Gets the end position of the file.
Implemented in Binary::BufferStream, and Binary::StandardFileStream.
|
pure virtual |
Finds the next chunk header with the specified ID.
| id | The ID of the chunk to find. |
| std::invalid_argument | if id is not 4 characters long. |
Implemented in Binary::BufferStream, and Binary::StandardFileStream.
|
pure virtual |
Gets the current position in the stream.
Implemented in Binary::BufferStream, and Binary::StandardFileStream.
|
pure virtual |
Reads data from the stream into the specified field.
| field | A pointer to the field to read data into. |
| std::out_of_range | if field size > remaining buffer size. |
| std::invalid_argument | if field is null. |
Implemented in Binary::BufferStream, and Binary::StandardFileStream.
|
pure virtual |
Reads data from stream into the specified data structure.
| structure | A pointer to the data structure to read data into. |
| std::out_of_range | if structure size > remaining buffer size. |
| std::invalid_argument | if structure is null. |
Implemented in Binary::BufferStream, and Binary::StandardFileStream.
|
pure virtual |
Sets the current position in the stream.
| position | The position value to set. |
| std::out_of_range | if position > size. |
Implemented in Binary::BufferStream, and Binary::StandardFileStream.
|
pure virtual |
Writes data to the stream from the specified field.
| field | A pointer to the field to write to the stream. |
| std::out_of_range | if field size > remaining buffer size. |
| std::invalid_argument | if field is null. |
Implemented in Binary::BufferStream, and Binary::StandardFileStream.
|
pure virtual |
Writes the specified structure to the stream.
| structure | A pointer to the structure to write to the stream. |
| std::out_of_range | if structure size > remaining buffer size. |
| std::invalid_argument | if structure is null. |
Implemented in Binary::BufferStream, and Binary::StandardFileStream.