当前位置: 首页>>代码示例>>C++>>正文


C++ variant::is_null方法代码示例

本文整理汇总了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
}
开发者ID:hoseadevops,项目名称:bitshares-core,代码行数:15,代码来源:ext.hpp

示例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()));
   }
}
开发者ID:sfinder,项目名称:graphene,代码行数:43,代码来源:ChainDataModel.cpp


注:本文中的fc::variant::is_null方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。