Menu

struct eosio::name

Class List > eosio :: name

Public Types

Type Name
enum raw { }
enum raw { }

Public Attributes

Type Name
uint64_t value

Public Functions

Type Name
constexpr name ()
Construct a new name object defaulting to a value of 0.
constexpr name (uint64_t v)
Construct a new name object initialising value with v.
constexpr name (name::raw r)
Construct a new name object initialising value with r.
constexpr name (std::string_view str)
Construct a new name object initialising value with str.
constexpr uint8_t length () const
constexpr name suffix () const
constexpr operator raw () const
constexpr operator bool () const
char * write_as_string (char * begin, char * end) const
std::string to_string () const
Returns the name value as a string by calling write_as_string() and returning the buffer produced by write_as_string()
void print () const
constexpr name ()
Construct a new name object defaulting to a value of 0.
constexpr name (uint64_t v)
Construct a new name object initialising value with v.
constexpr name (name::raw r)
Construct a new name object initialising value with r.
constexpr name (std::string_view str)
Construct a new name object initialising value with str.
constexpr uint8_t length () const
constexpr name suffix () const
constexpr operator raw () const
constexpr operator bool () const
char * write_as_string (char * begin, char * end) const
std::string to_string () const
Returns the name value as a string by calling write_as_string() and returning the buffer produced by write_as_string()

Public Static Functions

Type Name
static constexpr uint8_t char_to_value (char c)
static constexpr uint8_t char_to_value (char c)

Friends

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

Detailed Description

Wraps a uint64_t to ensure it is only passed to methods that expect a name. Ensures value is only passed to methods that expect a name and that no mathematical operations occur. Also enables specialization of print

Public Types Documentation

enum raw (1/2)

enum eosio::name::raw {
};

enum raw

enum eosio::name::raw {
};

Public Attributes Documentation

variable value

uint64_t eosio::name::value;

Public Functions Documentation

function name (1/8)

constexpr eosio::name::name()

Construct a new name object defaulting to a value of 0.

Construct a new name

function name (2/8)

explicit constexpr eosio::name::name(
    uint64_t v
)

Construct a new name object initialising value with v.

Construct a new name given a unit64_t value

Parameters:

  • v - The unit64_t value

function name (3/8)

explicit constexpr eosio::name::name(
    name::raw r
)

Construct a new name object initialising value with r.

Construct a new name given a scoped enumerated type of raw (uint64_t).

Parameters:

  • r - The raw value which is a scoped enumerated type of unit64_t

function name (4/8)

explicit constexpr eosio::name::name(
    std::string_view str
)

Construct a new name object initialising value with str.

Construct a new name given an string.

Parameters:

  • str - The string value which validated then converted to unit64_t

function length (1/2)

constexpr uint8_t eosio::name::length() const

Returns the length of the name

function suffix (1/2)

constexpr name eosio::name::suffix() const

Returns the suffix of the name

function operator raw (1/2)

constexpr eosio::name::operator raw() const

Casts a name to raw

Returns:

Returns an instance of raw based on the value of a name

function operator bool (1/2)

explicit constexpr eosio::name::operator bool() const

Explicit cast to bool of the uint64_t value of the name

Returns:

Returns true if the name is set to the default value of 0 else true.

function write_as_string (1/2)

char* eosio::name::write_as_string(
    char * begin,
    char * end
) const

Writes the name as a string to the provided char buffer

Precondition:

Appropriate Size Precondition: (begin + 13) <= end and (begin + 13) does not overflow

Precondition:

Valid Memory Region Precondition: The range [begin, end) must be a valid range of memory to write to.

Parameters:

  • begin - The start of the char buffer
  • end - Just past the end of the char buffer

Returns:

char* - Just past the end of the last character written (returns begin if the Appropriate Size Precondition is not satisfied)

Post

If the Appropriate Size Precondition is satisfied, the range [begin, returned pointer) contains the string representation of the name.

