From 0d55541682ab2637eb4c4c2c04d492e95dc9d364 Mon Sep 17 00:00:00 2001 From: theoreticalbts Date: Fri, 23 Oct 2015 14:49:13 -0400 Subject: [PATCH] object_id.hpp: Implement std::string() conversion for object_id_type --- libraries/db/include/graphene/db/object_id.hpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/libraries/db/include/graphene/db/object_id.hpp b/libraries/db/include/graphene/db/object_id.hpp index 6a3cf843..533534c8 100644 --- a/libraries/db/include/graphene/db/object_id.hpp +++ b/libraries/db/include/graphene/db/object_id.hpp @@ -83,6 +83,11 @@ namespace graphene { namespace db { return T( *this ); } + explicit operator std::string() const + { + return fc::to_string(space()) + "." + fc::to_string(type()) + "." + fc::to_string(instance()); + } + uint64_t number; }; @@ -173,8 +178,9 @@ struct reflector > inline void to_variant( const graphene::db::object_id_type& var, fc::variant& vo ) { - vo = fc::to_string(var.space()) + "." + fc::to_string(var.type()) + "." + fc::to_string(var.instance()); + vo = std::string( var ); } + inline void from_variant( const fc::variant& var, graphene::db::object_id_type& vo ) { try { vo.number = 0;