ledger-core
|
#include <BytesWriter.h>
Public Member Functions | |
BytesWriter (size_t size) | |
BytesWriter & | writeByte (uint8_t byte) |
template<typename T > | |
BytesWriter & | writeBeValue (const T value) |
template<typename T > | |
BytesWriter & | writeLeValue (const T value) |
BytesWriter & | writeByteArray (const std::vector< uint8_t > &data) |
BytesWriter & | writeLeByteArray (const std::vector< uint8_t > &data) |
BytesWriter & | writeBeBigInt (const BigInt &i) |
BytesWriter & | writeLeBigInt (const BigInt &i) |
BytesWriter & | writeString (const std::string &str) |
BytesWriter & | writeVarInt (uint64_t i) |
BytesWriter & | writeVarString (const std::string &str) |
std::vector< uint8_t > | toByteArray () const |
Helper class to write byte array. Each write call returns a reference on "this" in order to chain writings.
std::vector< uint8_t > ledger::core::BytesWriter::toByteArray | ( | ) | const |
Returns the serialized data.
BytesWriter & ledger::core::BytesWriter::writeBeBigInt | ( | const BigInt & | i | ) |
|
inline |
Write a value (int, long, short, byte, struct) into the writer using big endian bytes ordering.
value |
|
inline |
Write a single byte into the writer.
byte |
BytesWriter & ledger::core::BytesWriter::writeByteArray | ( | const std::vector< uint8_t > & | data | ) |
Writes a byte array into the writer.
data |
BytesWriter & ledger::core::BytesWriter::writeLeBigInt | ( | const BigInt & | i | ) |
BytesWriter & ledger::core::BytesWriter::writeLeByteArray | ( | const std::vector< uint8_t > & | data | ) |
Write a byte array in reverse order.
data |
|
inline |
Write a value (int, long, short, byte, struct) into the writer using big endian bytes ordering.
value |
BytesWriter & ledger::core::BytesWriter::writeString | ( | const std::string & | str | ) |
Writes a string into the writer.
str |
BytesWriter & ledger::core::BytesWriter::writeVarInt | ( | uint64_t | i | ) |
Writes a var int into the writer.
i |
BytesWriter & ledger::core::BytesWriter::writeVarString | ( | const std::string & | str | ) |
Writes a var string into the writer.
str |