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 int version = reader.readByte();
40 if (version == 0x0 || version == 0x1) {
41 m_name = reader.readLengthPrefixedString();
42 m_value = reader.readLengthPrefixedString();
43 byte
type = reader.readByte();
50 uint16 extendedHeaderSize = reader.readUInt16BE();
65 BinaryWriter writer(&stream);
67 writer.writeLengthPrefixedString(m_name);
68 writer.writeLengthPrefixedString(m_value);
69 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.
Field(AccountEntry *tiedAccount, const std::string &name=std::string(), const std::string &value=std::string())
Constructs a new account entry for the specified account with the specified name and value...
std::string m_extendedData
The exception that is thrown when a parsing error occurs.
AccountEntry * tiedAccount() const
Returns the tied account.