Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
fc::crypto::base58str_visitor< Storage, Prefixes, DefaultPosition > Struct Template Reference

#include <common.hpp>

Inheritance diagram for fc::crypto::base58str_visitor< Storage, Prefixes, DefaultPosition >:
Collaboration diagram for fc::crypto::base58str_visitor< Storage, Prefixes, DefaultPosition >:

Public Member Functions

 base58str_visitor (const fc::yield_function_t &yield)
 
template<typename KeyType >
std::string operator() (const KeyType &key) const
 

Public Attributes

const fc::yield_function_t _yield
 

Detailed Description

template<typename Storage, const char *const * Prefixes, int DefaultPosition = -1>
struct fc::crypto::base58str_visitor< Storage, Prefixes, DefaultPosition >

Definition at line 89 of file common.hpp.

Constructor & Destructor Documentation

◆ base58str_visitor()

template<typename Storage , const char *const * Prefixes, int DefaultPosition = -1>
fc::crypto::base58str_visitor< Storage, Prefixes, DefaultPosition >::base58str_visitor ( const fc::yield_function_t & yield)
inlineexplicit

Definition at line 90 of file common.hpp.

91 : _yield(yield) {};
const fc::yield_function_t _yield
Definition common.hpp:114

Member Function Documentation

◆ operator()()

template<typename Storage , const char *const * Prefixes, int DefaultPosition = -1>
template<typename KeyType >
std::string fc::crypto::base58str_visitor< Storage, Prefixes, DefaultPosition >::operator() ( const KeyType & key) const
inline

Definition at line 93 of file common.hpp.

93 {
94 using data_type = typename KeyType::data_type;
95 constexpr int position = fc::get_index<Storage, KeyType>();
96 constexpr bool is_default = position == DefaultPosition;
97
98 checksummed_data<data_type> wrapper;
99 wrapper.data = key.serialize();
100 _yield();
101 wrapper.check = checksummed_data<data_type>::calculate_checksum(wrapper.data, !is_default ? Prefixes[position] : nullptr);
102 _yield();
103 auto packed = raw::pack( wrapper );
104 _yield();
105 auto data_str = to_base58( packed.data(), packed.size(), _yield );
106 _yield();
107 if (!is_default) {
108 data_str = string(Prefixes[position]) + "_" + data_str;
109 }
110 _yield();
111
112 return data_str;
113 }
void pack(Stream &s, const std::deque< T > &value)
Definition raw.hpp:531
std::string to_base58(const char *d, size_t s, const fc::yield_function_t &yield)
Definition base58.cpp:618
std::string string
Definition string.hpp:10
constexpr std::size_t get_index()
static auto calculate_checksum(const DataType &data, const char *prefix=nullptr)
Definition common.hpp:16
Here is the call graph for this function:

Member Data Documentation

◆ _yield

template<typename Storage , const char *const * Prefixes, int DefaultPosition = -1>
const fc::yield_function_t fc::crypto::base58str_visitor< Storage, Prefixes, DefaultPosition >::_yield

Definition at line 114 of file common.hpp.


The documentation for this struct was generated from the following file: