示例#1
0
 static inline void from_variant( const fc::variant& v, T& o, uint32_t max_depth = 1 )
 { 
     if( v.is_string() )
        o = fc::reflector<T>::from_string( v.get_string().c_str() );
     else
        o = fc::reflector<T>::from_int( v.as_int64() );
 }
示例#2
0
文件: variant.hpp 项目: BitMoneta/fc
 static inline void from_variant( const fc::variant& v, T& o ) 
 { 
     if( v.is_string() )
        o = fc::reflector<T>::from_string( v.get_string().c_str() );
     else 
        o = static_cast<T>(v.as_int64());
 }
示例#3
0
void check_id_equal( const fc::variant& id_a, const fc::variant& id_b )
{
   BOOST_REQUIRE( id_a.get_type() == id_b.get_type() );

   switch( id_a.get_type() )
   {
      case fc::variant::int64_type:
         BOOST_REQUIRE( id_a.as_int64() == id_b.as_int64() );
         break;
      case fc::variant::uint64_type:
         BOOST_REQUIRE( id_a.as_uint64() == id_b.as_uint64() );
         break;
      case fc::variant::string_type:
         BOOST_REQUIRE( id_a.as_string() == id_b.as_string() );
         break;
      case fc::variant::null_type:
         break;
      default:
         BOOST_REQUIRE( false );
   }
}