rippled
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
ripple::Serializer Class Reference

#include <Serializer.h>

Collaboration diagram for ripple::Serializer:
Collaboration graph
[legend]

Public Member Functions

 Serializer (int n=256)
 
 Serializer (void const *data, std::size_t size)
 
Slice slice () const noexcept
 
std::size_t size () const noexcept
 
void const * data () const noexcept
 
int add8 (unsigned char i)
 
int add16 (std::uint16_t i)
 
template<typename T >
requires (std::is_same_v< std::make_unsigned_t<std::remove_cv_t<T>>, std::uint32_t>)
int add32 (T i)
 
int add32 (HashPrefix p)
 
template<typename T >
requires (std::is_same_v< std::make_unsigned_t<std::remove_cv_t<T>>, std::uint64_t>)
int add64 (T i)
 
template<typename Integer >
int addInteger (Integer)
 
template<std::size_t Bits, class Tag >
int addBitString (base_uint< Bits, Tag > const &v)
 
int addRaw (Blob const &vector)
 
int addRaw (Slice slice)
 
int addRaw (void const *ptr, int len)
 
int addRaw (Serializer const &s)
 
int addVL (Blob const &vector)
 
int addVL (Slice const &slice)
 
template<class Iter >
int addVL (Iter begin, Iter end, int len)
 
int addVL (void const *ptr, int len)
 
bool get8 (int &, int offset) const
 
template<typename Integer >
bool getInteger (Integer &number, int offset)
 
template<std::size_t Bits, typename Tag = void>
bool getBitString (base_uint< Bits, Tag > &data, int offset) const
 
int addFieldID (int type, int name)
 
int addFieldID (SerializedTypeID type, int name)
 
uint256 getSHA512Half () const
 
Blob const & peekData () const
 
Blob getData () const
 
BlobmodData ()
 
int getDataLength () const
 
void const * getDataPtr () const
 
void * getDataPtr ()
 
int getLength () const
 
std::string getString () const
 
void erase ()
 
bool chop (int num)
 
Blob::iterator begin ()
 
Blob::iterator end ()
 
Blob::const_iterator begin () const
 
Blob::const_iterator end () const
 
void reserve (size_t n)
 
void resize (size_t n)
 
size_t capacity () const
 
bool operator== (Blob const &v) const
 
bool operator!= (Blob const &v) const
 
bool operator== (Serializer const &v) const
 
bool operator!= (Serializer const &v) const
 
template<>
int addInteger (unsigned char i)
 
template<>
int addInteger (std::uint16_t i)
 
template<>
int addInteger (std::uint32_t i)
 
template<>
int addInteger (std::uint64_t i)
 
template<>
int addInteger (std::int32_t i)
 

Static Public Member Functions

static int decodeLengthLength (int b1)
 
static int decodeVLLength (int b1)
 
static int decodeVLLength (int b1, int b2)
 
static int decodeVLLength (int b1, int b2, int b3)
 

Private Member Functions

int addEncoded (int length)
 

Static Private Member Functions

static int encodeLengthLength (int length)
 

Private Attributes

Blob mData
 

Detailed Description

Definition at line 40 of file Serializer.h.

Constructor & Destructor Documentation

◆ Serializer() [1/2]

ripple::Serializer::Serializer ( int  n = 256)
explicit

Definition at line 47 of file Serializer.h.

◆ Serializer() [2/2]

ripple::Serializer::Serializer ( void const *  data,
std::size_t  size 
)

Definition at line 52 of file Serializer.h.

Member Function Documentation

◆ slice()

Slice ripple::Serializer::slice ( ) const
noexcept

Definition at line 66 of file Serializer.h.

◆ size()

std::size_t ripple::Serializer::size ( ) const
noexcept

Definition at line 72 of file Serializer.h.

◆ data()

void const * ripple::Serializer::data ( ) const
noexcept

Definition at line 78 of file Serializer.h.

◆ add8()

int ripple::Serializer::add8 ( unsigned char  i)

Definition at line 162 of file Serializer.cpp.

