class eosio::symbol_code

Class List > eosio :: symbol_code

Stores the symbol code as a uint64_t value.

Public Functions

Type Name
constexpr symbol_code ()
Construct a new symbol_code object defaulting to a value of 0.
constexpr symbol_code (uint64_t raw)
Construct a new symbol_code object initialising value with raw.
constexpr symbol_code (std::string_view str)
Construct a new symbol_code object initialising value with str.
constexpr bool is_valid () const
constexpr uint32_t length () const
constexpr uint64_t raw () const
constexpr operator bool () const
char * write_as_string (char * begin, char * end, bool dry_run = false) const
Writes the symbol_code as a string to the provided char buffer.
std::string to_string () const
void print () const

Friends

Type Name
constexpr friend bool operator==
constexpr friend bool operator!=
constexpr friend bool operator<
Less than operator.

Public Functions Documentation

function symbol_code (1/3)

constexpr eosio::symbol_code::symbol_code()

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

Default constructor, construct a new symbol_code

function symbol_code (2/3)

explicit constexpr eosio::symbol_code::symbol_code(
    uint64_t raw
)

Construct a new symbol_code object initialising value with raw.

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

Parameters:

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

function symbol_code (3/3)

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

Construct a new symbol_code object initialising value with str.

Construct a new symbol_code given an string.

Parameters:

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

function is_valid

constexpr bool eosio::symbol_code::is_valid() const

Checks if the symbol code is valid

Returns:

true - if symbol is valid

function length

constexpr uint32_t eosio::symbol_code::length() const

Returns the character length of the provided symbol

Returns:

length - character length of the provided symbol

function raw

constexpr uint64_t eosio::symbol_code::raw() const

Casts a symbol code to raw

Returns:

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

function operator bool

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

Explicit cast to bool of the symbol_code

Returns:

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

function write_as_string

char* eosio::symbol_code::write_as_string(
    char * begin,
    char * end,
    bool dry_run = false
) const

Writes the symbol_code as a string to the provided char buffer.

Writes the symbol_code as a string to the provided char buffer

Precondition:

is_valid() == true

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
  • dry_run - If true, do not actually write anything into the range.

Returns:

char* - Just past the end of the last character that would be written assuming dry_run == false and end was large enough to provide sufficient space. (Meaning only applies if returned pointer >= begin.)

Post

If the output string fits within the range [begin, end) and dry_run == false, the range [begin, returned pointer) contains the string representation of the symbol_code. Nothing is written if dry_run == true or returned pointer > end (insufficient space) or if returned pointer < begin (overflow in calculating desired end).

function to_string

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

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

function print

void eosio::symbol_code::print() const

Prints a symbol_code

Parameters:

  • sym_code symbol code to be printed

Friends Documentation

friend operator==

constexpr friend bool operator==(
    const symbol_code & a,
    const symbol_code & b
)

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

Returns:

boolean - true if both provided symbol_codes are the same

friend operator!=

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

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

Returns:

boolean - true if both provided symbol_codes are not the same

friend operator<

constexpr friend bool operator<(
    const symbol_code & a,
    const symbol_code & b
)

Less than operator.

Less than operator. Returns true if a < b.

Returns:

boolean - true if symbol_code a is less than b


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