various bug fixes

This commit is contained in:
Daniel Larimer 2012-11-09 01:36:23 -05:00
parent 5552477f45
commit 69114cabd7
3 changed files with 8 additions and 6 deletions

View file

@ -50,14 +50,14 @@ namespace fc { namespace json {
#define FC_JSON_NAMED_PARAMS( T ) \
namespace fc { namespace json {namespace detail { \
template<typename T> \
template<> \
struct named_param< fc::tuple<T> > { \
typedef fc::true_type type; \
static tuple<T> cast( const value& v ) { return make_tuple(fc::value_cast<T>(v)); } \
template<typename X> \
static value to_value( X&& x ) { return value( x.a0 ); }\
}; \
template<typename T> \
template<> \
struct named_param< fc::tuple<T&> > { \
typedef fc::true_type type; \
static tuple<T> cast( const value& v ) { return make_tuple(fc::value_cast<T>(v)); } \

View file

@ -96,7 +96,7 @@ namespace fc {
#define FC_STUB( CLASS, METHODS ) \
namespace fc { namespace detail { \
template<typename Transform> \
struct vtable<test,Transform> : public fc::retainable { \
struct vtable<CLASS,Transform> : public fc::retainable { \
vtable(){} \
BOOST_PP_SEQ_FOR_EACH( FC_STUB_VTABLE_DEFINE_MEMBER, CLASS, METHODS ) \
template<typename T, typename Visitor> \

View file

@ -11,10 +11,12 @@
#include <fc/utility.hpp>
#include <boost/preprocessor/seq/for_each.hpp>
#include <boost/preprocessor/seq/enum.hpp>
#include <boost/preprocessor/seq/size.hpp>
#include <boost/preprocessor/seq/seq.hpp>
#include <boost/preprocessor/stringize.hpp>
#include <stdint.h>
#include <fc/exception.hpp>
namespace fc {
@ -121,15 +123,15 @@ template<> struct reflector<ENUM> { \
switch( ENUM(i) ) { \
BOOST_PP_SEQ_FOR_EACH( FC_REFLECT_ENUM_TO_STRING, v, FIELDS ) \
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 ) { \
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) ); \
} \
}; \
} }
}