Skip to main content

eosio::symbol

Module: Core API / Symbol

More...

#include <symbol.hpp>

Public Functions

Name
constexprsymbol()
constexprsymbol(uint64_t raw)
constexprsymbol(symbol_code sc, uint8_t precision)
constexprsymbol(std::string_view ss, uint8_t precision)
constexpr boolis_valid() const
constexpr uint8_tprecision() const
constexpr symbol_codecode() const
constexpr uint64_traw() const
constexproperator bool() const
voidprint(bool show_precision =true) const

Friends

Name
constexpr friend booloperator==(const symbol & a, const symbol & b)
constexpr friend booloperator!=(const symbol & a, const symbol & b)
constexpr friend booloperator<(const symbol & a, const symbol & b)
Less than operator.

Detailed Description

class eosio::symbol;

Stores information about a symbol, the symbol can be 7 characters long.

Public Functions Documentation

function symbol

inline constexpr symbol()

Construct a new symbol object defaulting to a value of 0

function symbol

inline explicit constexpr symbol(
uint64_t raw
)

Parameters:

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

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

function symbol

inline constexpr symbol(
symbol_code sc,
uint8_t precision
)

Parameters:

  • sc - The symbol_code
  • precision - The number of decimal places used for the symbol

Construct a new symbol given a symbol_code and a uint8_t precision.

function symbol

inline constexpr symbol(
std::string_view ss,
uint8_t precision
)

Parameters:

  • ss - The string containing the symbol
  • precision - The number of decimal places used for the symbol

Construct a new symbol given a string and a uint8_t precision.

function is_valid

inline constexpr bool is_valid() const

Is this symbol valid

function precision

inline constexpr uint8_t precision() const

This symbol's precision

function code

inline constexpr symbol_code code() const

Returns representation of symbol name

function raw

inline constexpr uint64_t raw() const

Returns uint64_t repreresentation of the symbol

function operator bool

inline explicit constexpr operator bool() const

function print

inline void print(
bool show_precision =true
) const

Print the symbol

Friends

friend operator==

friend constexpr friend bool operator==(
const symbol & a,

const symbol & b
);

Return: boolean - true if both provided symbols are the same

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

friend operator!=

friend constexpr friend bool operator!=(
const symbol & a,

const symbol & b
);

Return: boolean - true if both provided symbols are not the same

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

friend operator<

friend constexpr friend bool operator<(
const symbol & a,

const symbol & b
);

Less than operator.

Return: boolean - true if symbol a is less than b

Less than operator. Returns true if a < b.


Updated on 2022-12-05 at 15:38:08 +0000