◆ add16()

int ripple::Serializer::add16 ( std::uint16_t  i)

Definition at line 43 of file Serializer.cpp.

◆ add32() [1/2]

template<typename T >
requires (std::is_same_v< std::make_unsigned_t<std::remove_cv_t<T>>, std::uint32_t>)
int ripple::Serializer::add32 ( i)

Definition at line 94 of file Serializer.h.

◆ add32() [2/2]

int ripple::Serializer::add32 ( HashPrefix  p)

Definition at line 52 of file Serializer.cpp.

◆ add64()

template<typename T >
requires (std::is_same_v< std::make_unsigned_t<std::remove_cv_t<T>>, std::uint64_t>)
int ripple::Serializer::add64 ( i)

Definition at line 112 of file Serializer.h.

◆ addInteger() [1/6]

template<typename Integer >
int ripple::Serializer::addInteger ( Integer  )

◆ addBitString()

template<std::size_t Bits, class Tag >
int ripple::Serializer::addBitString ( base_uint< Bits, Tag > const &  v)

Definition at line 131 of file Serializer.h.

◆ addRaw() [1/4]

int ripple::Serializer::addRaw ( Blob const &  vector)

Definition at line 94 of file Serializer.cpp.

◆ addRaw() [2/4]

int ripple::Serializer::addRaw ( Slice  slice)

Definition at line 102 of file Serializer.cpp.

◆ addRaw() [3/4]

int ripple::Serializer::addRaw ( void const *  ptr,
int  len 
)

Definition at line 118 of file Serializer.cpp.

◆ addRaw() [4/4]

int ripple::Serializer::addRaw ( Serializer const &  s)

Definition at line 110 of file Serializer.cpp.

◆ addVL() [1/4]

int ripple::Serializer::addVL ( Blob const &  vector)

Definition at line 196 of file Serializer.cpp.

◆ addVL() [2/4]

int ripple::Serializer::addVL ( Slice const &  slice)

Definition at line 208 of file Serializer.cpp.

◆ addVL() [3/4]

template<class Iter >
int ripple::Serializer::addVL ( Iter  begin,
Iter  end,
int  len 
)

Definition at line 326 of file Serializer.h.

◆ addVL() [4/4]

int ripple::Serializer::addVL ( void const *  ptr,
int  len 
)

Definition at line 217 of file Serializer.cpp.

◆ get8()

bool ripple::Serializer::get8 ( int &  byte,
int  offset 
) const

Definition at line 170 of file Serializer.cpp.

◆ getInteger()

template<typename Integer >
bool ripple::Serializer::getInteger ( Integer &  number,
int  offset 
)

Definition at line 161 of file Serializer.h.

◆ getBitString()

template<std::size_t Bits, typename Tag = void>
bool ripple::Serializer::getBitString ( base_uint< Bits, Tag > &  data,
int  offset 
) const

Definition at line 180 of file Serializer.h.

◆ addFieldID() [1/2]

int ripple::Serializer::addFieldID ( int  type,
int  name 
)

Definition at line 126 of file Serializer.cpp.

◆ addFieldID() [2/2]

int ripple::Serializer::addFieldID ( SerializedTypeID  type,
int  name 
)

Definition at line 191 of file Serializer.h.

◆ getSHA512Half()

uint256 ripple::Serializer::getSHA512Half ( ) const

Definition at line 190 of file Serializer.cpp.

◆ peekData()

Blob const & ripple::Serializer::peekData ( ) const

Definition at line 202 of file Serializer.h.

◆ getData()

Blob ripple::Serializer::getData ( ) const

Definition at line 207 of file Serializer.h.

◆ modData()

Blob & ripple::Serializer::modData ( )

Definition at line 212 of file Serializer.h.

◆ getDataLength()

int ripple::Serializer::getDataLength ( ) const

Definition at line 218 of file Serializer.h.

◆ getDataPtr() [1/2]

void const * ripple::Serializer::getDataPtr ( ) const

Definition at line 223 of file Serializer.h.

