本文整理汇总了C++中fc::variant::is_null方法的典型用法代码示例。如果您正苦于以下问题:C++ variant::is_null方法的具体用法?C++ variant::is_null怎么用?C++ variant::is_null使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类fc::variant
的用法示例。
在下文中一共展示了variant::is_null方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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
}
示例2: processUpdatedObject
void ChainDataModel::processUpdatedObject(const fc::variant& update)
{
if (update.is_null())
return;
if (&fc::thread::current() == m_rpc_thread)
{
ilog("Proxying object update to app thread.");
Q_EMIT queueExecute([this,update]{processUpdatedObject(update);});
return;
}
idump((update));
try {
auto id = update.as<variant_object>()["id"].as<object_id_type>();
if (id.space() == protocol_ids) {
switch (id.type()) {
default:
wlog("Update procedure for ${update} is not yet implemented.", ("update", update));
break;
}
} else if (id.space() == implementation_ids) {
switch (id.type()) {
case impl_account_balance_object_type: {
account_balance_object balance = update.as<account_balance_object>();
auto owner = m_accounts.find(balance.owner.instance.value);
if (owner != m_accounts.end())
(*owner)->update(balance);
else
elog("Got unexpected balance update:\n${u}\nfor an account I don't have.",
("u", update));
break;
}
default:
wlog("Update procedure for ${update} is not yet implemented.", ("update", update));
break;
}
} else
wlog("Update procedure for ${update} is not yet implemented.", ("update", update));
} catch (const fc::exception& e) {
elog("Caught exception while updating object: ${e}", ("e", e.to_detail_string()));
}
}