7#include <unordered_map>
8#include <unordered_set>
17#include <boost/multi_index_container_fwd.hpp>
18#include <boost/multiprecision/cpp_int.hpp>
38 class mutable_variant_object;
42 template<
typename T>
struct safe;
50 template<
typename T,
typename... Args>
void to_variant(
const boost::multi_index_container<T,Args...>&
s,
fc::variant& v );
51 template<
typename T,
typename... Args>
void from_variant(
const fc::variant& v, boost::multi_index_container<T,Args...>&
s );
54 using UInt = boost::multiprecision::number<
55 boost::multiprecision::cpp_int_backend<Size, Size, boost::multiprecision::unsigned_magnitude, boost::multiprecision::unchecked, void> >;
57 using Int = boost::multiprecision::number<
58 boost::multiprecision::cpp_int_backend<Size, Size, boost::multiprecision::signed_magnitude, boost::multiprecision::unchecked, void> >;
110 template<
typename K,
typename T>
112 template<
typename K,
typename T>
115 template<
typename K,
typename T>
117 template<
typename K,
typename T>
119 template<
typename K,
typename T>
121 template<
typename K,
typename T>
135 template<
typename T,
typename...
U>
137 template<
typename T,
typename...
U>
145 template<
typename T, std::
size_t S>
147 template<
typename T, std::
size_t S>
161 #elif !defined(_MSC_VER)
174 template<
typename A,
typename B>
176 template<
typename A,
typename B>
247 virtual void handle(
const double& v )
const = 0;
248 virtual void handle(
const bool& v )
const = 0;
249 virtual void handle(
const string& v )
const = 0;
346 return *
this =
variant( fc::forward<T>(v) );
352 memset(
this, 0,
sizeof(*
this) );
353 if( v.has_value() ) *
this =
variant(*v);
366 char _type[
sizeof(
void*)];
394 if( var.
is_null() ) vo = std::optional<T>();
405 std::vector<fc::variant> vars(var.size());
407 for(
auto itr = var.begin(); itr != var.end(); ++itr, ++i )
417 vo.reserve( vars.size() );
418 for(
auto itr = vars.begin(); itr != vars.end(); ++itr )
419 vo.insert( itr->as<
T>() );
423 template<
typename K,
typename T>
427 std::vector< fc::variant > vars(var.size());
429 for(
auto itr = var.begin(); itr != var.end(); ++itr, ++i )
433 template<
typename K,
typename T>
439 for(
auto itr = vars.begin(); itr != vars.end(); ++itr )
440 vo.insert( itr->as< std::pair<K,T> >() );
443 template<
typename K,
typename T>
447 std::vector< fc::variant > vars(var.size());
449 for(
auto itr = var.begin(); itr != var.end(); ++itr, ++i )
453 template<
typename K,
typename T>
459 for(
auto itr = vars.begin(); itr != vars.end(); ++itr )
460 vo.insert( itr->as< std::pair<K,T> >() );
463 template<
typename K,
typename T>
467 std::vector< fc::variant > vars(var.size());
469 for(
auto itr = var.begin(); itr != var.end(); ++itr, ++i )
473 template<
typename K,
typename T>
479 for(
auto itr = vars.begin(); itr != vars.end(); ++itr )
480 vo.insert( itr->as< std::pair<K,T> >() );
488 std::vector<fc::variant> vars(var.size());
490 for(
auto itr = var.begin(); itr != var.end(); ++itr, ++i )
501 for(
auto itr = vars.begin(); itr != vars.end(); ++itr )
502 vo.insert( itr->as<
T>() );
512 for(
auto itr = vars.begin(); itr != vars.end(); ++itr )
513 tmp.push_back( itr->as<
T>() );
521 std::vector<fc::variant> vars(t.size());
522 for(
size_t i = 0; i < t.size(); ++i )
528 template<
typename T,
typename...
U>
534 d.resize( vars.size() );
535 for(
uint32_t i = 0; i < vars.size(); ++i ) {
541 template<
typename T,
typename...
U>
546 for(
size_t i = 0; i <
d.size(); ++i ) {
549 vo = std::move( vars );
559 tmp.reserve( vars.size() );
560 for(
auto itr = vars.begin(); itr != vars.end(); ++itr )
561 tmp.push_back( itr->as<
T>() );
569 std::vector<fc::variant> vars(t.size());
570 for(
size_t i = 0; i < t.size(); ++i )
576 template<
typename T, std::
size_t S>
580 for( std::size_t i = 0; i <
S; ++i )
581 tmp[i] = vars.at(i).as<
T>();
585 template<
typename T, std::
size_t S>
588 std::vector<fc::variant> vars(
S);
589 for( std::size_t i = 0; i <
S; ++i )
595 template<
typename A,
typename B>
598 std::vector<fc::variant> vars(2);
605 template<
typename A,
typename B>
609 if( vars.size() > 0 )
610 vars[0].as<
A>(
p.first );
611 if( vars.size() > 1 )
612 vars[1].as<
B>(
p.second );
618 memset(
this, 0,
sizeof(*
this) );
625 memset(
this, 0,
sizeof(*
this) );
642 if( var.
is_null() ) vo =
nullptr;
645 vo = std::make_shared<T>();
659 if( var.
is_null() ) vo.reset();
674 template<
typename T,
typename... Args>
void to_variant(
const boost::multi_index_container<T,Args...>& c,
fc::variant& v )
676 std::vector<fc::variant> vars;
677 vars.reserve( c.size() );
678 for(
const auto& item : c )
687 for(
const auto& item : vars )
688 c.insert( item.as<
T>() );
694 n = boost::multiprecision::number<T>(v.
get_string());
An order-preserving dictionary of variants.
virtual void handle(const blob &v) const =0
virtual void handle(const int64_t &v) const =0
virtual void handle(const string &v) const =0
virtual void handle(const bool &v) const =0
virtual void handle() const =0
handles null_type variants
virtual void handle(const double &v) const =0
virtual void handle(const variant_object &v) const =0
virtual void handle(const uint64_t &v) const =0
virtual void handle(const variants &v) const =0
An order-preserving dictionary of variants.
stores null, int64, uint64, double, bool, string, std::vector<variant>, and variant_object's.
variant & operator=(variant &&v)
variant_object & get_object()
variant & operator=(T &&v)
const string & get_string() const
void visit(const visitor &v) const
uint64_t as_uint64() const
variant(const std::optional< T > &v)
variant()
Constructs a null_type variant.
size_t estimated_size() const
const variant & operator[](const char *) const
bool operator<(const array< T, N > &a, const array< T, N > &b)
auto operator+(const fwd< T, S, A > &x, U &&u) -> typename detail::add< T, U >::type
auto operator-(const fwd< T, S, A > &x, U &&u) -> typename detail::sub< T, U >::type
bool operator!(const fc::variant &a)
bool operator>(const array< T, N > &a, const array< T, N > &b)
bool operator!=(const array< T, N > &a, const array< T, N > &b)
bool operator==(const array< T, N > &a, const array< T, N > &b)
std::vector< fc::variant > variants
fc::variant operator*(const fc::variant &a, const fc::variant &b)
boost::multiprecision::number< boost::multiprecision::cpp_int_backend< Size, Size, boost::multiprecision::unsigned_magnitude, boost::multiprecision::unchecked, void > > UInt
boost::multiprecision::number< boost::multiprecision::cpp_int_backend< Size, Size, boost::multiprecision::signed_magnitude, boost::multiprecision::unchecked, void > > Int
fc::variant operator/(const fc::variant &a, const fc::variant &b)
std::optional< variant > ovariant
void from_variant(const fc::variant &v, sysio::chain::chain_id_type &cid)
void to_variant(const sysio::chain::shared_public_key &var, fc::variant &vo)
decltype(nullptr) nullptr_t
sysio::time_point time_point
const GenericPointer< typename T::ValueType > T2 T::AllocatorType & a
#define S(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p)
#define T(meth, val, expected)
#define FC_REFLECT_TYPENAME(TYPE)
#define FC_REFLECT(TYPE, MEMBERS)
Specializes fc::reflector for TYPE.
#define FC_REFLECT_ENUM(ENUM, FIELDS)
unsigned __int64 uint64_t
#define MAX_NUM_ARRAY_ELEMENTS
memset(pInfo->slotDescription, ' ', 64)