|
LibCppBinary
Modern cross-platform C++ binary parsing library
|
Represents a raw data field in a binary file. More...
#include <RawField.h>
Public Member Functions | |
| RawField (size_t size) | |
| Constructor; creates a new instance of Field. | |
| RawField (const RawField &other) | |
| Copy constructor; creates a deep copy of the field. | |
| size_t | Size () const override |
| Gets the size of the data in the field. | |
| char * | RawData () override |
| Provides access to the field's raw data via pointer. | |
| const char * | RawData () const override |
| Provides access to the field's raw data via const pointer. | |
| std::string | ToString () const override |
| Converts the field's data to a string representation. | |
| std::string | ToString (StringFormat format) const override |
| Converts the field's data to a string representation. | |
| RawField & | operator= (const RawField &other) |
| Assignment operator for RawField. | |
| Public Member Functions inherited from Binary::DataField | |
| virtual | ~DataField ()=default |
| Default destructor; properly destroys the instance. | |
| virtual void | CopyRawDataTo (DataField *other) |
| Copies the raw data to another DataField. | |
Protected Member Functions | |
| std::string | FormatData (StringFormat format) const |
| Format's the field's data as a string in a specific format. | |
Protected Attributes | |
| size_t | size |
| std::unique_ptr< char[]> | rawData |
Represents a raw data field in a binary file.
Binary files can sometimes contain data fields that need to be read or written without respect to its interpretation. Use the RawField to read or write data without a specific interpretation from or to a Binary::Stream, such as a Binary::FileStream. More specialized field types should inherit from this class as it provides a lot of the basic functionality for managing the raw data.
| Binary::RawField::RawField | ( | size_t | size | ) |
Constructor; creates a new instance of Field.
| size | The size of the field, in bytes. |
| Binary::RawField::RawField | ( | const RawField & | other | ) |
Copy constructor; creates a deep copy of the field.
| other | The field to copy. |
|
protected |
Format's the field's data as a string in a specific format.
| format | The format to use. |
|
inlineoverridevirtual |
Provides access to the field's raw data via const pointer.
Provides read-only access to the raw data stored in the field. Note that this class should manage the lifecycle of the data, so do not attempt to deallocate the memory behind the pointer manually.
Implements Binary::DataField.
|
inlineoverridevirtual |
Provides access to the field's raw data via pointer.
Provides access to the raw data stored in the field. Note that this class should manage the lifecycle of the data, so do not attempt to deallocate the memory behind the pointer manually.
Implements Binary::DataField.
|
inlineoverridevirtual |
Gets the size of the data in the field.
Implements Binary::DataField.
|
overridevirtual |
Converts the field's data to a string representation.
Implements Binary::DataField.
Reimplemented in Binary::StringField.
|
overridevirtual |
Converts the field's data to a string representation.
| format | The format to use for the string conversion. |
Implements Binary::DataField.
Reimplemented in Binary::StringField.
|
protected |
|
protected |