本文整理汇总了C++中fc::variant::get_object方法的典型用法代码示例。如果您正苦于以下问题:C++ variant::get_object方法的具体用法?C++ variant::get_object怎么用?C++ variant::get_object使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类fc::variant
的用法示例。
在下文中一共展示了variant::get_object方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: review_answer
void json_rpc_database_fixture::review_answer( fc::variant& answer, int64_t code, bool is_warning, bool is_fail, fc::optional< fc::variant > id )
{
fc::variant_object error;
int64_t answer_code;
if( is_fail )
{
if( id.valid() && code != JSON_RPC_INVALID_REQUEST )
{
BOOST_REQUIRE( answer.get_object().contains( "id" ) );
check_id_equal( answer[ "id" ], *id );
}
BOOST_REQUIRE( answer.get_object().contains( "error" ) );
BOOST_REQUIRE( answer["error"].is_object() );
error = answer["error"].get_object();
BOOST_REQUIRE( error.contains( "code" ) );
BOOST_REQUIRE( error["code"].is_int64() );
answer_code = error["code"].as_int64();
BOOST_REQUIRE( answer_code == code );
if( is_warning )
BOOST_TEST_MESSAGE( error["message"].as_string() );
}
else
{
BOOST_REQUIRE( answer.get_object().contains( "result" ) );
BOOST_REQUIRE( answer.get_object().contains( "id" ) );
if( id.valid() )
check_id_equal( answer[ "id" ], *id );
}
}
示例2: from_variant
virtual void from_variant( const fc::variant& in, bts::blockchain::operation& output )
{ try {
auto obj = in.get_object();
FC_ASSERT( output.type == OperationType::type );
output.data = fc::raw::pack( obj["data"].as<OperationType>() );
} FC_RETHROW_EXCEPTIONS( warn, "type: ${type}", ("type",fc::get_typename<OperationType>::name()) ) }
示例3: from_variant
void from_variant( const fc::variant& var, graphene::chain::extension<T>& value, uint32_t max_depth )
{
value = graphene::chain::extension<T>();
if( var.is_null() )
return;
if( var.is_array() )
{
FC_ASSERT( var.size() == 0 );
return;
}
graphene_extension_from_variant_visitor<T> vtor( var.get_object(), value.value, max_depth );
fc::reflector<T>::visit( vtor );
FC_ASSERT( vtor.count_left == 0 ); // unrecognized extension throws here
}
示例4:
static inline void from_variant( const fc::variant& v, T& o, uint32_t max_depth )
{
const variant_object& vo = v.get_object();
fc::reflector<T>::visit( from_variant_visitor<T>( vo, o, max_depth ) );
}
示例5:
static inline void from_variant( const fc::variant& v, T& o )
{
const variant_object& vo = v.get_object();
fc::reflector<T>::visit( from_variant_visitor<T>( vo, o ) );
}