From 9d383077fa754fb872184526c2d5b9ba04708c86 Mon Sep 17 00:00:00 2001 From: Vikram Rajkumar Date: Fri, 13 Jan 2017 13:35:48 -0600 Subject: [PATCH] Revert "change json seralization of map to be object rather than array of pairs" This reverts commit a421e280488385cab26a42153f7ce3c8d5b6281f. --- include/fc/variant.hpp | 9 --------- include/fc/variant_object.hpp | 36 ----------------------------------- src/rpc/websocket_api.cpp | 1 - src/variant_object.cpp | 1 - 4 files changed, 47 deletions(-) diff --git a/include/fc/variant.hpp b/include/fc/variant.hpp index ccb2960..092de0a 100644 --- a/include/fc/variant.hpp +++ b/include/fc/variant.hpp @@ -93,17 +93,10 @@ namespace fc template void from_variant( const variant& var, fc::flat_map& vo ); - template - void to_variant( const std::map& var, variant& vo ); - template - void from_variant( const variant& var, std::map& vo ); - template void to_variant( const std::map& var, variant& vo ); template void from_variant( const variant& var, std::map& vo ); - - template void to_variant( const std::multimap& var, variant& vo ); template @@ -414,8 +407,6 @@ namespace fc vo.insert( itr->as< std::pair >() ); } - - template void to_variant( const std::map& var, variant& vo ) { diff --git a/include/fc/variant_object.hpp b/include/fc/variant_object.hpp index 99b0d86..5a39c80 100644 --- a/include/fc/variant_object.hpp +++ b/include/fc/variant_object.hpp @@ -5,7 +5,6 @@ namespace fc { - using std::map; class mutable_variant_object; /** @@ -67,15 +66,6 @@ namespace fc /** initializes the first key/value pair in the object */ variant_object( string key, variant val ); - - template - variant_object( const map& values ) - :_key_value( new std::vector() ) { - _key_value->reserve( values.size() ); - for( const auto& item : values ) { - _key_value->emplace_back( entry( item.first, fc::variant(item.second) ) ); - } - } template variant_object( string key, T&& val ) @@ -206,15 +196,6 @@ namespace fc mutable_variant_object(); - template - mutable_variant_object( const map& values ) - :_key_value( new std::vector() ) { - _key_value->reserve( values.size() ); - for( const auto& item : values ) { - _key_value->emplace_back( variant_object::entry( item.first, fc::variant(item.second) ) ); - } - } - /** initializes the first key/value pair in the object */ mutable_variant_object( string key, variant val ); template @@ -231,8 +212,6 @@ namespace fc mutable_variant_object& operator=( mutable_variant_object&& ); mutable_variant_object& operator=( const mutable_variant_object& ); mutable_variant_object& operator=( const variant_object& ); - - private: std::unique_ptr< std::vector< entry > > _key_value; friend class variant_object; @@ -242,19 +221,4 @@ namespace fc /** @ingroup Serializable */ void from_variant( const variant& var, mutable_variant_object& vo ); - template - void to_variant( const std::map& var, variant& vo ) - { - vo = variant_object( var ); - } - - template - void from_variant( const variant& var, std::map& vo ) - { - const auto& obj = var.get_object(); - vo.clear(); - for( auto itr = obj.begin(); itr != obj.end(); ++itr ) - vo[itr->key()] = itr->value().as(); - } - } // namespace fc diff --git a/src/rpc/websocket_api.cpp b/src/rpc/websocket_api.cpp index 0ff9304..6342b6f 100644 --- a/src/rpc/websocket_api.cpp +++ b/src/rpc/websocket_api.cpp @@ -85,7 +85,6 @@ std::string websocket_api_connection::on_message( const std::string& message, bool send_message /* = true */ ) { - wdump((message)); try { auto var = fc::json::from_string(message); diff --git a/src/variant_object.cpp b/src/variant_object.cpp index 38851b0..6f3b1dc 100644 --- a/src/variant_object.cpp +++ b/src/variant_object.cpp @@ -163,7 +163,6 @@ namespace fc return *this; } - void to_variant( const variant_object& var, variant& vo ) { vo = variant(var);