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


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

本文整理汇总了C++中json::Value::is_null方法的典型用法代码示例。如果您正苦于以下问题:C++ Value::is_null方法的具体用法?C++ Value::is_null怎么用?C++ Value::is_null使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在json::Value的用法示例。


在下文中一共展示了Value::is_null方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: setError

void JsonRpcResponse::setError(const Error& error, const json::Value& clientInfo)
{
   // remove result
   response_.erase(kRpcResult);
   response_.erase(kRpcAsyncHandle);

   const boost::system::error_code& ec = error.code();
   
   if ( ec.category() == jsonRpcCategory() )
   {
      setError(ec);
   }
   else
   {
      // execution error
      json::Object jsonError ;
      copyErrorCodeToJsonError(errc::ExecutionError, &jsonError);
      
      // populate sub-error field with error details
      json::Object executionError;
      executionError["code"] = ec.value();
      std::string errorCategoryName = ec.category().name();
      executionError["category"] = errorCategoryName;
      std::string errorMessage = ec.message();
      executionError["message"] = errorMessage;
      jsonError["error"] = executionError;
      if (!clientInfo.is_null())
      {
         jsonError["client_info"] = clientInfo;
      }

      // set error
      setField(kRpcError, jsonError);
   }      
}
开发者ID:AlanCal,项目名称:rstudio,代码行数:35,代码来源:JsonRpc.cpp

示例2: pathFromProjectPath

std::string pathFromProjectPath(json::Value projPathJson)
{
   // no project
   projects::ProjectContext& projectContext = projects::projectContext();
   if (!projectContext.hasProject())
      return std::string();

   // no proj path
   std::string projPath = !projPathJson.is_null() ? projPathJson.get_str() :
                                                    std::string();
   if (projPath.empty())
      return std::string();

   // interpret path relative to project directory
   FilePath filePath = projectContext.directory().childPath(projPath);
   if (filePath.exists())
      return module_context::createAliasedPath(filePath);
   else
      return std::string();
}
开发者ID:foscoy,项目名称:rstudio,代码行数:20,代码来源:SessionSourceDatabase.cpp

示例3: create

SEXP create(const json::Value& value, Protect* pProtect)
{
   // call embedded create function based on type
   if (value.type() == json::StringType)
   {
      return create(value.get_str(), pProtect);
   }
   else if (value.type() == json::IntegerType)
   {
      return create(value.get_int(), pProtect);
   }
   else if (value.type() == json::RealType)
   {
      return create(value.get_real(), pProtect);
   }
   else if (value.type() == json::BooleanType)
   {
      return create(value.get_bool(), pProtect);
   }
   else if (value.type() == json::ArrayType)
   {
      return create(value.get_array(), pProtect);
   }
   else if (value.type() == json::ObjectType)
   {
      return create(value.get_obj(), pProtect);
   }
   else if (value.is_null())
   {
      return R_NilValue;
   }
   else
   {
      return R_NilValue;
   }
}
开发者ID:dreammaster38,项目名称:rstudio,代码行数:36,代码来源:RSexp.cpp


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