본문으로 건너뛰기

eosio::name

Module: Core API / Name

More...

#include <name.hpp>

Public Types

Name
enum class uint64_traw { }

Public Functions

Name
constexprname()
Construct a new name object defaulting to a value of 0.
constexprname(uint64_t v)
Construct a new name object initialising value with v.
constexprname(name::raw r)
Construct a new name object initialising value with r.
constexprname(std::string_view str)
Construct a new name object initialising value with str.
constexpr uint8_tlength() const
constexpr namesuffix() const
constexpr nameprefix() const
constexproperator raw() const
constexproperator bool() const
char *write_as_string(char begin, char end, bool dry_run =false) const
std::stringto_string() const
Returns the name value as a string by calling write_as_string() and returning the buffer produced by write_as_string()
voidprint() const
CDT_REFLECT(value )
constexpr uint8_tchar_to_value(char c)

Public Attributes

Name
uint64_tvalue

Detailed Description

struct eosio::name;

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

EnumeratorValueDescription

Public Functions Documentation

function name

inline constexpr name()

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

Construct a new name

function name

inline explicit constexpr name(
uint64_t v
)

Construct a new name object initialising value with v.

Parameters:

  • v - The unit64_t value

Construct a new name given a unit64_t value

function name

inline explicit constexpr name(
name::raw r
)

Construct a new name object initialising value with r.

Parameters:

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

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

function name

inline explicit constexpr name(
std::string_view str
)

Construct a new name object initialising value with str.

Parameters:

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

Construct a new name given an string.

function length

inline constexpr uint8_t length() const

Returns the length of the name

function suffix

inline constexpr name suffix() const

Returns the suffix of the name

function prefix

inline constexpr name prefix() const

Returns the prefix of the name

function operator raw

inline constexpr operator raw() const

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

Casts a name to raw

function operator bool

inline explicit constexpr operator bool() const

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

Explicit cast to bool of the uint64_t value of the name

function write_as_string

inline char * write_as_string(
char * begin,
char * end,
bool dry_run =false
) const

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.

Return: 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.)

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

Postcondition: 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 name. Nothing is written if dry_run == true or returned pointer > end (insufficient space) or if returned pointer < begin (overflow in calculating desired end).

Writes the name as a string to the provided char buffer

function to_string

inline 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()

Returns the name as a string.

function print

inline void print() const

Parameters:

  • name to be printed

Prints an names as base32 encoded string

function CDT_REFLECT

CDT_REFLECT(
value
)

function char_to_value

static inline constexpr uint8_t char_to_value(
char c
)

Parameters:

  • c - Character to be converted

Return: constexpr char - Converted value

Converts a name Base32 symbol into its corresponding value

Public Attributes Documentation

variable value

uint64_t value = 0;

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