|
LibCppBinary
Modern cross-platform C++ binary parsing library
|
Abstract base class representing a file stream. More...
#include <FileStream.h>
Public Member Functions | |
| virtual std::string | FileName () const =0 |
| Gets the name of the file. | |
| virtual std::string | FilePath () const =0 |
| Gets the full path to the file on disk. | |
| virtual bool | IsOpen () const =0 |
| Determines whether or not the file is open. | |
| virtual bool | FileExists () const =0 |
| Determines whether or not the file exists on disk. | |
| virtual size_t | FileSize () const =0 |
| Gets the size of the file associated with the stream. | |
| virtual FileMode | Mode () const =0 |
| Determines the mode the file is set to open in. | |
| virtual void | Open (FileMode mode)=0 |
| Opens the file in the specified mode. | |
| virtual void | Close ()=0 |
| Closes the file. | |
| Public Member Functions inherited from Binary::Stream | |
| 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 file stream.
Classes that represent a file 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 file.
|
pure virtual |
Closes the file.
| std::runtime_error | or implementation-specific exceptions if the file cannot be closed. |
Implemented in Binary::StandardFileStream.
|
pure virtual |
Determines whether or not the file exists on disk.
Implemented in Binary::StandardFileStream.
|
pure virtual |
Gets the name of the file.
Implemented in Binary::StandardFileStream.
|
pure virtual |
Gets the full path to the file on disk.
Implemented in Binary::StandardFileStream.
|
pure virtual |
Gets the size of the file associated with the stream.
| std::overflow_error | if file size exceeds size_t limits. |
| std::filesystem::filesystem_error | if file size cannot be determined. |
Implemented in Binary::StandardFileStream.
|
pure virtual |
Determines whether or not the file is open.
Implemented in Binary::StandardFileStream.
|
pure virtual |
Determines the mode the file is set to open in.
Implemented in Binary::StandardFileStream.
|
pure virtual |
Opens the file in the specified mode.
| mode | The mode to open the file in. |
| std::runtime_error | or implementation-specific exceptions if the file cannot be opened. |
Implemented in Binary::StandardFileStream.