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)
37 BinaryReader reader(&stream);
38 int version = reader.readByte();
39 if(version == 0x0 || version == 0x1) {
40 m_name = reader.readLengthPrefixedString();
41 m_value = reader.readLengthPrefixedString();
42 byte
type = reader.readByte();
49 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.
Contains all IO related classes.
The exception that is thrown when a parsing error occurs.
void make(std::ostream &stream) const
Serializes the current instance to the specified stream.
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
FieldType type() const
Returns the type.
The exception that is thrown when a parsing error occurs.
AccountEntry * tiedAccount() const
Returns the tied account.