4 #include <c++utilities/io/binaryreader.h> 5 #include <c++utilities/io/binarywriter.h> 23 Field::Field(
AccountEntry *tiedAccount,
const string &name,
const string &value)
27 , m_tiedAccount(tiedAccount)
38 BinaryReader reader(&stream);
39 const int version = reader.readByte();
40 if (version != 0x0 && version != 0x1) {
43 m_name = reader.readLengthPrefixedString();
44 m_value = reader.readLengthPrefixedString();
45 byte
type = reader.readByte();
52 const uint16 extendedHeaderSize = reader.readUInt16BE();
64 BinaryWriter writer(&stream);
66 writer.writeLengthPrefixedString(m_name);
67 writer.writeLengthPrefixedString(m_value);
68 writer.writeByte(static_cast<byte>(m_type));
static bool isValidType(int number)
Returns whether the specified number is a valid field type.
void make(std::ostream &stream) const
Serializes the current instance to the specified stream.
Contains all IO related classes.
FieldType type() const
Returns the type.
The exception that is thrown when a parsing error occurs.
std::string m_extendedData
The exception that is thrown when a parsing error occurs.
AccountEntry * tiedAccount() const
Returns the tied account.