◆ getDataPtr() [2/2]

void * ripple::Serializer::getDataPtr ( )

Definition at line 228 of file Serializer.h.

◆ getLength()

int ripple::Serializer::getLength ( ) const

Definition at line 233 of file Serializer.h.

◆ getString()

std::string ripple::Serializer::getString ( ) const

Definition at line 238 of file Serializer.h.

◆ erase()

void ripple::Serializer::erase ( )

Definition at line 243 of file Serializer.h.

◆ chop()

bool ripple::Serializer::chop ( int  num)

Definition at line 180 of file Serializer.cpp.

◆ begin() [1/2]

Blob::iterator ripple::Serializer::begin ( )

Definition at line 252 of file Serializer.h.

◆ end() [1/2]

Blob::iterator ripple::Serializer::end ( )

Definition at line 257 of file Serializer.h.

◆ begin() [2/2]

Blob::const_iterator ripple::Serializer::begin ( ) const

Definition at line 262 of file Serializer.h.

◆ end() [2/2]

Blob::const_iterator ripple::Serializer::end ( ) const

Definition at line 267 of file Serializer.h.

◆ reserve()

void ripple::Serializer::reserve ( size_t  n)

Definition at line 272 of file Serializer.h.

◆ resize()

void ripple::Serializer::resize ( size_t  n)

Definition at line 277 of file Serializer.h.

◆ capacity()

size_t ripple::Serializer::capacity ( ) const

Definition at line 282 of file Serializer.h.

◆ operator==() [1/2]

bool ripple::Serializer::operator== ( Blob const &  v) const

Definition at line 288 of file Serializer.h.

◆ operator!=() [1/2]

bool ripple::Serializer::operator!= ( Blob const &  v) const

Definition at line 293 of file Serializer.h.

◆ operator==() [2/2]

bool ripple::Serializer::operator== ( Serializer const &  v) const

Definition at line 298 of file Serializer.h.

◆ operator!=() [2/2]

bool ripple::Serializer::operator!= ( Serializer const &  v) const

Definition at line 303 of file Serializer.h.

◆ decodeLengthLength()

int ripple::Serializer::decodeLengthLength ( int  b1)
static

Definition at line 279 of file Serializer.cpp.

◆ decodeVLLength() [1/3]

int ripple::Serializer::decodeVLLength ( int  b1)
static

Definition at line 298 of file Serializer.cpp.

◆ decodeVLLength() [2/3]

int ripple::Serializer::decodeVLLength ( int  b1,
int  b2 
)
static

Definition at line 310 of file Serializer.cpp.

◆ decodeVLLength() [3/3]

int ripple::Serializer::decodeVLLength ( int  b1,
int  b2,
int  b3 
)
static

Definition at line 322 of file Serializer.cpp.

◆ encodeLengthLength()

int ripple::Serializer::encodeLengthLength ( int  length)
staticprivate

Definition at line 260 of file Serializer.cpp.

◆ addEncoded()

int ripple::Serializer::addEncoded ( int  length)
private

Definition at line 228 of file Serializer.cpp.

◆ addInteger() [2/6]

template<>
int ripple::Serializer::addInteger ( unsigned char  i)

Definition at line 64 of file Serializer.cpp.

◆ addInteger() [3/6]

template<>
int ripple::Serializer::addInteger ( std::uint16_t  i)

Definition at line 70 of file Serializer.cpp.

◆ addInteger() [4/6]

template<>
int ripple::Serializer::addInteger ( std::uint32_t  i)

Definition at line 76 of file Serializer.cpp.

◆ addInteger() [5/6]

template<>
int ripple::Serializer::addInteger ( std::uint64_t  i)

Definition at line 82 of file Serializer.cpp.

◆ addInteger() [6/6]

template<>
int ripple::Serializer::addInteger ( std::int32_t  i)

Definition at line 88 of file Serializer.cpp.

Member Data Documentation

◆ mData

Blob ripple::Serializer::mData
private

Definition at line 44 of file Serializer.h.