#include <symbol.hpp>
Definition at line 57 of file symbol.hpp.
◆ symbol() [1/2]
sysio::chain::symbol::symbol |
( |
uint8_t | p, |
|
|
const char * | s ) |
|
inlineexplicit |
Definition at line 62 of file symbol.hpp.
62 : m_value(string_to_symbol(
p,
s)) {
64 }
#define SYS_ASSERT(expr, exc_type, FORMAT,...)
◆ symbol() [2/2]
sysio::chain::symbol::symbol |
( |
uint64_t | v = CORE_SYMBOL | ) |
|
|
inlineexplicit |
◆ decimals()
uint8_t sysio::chain::symbol::decimals |
( |
| ) |
const |
|
inline |
Definition at line 93 of file symbol.hpp.
93{ return m_value & 0xFF; }
◆ from_string()
static symbol sysio::chain::symbol::from_string |
( |
const string & | from | ) |
|
|
inlinestatic |
Definition at line 68 of file symbol.hpp.
69 {
70 try {
72 SYS_ASSERT(!
s.empty(), symbol_type_exception,
"creating symbol from empty string");
73 auto comma_pos =
s.find(
',');
74 SYS_ASSERT(comma_pos != string::npos, symbol_type_exception,
"missing comma in symbol");
75 auto prec_part =
s.substr(0, comma_pos);
77 string name_part =
s.substr(comma_pos + 1);
79 return symbol(string_to_symbol(
p, name_part.c_str()));
81 }
static constexpr uint8_t max_precision
symbol(uint8_t p, const char *s)
#define FC_CAPTURE_LOG_AND_RETHROW(...)
fc::string trim(const fc::string &)
int64_t to_int64(const fc::string &)
◆ name()
string sysio::chain::symbol::name |
( |
| ) |
const |
|
inline |
Definition at line 104 of file symbol.hpp.
105 {
107 v >>= 8;
108 string result;
109 while (v > 0) {
110 char c = v & 0xFF;
111 result += c;
112 v >>= 8;
113 }
114 return result;
115 }
unsigned __int64 uint64_t
◆ operator string()
sysio::chain::symbol::operator string |
( |
| ) |
const |
|
inlineexplicit |
Definition at line 119 of file symbol.hpp.
120 {
127 }
fc::string to_string(double)
◆ precision()
uint64_t sysio::chain::symbol::precision |
( |
| ) |
const |
|
inline |
Definition at line 94 of file symbol.hpp.
95 {
101 }
102 return p10;
103 }
◆ reflector_init()
void sysio::chain::symbol::reflector_init |
( |
| ) |
const |
|
inline |
Definition at line 136 of file symbol.hpp.
136 {
139 }
static bool valid_name(const string &name)
◆ to_string()
string sysio::chain::symbol::to_string |
( |
| ) |
const |
|
inline |
◆ to_symbol_code()
symbol_code sysio::chain::symbol::to_symbol_code |
( |
| ) |
const |
|
inline |
Definition at line 117 of file symbol.hpp.
117{ return {m_value >> 8}; }
◆ valid()
bool sysio::chain::symbol::valid |
( |
| ) |
const |
|
inline |
◆ valid_name()
static bool sysio::chain::symbol::valid_name |
( |
const string & | name | ) |
|
|
inlinestatic |
Definition at line 88 of file symbol.hpp.
89 {
90 return all_of(
name.begin(),
name.end(), [](
char c)->bool { return (c >=
'A' && c <=
'Z'); });
91 }
◆ value()
uint64_t sysio::chain::symbol::value |
( |
| ) |
const |
|
inline |
◆ fc::reflector< symbol >
◆ operator<<
template<typename DataStream >
DataStream & operator<< |
( |
DataStream & | ds, |
|
|
const symbol & | s ) |
|
friend |
Definition at line 131 of file symbol.hpp.
132 {
133 return ds <<
s.to_string();
134 }
static const Segment ds(Segment::ds)
◆ max_precision
uint8_t sysio::chain::symbol::max_precision = 18 |
|
staticconstexpr |
The documentation for this class was generated from the following file: