struct unsigned_int

Class List > unsigned_int

Variable Length Unsigned Integer. More...

Public Attributes

Type Name
uint32_t value

Public Functions

Type Name
unsigned_int (uint32_t v = 0)
unsigned_int (T v)
operator T () const
unsigned_int & operator= (uint32_t v)

Friends

Type Name
friend bool operator==
friend bool operator==
friend bool operator==
friend bool operator!=
friend bool operator!=
friend bool operator!=
friend bool operator<
friend bool operator<
friend bool operator<
friend bool operator>=
friend bool operator>=
friend bool operator>=
friend DataStream & operator<<
friend DataStream & operator>>

Detailed Description

Variable Length Unsigned Integer. This provides more efficient serialization of 32-bit unsigned int. It serialuzes a 32-bit unsigned integer in as few bytes as possible varuint32 is unsigned and uses VLQ or Base-128 encoding

Public Attributes Documentation

variable value

uint32_t unsigned_int::value;

Contained value

Public Functions Documentation

function unsigned_int (1/2)

unsigned_int::unsigned_int(
    uint32_t v = 0
)

Construct a new unsigned int object

Parameters:

  • v - Source

function unsigned_int (2/2)

template<typename T>
unsigned_int::unsigned_int(
    T v
)

Construct a new unsigned int object from a type that is convertible to uint32_t

Template parameters:

  • T - Type of the source

Parameters:

  • v - Source

Precondition:

T must be convertible to uint32_t

function operator T

template<typename T>
unsigned_int::operator T() const

Convert unsigned_int as T

Template parameters:

  • T - Target type of conversion

Returns:

T - Converted target

function operator=

unsigned_int& unsigned_int::operator=(
    uint32_t v
)

Assign 32-bit unsigned integer

Parameters:

  • v - Soruce

Returns:

unsigned_int& - Reference to this object

Friends Documentation

friend operator== (1/3)

bool operator==(
    const unsigned_int & i,
    const uint32_t & v
)

Check equality between a unsigned_int object and 32-bit unsigned integer

Parameters:

  • i - unsigned_int object to compare
  • v - 32-bit unsigned integer to compare

Returns:

true - if equal

Returns:

false - otherwise

friend operator== (2/3)

bool operator==(
    const uint32_t & i,
    const unsigned_int & v
)

Check equality between 32-bit unsigned integer and a unsigned_int object

Parameters:

  • i - 32-bit unsigned integer to compare
  • v - unsigned_int object to compare

Returns:

true - if equal

Returns:

false - otherwise

friend operator== (3/3)

bool operator==(
    const unsigned_int & i,
    const unsigned_int & v
)

Check equality between two unsigned_int objects

Parameters:

Returns:

true - if equal

Returns:

false - otherwise

friend operator!= (1/3)

bool operator!=(
    const unsigned_int & i,
    const uint32_t & v
)

Check inequality between a unsigned_int object and 32-bit unsigned integer

Parameters:

  • i - unsigned_int object to compare
  • v - 32-bit unsigned integer to compare

Returns:

true - if inequal

Returns:

false - otherwise

friend operator!= (2/3)

bool operator!=(
    const uint32_t & i,
    const unsigned_int & v
)

Check inequality between 32-bit unsigned integer and a unsigned_int object

Parameters:

  • i - 32-bit unsigned integer to compare
  • v - unsigned_int object to compare

Returns:

true - if unequal

Returns:

false - otherwise

friend operator!= (3/3)

bool operator!=(
    const unsigned_int & i,
    const unsigned_int & v
)

Check inequality between two unsigned_int objects

Parameters:

Returns:

true - if inequal

Returns:

false - otherwise

friend operator< (1/3)

bool operator<(
    const unsigned_int & i,
    const uint32_t & v
)

Check if the given unsigned_int object is less than the given 32-bit unsigned integer

Parameters:

  • i - unsigned_int object to compare
  • v - 32-bit unsigned integer to compare

Returns:

true - if i less than v

Returns:

false - otherwise

friend operator< (2/3)

bool operator<(
    const uint32_t & i,
    const unsigned_int & v
)

Check if the given 32-bit unsigned integer is less than the given unsigned_int object

Parameters:

  • i - 32-bit unsigned integer to compare
  • v - unsigned_int object to compare

Returns:

true - if i less than v

Returns:

false - otherwise

friend operator< (3/3)

bool operator<(
    const unsigned_int & i,
    const unsigned_int & v
)

Check if the first given unsigned_int is less than the second given unsigned_int object

Parameters:

Returns:

true - if i less than v

Returns:

false - otherwise

friend operator>= (1/3)

bool operator>=(
    const unsigned_int & i,
    const uint32_t & v
)

Check if the given unsigned_int object is greater or equal to the given 32-bit unsigned integer

Parameters:

  • i - unsigned_int object to compare
  • v - 32-bit unsigned integer to compare

Returns:

true - if i is greater or equal to v

Returns:

false - otherwise

friend operator>= (2/3)

bool operator>=(
    const uint32_t & i,
    const unsigned_int & v
)

Check if the given 32-bit unsigned integer is greater or equal to the given unsigned_int object

Parameters:

  • i - 32-bit unsigned integer to compare
  • v - unsigned_int object to compare

Returns:

true - if i is greater or equal to v

Returns:

false - otherwise

friend operator>= (3/3)

bool operator>=(
    const unsigned_int & i,
    const unsigned_int & v
)

Check if the first given unsigned_int is greater or equal to the second given unsigned_int object

Parameters:

Returns:

true - if i is greater or equal to v

Returns:

false - otherwise

friend operator<<

template<typename DataStream>
DataStream& operator<<(
    DataStream & ds,
    const unsigned_int & v
)

Serialize an unsigned_int object with as few bytes as possible

Parameters:

  • ds - The stream to write
  • v - The value to serialize

Template parameters:

  • DataStream - Type of datastream

Returns:

DataStream& - Reference to the datastream

friend operator>>

template<typename DataStream>
DataStream& operator>>(
    DataStream & ds,
    unsigned_int & vi
)

Deserialize an unsigned_int object

Parameters:

  • ds - The stream to read
  • vi - The destination for deserialized value

Template parameters:

  • DataStream - Type of datastream

Returns:

DataStream& - Reference to the datastream


The documentation for this class was generated from the following file: libraries/eosiolib/varint.hpp