|
LibCppBinary
Modern cross-platform C++ binary parsing library
|
Abstract base struct representing data structure in binary file. More...
#include <DataStructure.h>
Public Member Functions | |
| virtual std::vector< DataField * > | Fields ()=0 |
| Provides a vector of raw pointers to the structure's fields. | |
| virtual std::vector< const DataField * > | Fields () const =0 |
| Provides a vector of read-only raw pointers to the fields. | |
| virtual size_t | Size () const =0 |
| Gets the total size of all fields in the structure. | |
Abstract base struct representing data structure in binary file.
Structs that represent a data structure in a binary file should derive from this struct. The Binary::Stream class accepts pointers to instances of DataStructure for reading and writing data structures to binary data sources. By properly inheriting from this struct, the Binary::Stream class and its derivatives will automatically support reading and writing your derived type.
This provides an interface for a binary data structures. It is recommended that the derived implementations follow these guidelines:
1) Make fields available as public struct members for general access. 2) Fields() should return a vector of pointers to the struct members in the order that they should be read from and written to files. 3) Size() should sum all of the field sizes.
|
pure virtual |
Provides a vector of read-only raw pointers to the fields.
This method is primarily intended for use by Binary::Stream and its derivatives for reading the fields from and to those streams. Access the fields directly rather than via this method.
Implemented in Binary::ChunkHeader.
|
pure virtual |
Provides a vector of raw pointers to the structure's fields.
This method is primarily intended for use by Binary::Stream and its derivatives for reading the fields from and to those streams. Access the fields directly rather than via this method.
Implemented in Binary::ChunkHeader.
|
pure virtual |
Gets the total size of all fields in the structure.
Implemented in Binary::ChunkHeader.