FC Updates from BitShares and myself #21
2 changed files with 70 additions and 1 deletions
|
|
@ -2,10 +2,12 @@
|
|||
|
||||
#include <deque>
|
||||
#include <map>
|
||||
#include <set>
|
||||
#include <vector>
|
||||
|
||||
#include <fc/string.hpp>
|
||||
#include <fc/optional.hpp>
|
||||
#include <fc/smart_ref_fwd.hpp>
|
||||
|
||||
#include <fc/container/flat_fwd.hpp>
|
||||
#include <fc/container/deque_fwd.hpp>
|
||||
|
|
@ -69,10 +71,36 @@ namespace fc {
|
|||
return n.c_str();
|
||||
}
|
||||
};
|
||||
template<typename E> struct get_typename< std::set<E> >
|
||||
{
|
||||
static const char* name()
|
||||
{
|
||||
static std::string n = std::string("std::set<") + std::string(get_typename<E>::name()) + std::string(">");
|
||||
return n.c_str();
|
||||
}
|
||||
};
|
||||
template<typename A, typename B> struct get_typename< std::pair<A,B> >
|
||||
{
|
||||
static const char* name()
|
||||
{
|
||||
static std::string n = std::string("std::pair<") + get_typename<A>::name() + "," + get_typename<B>::name() + ">";
|
||||
return n.c_str();
|
||||
}
|
||||
};
|
||||
template<typename T> struct get_typename< fc::smart_ref<T> >
|
||||
{
|
||||
static const char* name()
|
||||
{
|
||||
static std::string n = std::string("fc::smart_ref<") + get_typename<T>::name() + std::string(">");
|
||||
return n.c_str();
|
||||
}
|
||||
};
|
||||
|
||||
struct signed_int;
|
||||
struct unsigned_int;
|
||||
struct variant_object;
|
||||
template<> struct get_typename<signed_int> { static const char* name() { return "signed_int"; } };
|
||||
template<> struct get_typename<unsigned_int> { static const char* name() { return "unsigned_int"; } };
|
||||
template<> struct get_typename<variant_object> { static const char* name() { return "fc::variant_object"; } };
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -382,5 +382,46 @@ public:
|
|||
s.visit( to_static_variant(ar[1], max_depth - 1) );
|
||||
}
|
||||
|
||||
template<typename... T> struct get_typename { static const char* name() { return typeid(static_variant<T...>).name(); } };
|
||||
template< typename... T > struct get_comma_separated_typenames;
|
||||
|
||||
template<>
|
||||
struct get_comma_separated_typenames<>
|
||||
{
|
||||
static const char* names() { return ""; }
|
||||
};
|
||||
|
||||
template< typename T >
|
||||
struct get_comma_separated_typenames<T>
|
||||
{
|
||||
static const char* names()
|
||||
{
|
||||
static const std::string n = get_typename<T>::name();
|
||||
return n.c_str();
|
||||
}
|
||||
};
|
||||
|
||||
template< typename T, typename... Ts >
|
||||
struct get_comma_separated_typenames<T, Ts...>
|
||||
{
|
||||
static const char* names()
|
||||
{
|
||||
static const std::string n =
|
||||
std::string( get_typename<T>::name() )+","+
|
||||
std::string( get_comma_separated_typenames< Ts... >::names() );
|
||||
return n.c_str();
|
||||
}
|
||||
};
|
||||
|
||||
template< typename... T >
|
||||
struct get_typename< static_variant< T... > >
|
||||
{
|
||||
static const char* name()
|
||||
{
|
||||
static const std::string n = std::string( "fc::static_variant<" )
|
||||
+ get_comma_separated_typenames<T...>::names()
|
||||
+ ">";
|
||||
return n.c_str();
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace fc
|
||||
|
|
|
|||
Loading…
Reference in a new issue