function to_string (1/2)

std::string eosio::name::to_string() const

Returns the name value as a string by calling write_as_string() and returning the buffer produced by write_as_string()

Returns the name as a string.

function print

void eosio::name::print() const

Prints an names as base32 encoded string

Parameters:

  • name to be printed

function name

constexpr eosio::name::name()

Construct a new name object defaulting to a value of 0.

Construct a new name

function name

explicit constexpr eosio::name::name(
    uint64_t v
)

Construct a new name object initialising value with v.

Construct a new name given a unit64_t value

Parameters:

  • v - The unit64_t value

function name

explicit constexpr eosio::name::name(
    name::raw r
)

Construct a new name object initialising value with r.

Construct a new name given a scoped enumerated type of raw (uint64_t).

Parameters:

  • r - The raw value which is a scoped enumerated type of unit64_t

function name

explicit constexpr eosio::name::name(
    std::string_view str
)

Construct a new name object initialising value with str.

Construct a new name given an string.

Parameters:

  • str - The string value which validated then converted to unit64_t

function length

constexpr uint8_t eosio::name::length() const

Returns the length of the name

function suffix

constexpr name eosio::name::suffix() const

Returns the suffix of the name

function operator raw

constexpr eosio::name::operator raw() const

Casts a name to raw

Returns:

Returns an instance of raw based on the value of a name

function operator bool

explicit constexpr eosio::name::operator bool() const

Explicit cast to bool of the uint64_t value of the name

Returns:

Returns true if the name is set to the default value of 0 else true.

function write_as_string

char* eosio::name::write_as_string(
    char * begin,
    char * end
) const

Writes the name as a string to the provided char buffer

Precondition:

Appropriate Size Precondition: (begin + 13) <= end and (begin + 13) does not overflow

Precondition:

Valid Memory Region Precondition: The range [begin, end) must be a valid range of memory to write to.

Parameters:

  • begin - The start of the char buffer
  • end - Just past the end of the char buffer

Returns:

char* - Just past the end of the last character written (returns begin if the Appropriate Size Precondition is not satisfied)

Post

If the Appropriate Size Precondition is satisfied, the range [begin, returned pointer) contains the string representation of the name.

function to_string

std::string eosio::name::to_string() const

Returns the name value as a string by calling write_as_string() and returning the buffer produced by write_as_string()

Returns the name as a string.

Public Static Functions Documentation

function char_to_value (1/2)

static static constexpr uint8_t eosio::name::char_to_value(
    char c
)

Converts a name Base32 symbol into its corresponding value

Parameters:

  • c - Character to be converted

Returns:

constexpr char - Converted value

function char_to_value

static static constexpr uint8_t eosio::name::char_to_value(
    char c
)

Converts a name Base32 symbol into its corresponding value

Parameters:

  • c - Character to be converted

Returns:

constexpr char - Converted value

Friends Documentation

friend operator<< (1/2)

template<typename DataStream>
DataStream& operator<<(
    DataStream & ds,
    const name & t
)

friend operator >> (1/2)

template<typename DataStream>
DataStream& operator >>(
    DataStream & ds,
    name & t
)

friend operator==

constexpr bool operator==(
    const name & a,
    const name & b
)

Equivalency operator. Returns true if a == b (are the same)

Returns:

boolean - true if both provided name values are the same

friend operator !=

constexpr bool operator !=(
    const name & a,
    const name & b
)

Inverted equivalency operator. Returns true if a != b (are different)

Returns:

boolean - true if both provided name values are not the same

friend operator<

constexpr bool operator<(
    const name & a,
    const name & b
)

Less than operator. Returns true if a < b.

Returns:

boolean - true if name a is less than b

friend operator<<

template<typename DataStream>
DataStream& operator<<(
    DataStream & ds,
    const name & t
)

friend operator >>

template<typename DataStream>
DataStream& operator >>(
    DataStream & ds,
    name & t
)

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