TARAXA
|
#include <RLP.h>
Classes | |
class | iterator |
Iterator class for iterating through items of RLP list. More... | |
Public Types | |
enum | { AllowNonCanon = 1 , ThrowOnFail = 4 , FailIfTooBig = 8 , FailIfTooSmall = 16 , Strict = ThrowOnFail | FailIfTooBig , VeryStrict = ThrowOnFail | FailIfTooBig | FailIfTooSmall , LaissezFaire = AllowNonCanon } |
Conversion flags. More... | |
using | Strictness = int |
using | element_type = RLP |
Public Member Functions | |
RLP () | |
Construct a null node. More... | |
RLP (bytesConstRef _d, Strictness _s=VeryStrict) | |
Construct a node of value given in the bytes. More... | |
RLP (bytes const &_d, Strictness _s=VeryStrict) | |
Construct a node of value given in the bytes. More... | |
RLP (::byte const *_b, unsigned _s, Strictness _st=VeryStrict) | |
Construct a node to read RLP data in the bytes given. More... | |
RLP (std::string const &_s, Strictness _st=VeryStrict) | |
Construct a node to read RLP data in the string. More... | |
bytesConstRef | data () const |
The bare data of the RLP. More... | |
bool | isNull () const |
No value. More... | |
bool | isEmpty () const |
Contains a zero-length string or zero-length list. More... | |
bool | isData () const |
String value. More... | |
bool | isList () const |
List value. More... | |
bool | isInt () const |
Integer value. Must not have a leading zero. More... | |
size_t | itemCount () const |
size_t | itemCountStrict () const |
size_t | size () const |
size_t | sizeStrict () const |
bool | operator== (char const *_s) const |
Equality operators; does best-effort conversion and checks for equality. More... | |
bool | operator!= (char const *_s) const |
bool | operator== (std::string const &_s) const |
bool | operator!= (std::string const &_s) const |
template<unsigned _N> | |
bool | operator== (FixedHash< _N > const &_h) const |
template<unsigned _N> | |
bool | operator!= (FixedHash< _N > const &_s) const |
bool | operator== (unsigned const &_i) const |
bool | operator!= (unsigned const &_i) const |
bool | operator== (u256 const &_i) const |
bool | operator!= (u256 const &_i) const |
bool | operator== (bigint const &_i) const |
bool | operator!= (bigint const &_i) const |
RLP | operator[] (size_t _i) const |
iterator | begin () const |
Iterator into beginning of sub-item list (valid only if we are a list). More... | |
iterator | end () const |
Iterator into end of sub-item list (valid only if we are a list). More... | |
template<class T > | |
T | convert (int _flags) const |
operator std::string () const | |
Best-effort conversion operators. More... | |
operator bytes () const | |
operator uint8_t () const | |
operator uint16_t () const | |
operator uint32_t () const | |
operator uint64_t () const | |
operator u160 () const | |
operator u256 () const | |
operator bigint () const | |
template<unsigned N> | |
operator FixedHash< N > () const | |
template<class T , class U > | |
operator std::pair< T, U > () const | |
template<class T > | |
operator std::vector< T > () const | |
template<class T > | |
operator std::set< T > () const | |
template<class T , size_t N> | |
operator std::array< T, N > () const | |
bytes | toBytes (int _flags=LaissezFaire) const |
Converts to bytearray. More... | |
bytesConstRef | toBytesConstRef (int _flags=LaissezFaire) const |
Converts to bytearray. More... | |
std::string | toString (int _flags=LaissezFaire) const |
Converts to string. More... | |
std::string | toStringStrict () const |
Converts to string. More... | |
template<class T > | |
std::vector< T > | toVector (int _flags=LaissezFaire) const |
template<class T > | |
std::set< T > | toSet (int _flags=LaissezFaire) const |
template<class T > | |
std::unordered_set< T > | toUnorderedSet (int _flags=LaissezFaire) const |
template<class T , class U > | |
std::pair< T, U > | toPair (int _flags=Strict) const |
template<class T , size_t N> | |
std::array< T, N > | toArray (int _flags=LaissezFaire) const |
template<class _T = unsigned> | |
std::enable_if_t< is_integer< _T >Signedness::any), _T > | toInt (int _flags=Strict) const |
int64_t | toPositiveInt64 (int _flags=Strict) const |
template<class _N > | |
_N | toHash (int _flags=Strict) const |
bytesConstRef | payload () const |
size_t | actualSize () const |
Private Member Functions | |
RLP (bytes const &&) | |
Disable construction from rvalue. More... | |
void | requireGood () const |
bool | isSingleByte () const |
Single-byte data payload. More... | |
unsigned | lengthSize () const |
size_t | length () const |
size_t | payloadOffset () const |
size_t | items () const |
Static Private Member Functions | |
static size_t | sizeAsEncoded (bytesConstRef _data) |
Private Attributes | |
bytesConstRef | m_data |
Our byte data. More... | |
size_t | m_lastIndex = (size_t)-1 |
The list-indexing cache. More... | |
size_t | m_lastEnd = 0 |
bytesConstRef | m_lastItem |
Class for interpreting Recursive Linear-Prefix Data.
using dev::RLP::element_type = RLP |
using dev::RLP::Strictness = int |
anonymous enum |
|
inline |
Construct a null node.
|
explicit |
Construct a node of value given in the bytes.
|
inlineexplicit |
Construct a node of value given in the bytes.
|
inline |
Construct a node to read RLP data in the bytes given.
|
inlineexplicit |
Construct a node to read RLP data in the string.
|
inlineexplicitprivate |
Disable construction from rvalue.
size_t RLP::actualSize | ( | ) | const |
|
inline |
Iterator into beginning of sub-item list (valid only if we are a list).
|
inline |
|
inline |
The bare data of the RLP.
|
inline |
Iterator into end of sub-item list (valid only if we are a list).
|
inline |
String value.
|
inline |
Contains a zero-length string or zero-length list.
bool RLP::isInt | ( | ) | const |
Integer value. Must not have a leading zero.
|
inline |
List value.
|
inline |
No value.
|
inlineprivate |
Single-byte data payload.
|
inline |
|
inline |
|
private |
|
private |
|
inlineprivate |
|
inlineexplicit |
|
inlineexplicit |
|
inlineexplicit |
|
inlineexplicit |
|
inlineexplicit |
|
inlineexplicit |
|
inlineexplicit |
Best-effort conversion operators.
|
inlineexplicit |
|
inlineexplicit |
|
inlineexplicit |
|
inlineexplicit |
|
inlineexplicit |
|
inlineexplicit |
|
inlineexplicit |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Equality operators; does best-effort conversion and checks for equality.
|
inline |
|
inline |
|
inline |
|
inline |
RLP RLP::operator[] | ( | size_t | _i | ) | const |
|
inline |
|
inlineprivate |
|
private |
Throws if is non-canonical data (i.e. single byte done in two bytes that could be done in one).
|
inline |
|
inlinestaticprivate |
|
inline |
|
inline |
|
inline |
Converts to bytearray.
|
inline |
Converts to bytearray.
|
inline |
|
inline |
Converts to int of type given; if isData(), decodes as big-endian bytestream.
|
inline |
|
inline |
|
inline |
|
inline |
Converts to string.
|
inline |
Converts to string.
BadCast | if not a string. |
|
inline |
|
inline |
|
private |
Our byte data.
|
mutableprivate |
|
mutableprivate |
The list-indexing cache.
|
mutableprivate |