various bug fixes
This commit is contained in:
parent
5552477f45
commit
69114cabd7
3 changed files with 8 additions and 6 deletions
|
|
@ -50,14 +50,14 @@ namespace fc { namespace json {
|
||||||
|
|
||||||
#define FC_JSON_NAMED_PARAMS( T ) \
|
#define FC_JSON_NAMED_PARAMS( T ) \
|
||||||
namespace fc { namespace json {namespace detail { \
|
namespace fc { namespace json {namespace detail { \
|
||||||
template<typename T> \
|
template<> \
|
||||||
struct named_param< fc::tuple<T> > { \
|
struct named_param< fc::tuple<T> > { \
|
||||||
typedef fc::true_type type; \
|
typedef fc::true_type type; \
|
||||||
static tuple<T> cast( const value& v ) { return make_tuple(fc::value_cast<T>(v)); } \
|
static tuple<T> cast( const value& v ) { return make_tuple(fc::value_cast<T>(v)); } \
|
||||||
template<typename X> \
|
template<typename X> \
|
||||||
static value to_value( X&& x ) { return value( x.a0 ); }\
|
static value to_value( X&& x ) { return value( x.a0 ); }\
|
||||||
}; \
|
}; \
|
||||||
template<typename T> \
|
template<> \
|
||||||
struct named_param< fc::tuple<T&> > { \
|
struct named_param< fc::tuple<T&> > { \
|
||||||
typedef fc::true_type type; \
|
typedef fc::true_type type; \
|
||||||
static tuple<T> cast( const value& v ) { return make_tuple(fc::value_cast<T>(v)); } \
|
static tuple<T> cast( const value& v ) { return make_tuple(fc::value_cast<T>(v)); } \
|
||||||
|
|
|
||||||
|
|
@ -96,7 +96,7 @@ namespace fc {
|
||||||
#define FC_STUB( CLASS, METHODS ) \
|
#define FC_STUB( CLASS, METHODS ) \
|
||||||
namespace fc { namespace detail { \
|
namespace fc { namespace detail { \
|
||||||
template<typename Transform> \
|
template<typename Transform> \
|
||||||
struct vtable<test,Transform> : public fc::retainable { \
|
struct vtable<CLASS,Transform> : public fc::retainable { \
|
||||||
vtable(){} \
|
vtable(){} \
|
||||||
BOOST_PP_SEQ_FOR_EACH( FC_STUB_VTABLE_DEFINE_MEMBER, CLASS, METHODS ) \
|
BOOST_PP_SEQ_FOR_EACH( FC_STUB_VTABLE_DEFINE_MEMBER, CLASS, METHODS ) \
|
||||||
template<typename T, typename Visitor> \
|
template<typename T, typename Visitor> \
|
||||||
|
|
|
||||||
|
|
@ -11,10 +11,12 @@
|
||||||
#include <fc/utility.hpp>
|
#include <fc/utility.hpp>
|
||||||
#include <boost/preprocessor/seq/for_each.hpp>
|
#include <boost/preprocessor/seq/for_each.hpp>
|
||||||
#include <boost/preprocessor/seq/enum.hpp>
|
#include <boost/preprocessor/seq/enum.hpp>
|
||||||
|
#include <boost/preprocessor/seq/size.hpp>
|
||||||
#include <boost/preprocessor/seq/seq.hpp>
|
#include <boost/preprocessor/seq/seq.hpp>
|
||||||
#include <boost/preprocessor/stringize.hpp>
|
#include <boost/preprocessor/stringize.hpp>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
|
#include <fc/exception.hpp>
|
||||||
|
|
||||||
namespace fc {
|
namespace fc {
|
||||||
|
|
||||||
|
|
@ -121,15 +123,15 @@ template<> struct reflector<ENUM> { \
|
||||||
switch( ENUM(i) ) { \
|
switch( ENUM(i) ) { \
|
||||||
BOOST_PP_SEQ_FOR_EACH( FC_REFLECT_ENUM_TO_STRING, v, FIELDS ) \
|
BOOST_PP_SEQ_FOR_EACH( FC_REFLECT_ENUM_TO_STRING, v, FIELDS ) \
|
||||||
default: \
|
default: \
|
||||||
FC_REFLECT_THROW( fc::reflect::unknown_field(), "%1% not in enum '%2%'", %i %BOOST_PP_STRINGIZE(ENUM) ); \
|
FC_THROW_MSG( "Unknown field %s not in enum '%s'", i, BOOST_PP_STRINGIZE(ENUM) ); \
|
||||||
}\
|
}\
|
||||||
} \
|
} \
|
||||||
static ENUM from_string( const char* s ) { \
|
static ENUM from_string( const char* s ) { \
|
||||||
BOOST_PP_SEQ_FOR_EACH( FC_REFLECT_ENUM_FROM_STRING, v, FIELDS ) \
|
BOOST_PP_SEQ_FOR_EACH( FC_REFLECT_ENUM_FROM_STRING, v, FIELDS ) \
|
||||||
FC_REFLECT_THROW( fc::reflect::unknown_field(), "%1% in enum %2%", %s %BOOST_PP_STRINGIZE(ENUM) ); \
|
FC_THROW_MSG( "Unknown field %s not in enum '%s'", s, BOOST_PP_STRINGIZE(ENUM) ); \
|
||||||
} \
|
} \
|
||||||
}; \
|
}; \
|
||||||
} }
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue