From e2e1d43dd4df8777e53788598cc9f8fe3886ccac Mon Sep 17 00:00:00 2001 From: Daniel Larimer Date: Mon, 29 Jul 2013 00:25:16 -0400 Subject: [PATCH] fix enum_type to variant --- include/fc/io/enum_type.hpp | 31 +++++++++++-------------------- 1 file changed, 11 insertions(+), 20 deletions(-) diff --git a/include/fc/io/enum_type.hpp b/include/fc/io/enum_type.hpp index f6c737a..d731c6d 100644 --- a/include/fc/io/enum_type.hpp +++ b/include/fc/io/enum_type.hpp @@ -1,6 +1,7 @@ #pragma once #include #include +#include namespace fc @@ -26,28 +27,18 @@ namespace fc EnumType value; }; - /** reflects like an enum */ + template - struct reflector< enum_type > + void to_variant( const enum_type& var, variant& vo ) { - typedef EnumType type; - typedef fc::true_type is_defined; - typedef fc::true_type is_enum; - - template - static inline void visit( const Visitor& v ) - { - reflector::visit(v); - } - static const char* to_string(int64_t i) - { - return reflector::to_string(i); - } - static EnumType from_string(const char* s) - { - return reflector::from_string(s); - } - }; + vo = var.value; + } + template + void from_variant( const variant& var, enum_type& vo ) + { + vo.value = var.as(); + } + /** serializes like an IntType */ namespace raw