本文整理汇总了C++中rapidjson::Value::IsNull方法的典型用法代码示例。如果您正苦于以下问题:C++ Value::IsNull方法的具体用法?C++ Value::IsNull怎么用?C++ Value::IsNull使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类rapidjson::Value
的用法示例。
在下文中一共展示了Value::IsNull方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: name
SPGREchoSequence::SPGREchoSequence(const rapidjson::Value &json) {
if (json.IsNull())
QI::Fail("Could not read sequence: {}", name());
TR = GetMember(json, "TR").GetDouble();
TE = GetMember(json, "TE").GetDouble();
FA = ArrayFromJSON(json, "FA", M_PI / 180);
}
示例2: parse_error
tws::geoarray::spatial_extent_t
tws::geoarray::read_spatial_extent(const rapidjson::Value& jspatial_extent)
{
if(!jspatial_extent.IsObject() || jspatial_extent.IsNull())
throw tws::parse_error() << tws::error_description("error parsing spatial extent in metadata.");
spatial_extent_t sp_extent;
const rapidjson::Value& jextent = jspatial_extent["extent"];
sp_extent.extent = read_extent(jextent);
const rapidjson::Value& jres = jspatial_extent["resolution"];
sp_extent.resolution = read_spatial_resolution(jres);
//const rapidjson::Value& jcrs = jspatial_extent["crs"];
//if(!jcrs.IsString() || jcrs.IsNull())
//throw tws::parse_error() << tws::error_description("error in CRS in metadata.");
//std::string crs = jcrs.GetString();
//std::pair<std::string,unsigned int> crs_id = te::srs::SpatialReferenceSystemManager::getInstance().getIdFromP4Txt(crs);
const rapidjson::Value& jsrid = jspatial_extent["srid"];
if(!jsrid.IsInt() || jsrid.IsNull())
throw tws::parse_error() << tws::error_description("error reading geoarray srid.");
sp_extent.crs_code = jsrid.GetUint();
return sp_extent;
}
示例3: readFromValue
bool MultitypeVar::readFromValue(const rapidjson::Value& obj)
{
if (obj.IsNull())
{
mType = MultitypeNull;
}
else if (obj.IsBool())
{
mType = MultitypeBool;
mBool = obj.GetBool();
}
else if (obj.IsNumber())
{
mType = MultitypeNumber;
mNumber = obj.GetDouble();
}
else if (obj.IsString())
{
mType = MultitypeNumber;
mString = obj.GetString();
}
else
{
mType = MultitypeNull;
return false;
}
return true;
}
示例4: name
/*
* Regularly spaced sequence
*/
MultiEchoSequence::MultiEchoSequence(const rapidjson::Value &json) {
if (json.IsNull())
QI::Fail("Could not read sequence: {}", name());
TR = GetMember(json, "TR").GetDouble();
TE1 = GetMember(json, "TE1").GetDouble();
ESP = GetMember(json, "ESP").GetDouble();
ETL = GetMember(json, "ETL").GetInt();
TE = Eigen::ArrayXd::LinSpaced(ETL, TE1, TE1 + ESP * (ETL - 1));
}
示例5: checkObjectExist_json
bool DictionaryHelper::checkObjectExist_json(const rapidjson::Value &root)
{
bool bRet = false;
do {
CC_BREAK_IF(root.IsNull());
bRet = true;
} while (0);
return bRet;
}
示例6: getArrayCount_json
int DictionaryHelper::getArrayCount_json(const rapidjson::Value& root, const char* key, int def)
{
int nRet = def;
do {
CC_BREAK_IF(root.IsNull());
CC_BREAK_IF(root[key].IsNull());
nRet = (int)(root[key].Size());
} while (0);
return nRet;
}
示例7: getIntValue_json
int DictionaryHelper::getIntValue_json(const rapidjson::Value& root, const char* key, int def)
{
int nRet = def;
do {
CC_BREAK_IF(root.IsNull());
CC_BREAK_IF(root[key].IsNull());
nRet = root[key].GetInt();
} while (0);
return nRet;
}
示例8: getFloatValue_json
float DictionaryHelper::getFloatValue_json(const rapidjson::Value& root,const char* key, float def)
{
float fRet = def;
do {
CC_BREAK_IF(root.IsNull());
CC_BREAK_IF(root[key].IsNull());
fRet = (float)root[key].GetDouble();
} while (0);
return fRet;
}
示例9: getBooleanValue_json
bool DictionaryHelper::getBooleanValue_json(const rapidjson::Value& root,const char* key, bool def)
{
bool bRet = def;
do {
CC_BREAK_IF(root.IsNull());
CC_BREAK_IF(root[key].IsNull());
bRet = root[key].GetBool();
} while (0);
return bRet;
}
示例10: getFloatValueFromArray_json
float DictionaryHelper::getFloatValueFromArray_json(const rapidjson::Value& root,const char* arrayKey,int idx, float def)
{
float fRet = def;
do {
CC_BREAK_IF(root.IsNull());
CC_BREAK_IF(root[arrayKey].IsNull());
CC_BREAK_IF(root[arrayKey][idx].IsNull());
fRet = (float)root[arrayKey][idx].GetDouble();
} while (0);
return fRet;
}
示例11: getBoolValueFromArray_json
bool DictionaryHelper::getBoolValueFromArray_json(const rapidjson::Value& root,const char* arrayKey,int idx, bool def)
{
bool bRet = def;
do {
CC_BREAK_IF(root.IsNull());
CC_BREAK_IF(root[arrayKey].IsNull());
CC_BREAK_IF(root[arrayKey][idx].IsNull());
bRet = root[arrayKey][idx].GetBool();
} while (0);
return bRet;
}
示例12: getIntValueFromArray_json
int DictionaryHelper::getIntValueFromArray_json(const rapidjson::Value& root,const char* arrayKey,int idx, int def)
{
int nRet = def;
do {
CC_BREAK_IF(root.IsNull());
CC_BREAK_IF(!root.HasMember(arrayKey));
CC_BREAK_IF(root[arrayKey].IsNull());
CC_BREAK_IF(root[arrayKey][idx].IsNull());
nRet = root[arrayKey][idx].GetInt();
} while (0);
return nRet;
}
示例13: read_print_for_array
void Json_Parser::read_print_for_array(rapidjson::Value &va,int i){
if (va.IsBool()) {
const bool flag=va.GetBool();
CCLOG("%d:%d",i,flag);
}
else if (va.IsDouble()) {
const double flag=va.GetDouble();
CCLOG("%d:%f",i,flag);
}
else if (va.IsInt()) {
const int flag=va.GetInt();
CCLOG("%d:%d",i,flag);
}
else if (va.IsString()) {
const std::string flag=va.GetString();
CCLOG("%d:%s",i,flag.c_str());
}
else if (va.IsNull()) {
CCLOG("%d:null",i);
}
else if(va.IsObject())
{
CCLOG("obj----------%d",i);
auto it=va.MemberBegin();
for (;it!=va.MemberEnd();it++) {
if (va.HasMember(it->name)) {
read_print(va,it->name.GetString());
}
}
}
else if(va.IsArray())
{
CCLOG("array-------%d",i);
for (int i=0; i<va.Size();i++) {
read_print_for_array(va[i],i);
}
}
}
示例14: read_to_map_for_array
void Json_Parser::read_to_map_for_array(cocos2d::ValueVector &temp,rapidjson::Value &va,int i){
CCLOG("dex:%d",i);
if (va.IsBool()) {
const bool flag=va.GetBool();
temp.push_back(Value(flag));
}
else if (va.IsDouble()) {
const double flag=va.GetDouble();
temp.push_back(Value(flag));
}
else if (va.IsInt()) {
const int flag=va.GetInt();
temp.push_back(Value(flag));
}
else if (va.IsString()) {
const std::string flag=va.GetString();
temp.push_back(Value(flag));
// CCLOG("++:%d",temp.size());
}
else if (va.IsNull()) {
temp.push_back(Value(nullptr));
}
else if(va.IsObject())
{
cocos2d::ValueMap temp2;
auto it=va.MemberBegin();
for (;it!=va.MemberEnd();it++) {
if (va.HasMember(it->name)) {
read_to_map(temp2,va,it->name.GetString());
}
}
temp.push_back(Value(temp2));
// CCLOG("mapinvectro层:%lu",temp2.size());
}
else if(va.IsArray())
{
cocos2d::ValueVector temp2;
for (int i=0; i<va.Size();i++) {
read_to_map_for_array(temp2,va[i],i);
}
temp.push_back(Value(temp2));
// CCLOG("vectorinvectro层:%lu",temp.size());
}
}
示例15: getType
int JsonValidator::getType(rapidjson::Value& jsonValue) {
if (jsonValue.IsNull()) {
return kJsonTypeNull;
} else if (jsonValue.IsBool()) {
return kJsonTypeBoolean;
} else if (jsonValue.IsObject()) {
return kJsonTypeObject;
} else if (jsonValue.IsArray()) {
return kJsonTypeArray;
} else if (jsonValue.IsString()) {
return kJsonTypeString;
} else if (jsonValue.IsInt() || jsonValue.IsInt64() ||
jsonValue.IsUint() || jsonValue.IsUint64()) {
return kJsonTypeInteger;
} else if (jsonValue.IsDouble()) {
return kJsonTypeDouble;
} else {
return kJsonTypeUnknown;
}
}