|
LibCppBinary
Modern cross-platform C++ binary parsing library
|
Represents an integer field in a binary file. More...
#include <IntField.h>
Public Member Functions | |
| IntField () | |
| Default constructor; creates a new instance of IntField. | |
| IntField (IntType value) | |
| Constructor; creates a new instance of IntField. | |
| IntField (FieldEndianness endianness) | |
| Constructor; creates a new instance of IntField. | |
| IntField (IntType value, FieldEndianness endianness) | |
| Constructor; creates a new instance of IntField. | |
| IntType | Value () const |
| Gets the value of the field. | |
| IntType | MinValue () const |
| Gets the minimum value this field can hold. | |
| IntType | MaxValue () const |
| Gets the maximum value this field can hold. | |
| FieldEndianness | Endianness () const |
| Gets the endianness of the field. | |
| void | SetValue (IntType value) |
| Sets the value of the field. | |
| void | SetEndianness (FieldEndianness e) |
| Sets the endianness of the field. | |
| void | SetToDefaultEndianness () |
| Sets the field to use the default endianness. | |
| 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. | |
| IntField< IntType, IntSize > & | operator= (const IntField< IntType, IntSize > &other) |
| Assignment operator for IntField. | |
| Public Member Functions inherited from Binary::RawField | |
| 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. | |
Additional Inherited Members | |
| Protected Member Functions inherited from Binary::RawField | |
| std::string | FormatData (StringFormat format) const |
| Format's the field's data as a string in a specific format. | |
| Protected Attributes inherited from Binary::RawField | |
| size_t | size |
| std::unique_ptr< char[]> | rawData |
Represents an integer field in a binary file.
Binary files can sometimes contain integer fields of varying sizes, signed or unsigned, with little endian or big endian byte order. This class template allows for a number of different variations of the int fields. Use the specializations of this template (UInt8Field, Int8Field, UInt16Field, Int16Field, UInt24Field, Int24Field, UInt32Field, Int32Field, UInt64Field, Int64Field) to read or write these types of fields from and to a Binary::Stream, such as a Binary::StandardFileStream.
|
inline |
Default constructor; creates a new instance of IntField.
|
inline |
Constructor; creates a new instance of IntField.
| value | The value to initialize the field to. |
| std::out_of_range | if value is outside of the valid range. |
|
inline |
Constructor; creates a new instance of IntField.
| endianness | The endianness the field should use. |
|
inline |
Constructor; creates a new instance of IntField.
| value | The value to initialize the field to. |
| endianness | The endianness the field should use. |
| std::out_of_range | if value is outside of the valid range. |
|
inline |
Gets the endianness of the field.
|
inline |
Gets the maximum value this field can hold.
|
inline |
Gets the minimum value this field can hold.
|
inline |
Assignment operator for IntField.
Copies the value and endianness from another IntField of the same type and size. Performs a self-assignment check. After assignment, this field will have the same value and endianness as the source, but remains a distinct object.
| other | The IntField to copy from. |
|
inline |
Sets the endianness of the field.
| e | The endianness to set the field to. |
|
inline |
Sets the field to use the default endianness.
|
inline |
Sets the value of the field.
| value | The value to set. |
| std::out_of_range | if value is outside of the valid range. |
|
inlineoverridevirtual |
Converts the field's data to a string representation.
Implements Binary::DataField.
|
inlineoverridevirtual |
Converts the field's data to a string representation.
Implements Binary::DataField.
|
inline |
Gets the value of the field.