key_object.hpp: Move address_or_key variant to header, reflect it

This commit is contained in:
theoreticalbts 2015-06-15 19:31:38 -04:00
parent e814c4dbeb
commit e934b9cf44
2 changed files with 4 additions and 3 deletions

View file

@ -22,6 +22,8 @@
#include <graphene/chain/types.hpp> #include <graphene/chain/types.hpp>
namespace graphene { namespace chain { namespace graphene { namespace chain {
typedef static_variant<address,public_key_type> address_or_key;
/** /**
* @class key_object * @class key_object
* @brief maps an ID to a public key or address * @brief maps an ID to a public key or address
@ -38,8 +40,9 @@ namespace graphene { namespace chain {
address key_address()const; address key_address()const;
const public_key_type& key()const { return key_data.get<public_key_type>(); } const public_key_type& key()const { return key_data.get<public_key_type>(); }
static_variant<address,public_key_type> key_data; address_or_key key_data;
}; };
} } } }
FC_REFLECT_TYPENAME( graphene::chain::address_or_key )
FC_REFLECT_DERIVED( graphene::chain::key_object, (graphene::db::object), (key_data) ) FC_REFLECT_DERIVED( graphene::chain::key_object, (graphene::db::object), (key_data) )

View file

@ -21,8 +21,6 @@
namespace graphene { namespace chain { namespace graphene { namespace chain {
address key_object::key_address()const address key_object::key_address()const
{ {
typedef static_variant<address,public_key_type> address_or_key;
switch( key_data.which() ) switch( key_data.which() )
{ {
case address_or_key::tag<address>::value: case address_or_key::tag<address>::value: