本文整理汇总了C++中rapidjson::Value::IsArray方法的典型用法代码示例。如果您正苦于以下问题:C++ Value::IsArray方法的具体用法?C++ Value::IsArray怎么用?C++ Value::IsArray使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类rapidjson::Value
的用法示例。
在下文中一共展示了Value::IsArray方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: addElemsToArray
void SuperastCPP::addElemsToArray(rapidjson::Value& parentValue,
rapidjson::Value& elemsValue) {
assert(parentValue.IsArray());
assert(elemsValue.IsArray());
for (unsigned i = 0; i < elemsValue.Size(); ++i) {
parentValue.PushBack(elemsValue[i], allocator);
}
}
示例2: detectFlg
// フラグの確認
bool GameEventHelper::detectFlg(rapidjson::Value& json, bool negative)
{
bool detection { false };
if (!json.IsArray())
{
// 自分自身のステータスを確認
detection = PlayerDataManager::getInstance()->getLocalData()->checkEventStatus(DungeonSceneManager::getInstance()->getLocation().map_id, DungeonSceneManager::getInstance()->getRunningEventId(), json.GetInt());
if(negative) detection = !detection;
}
else if (!json[0].IsArray())
{
detection = PlayerDataManager::getInstance()->getLocalData()->checkEventStatus(stoi(json[0].GetString()), stoi(json[1].GetString()), json[2].GetInt());
if(negative) detection = !detection;
}
else
{
// 複数の場合
for(int i { 0 }; i < json.Size(); i++)
{
detection = PlayerDataManager::getInstance()->getLocalData()->checkEventStatus(stoi(json[i][0].GetString()), stoi(json[i][1].GetString()), json[i][2].GetInt());
if(negative) detection = !detection;
if(!detection) break;
}
}
return detection;
}
示例3: parse
int32_t fetch_event_diff::parse(const rapidjson::Value& _node_event_data)
{
try
{
if (!_node_event_data.IsArray())
return wpie_error_parse_response;
for (auto iter = _node_event_data.Begin(), end = _node_event_data.End(); iter != end; ++iter)
{
std::string type;
const auto iter_type = iter->FindMember("type");
if (iter_type != iter->MemberEnd() && iter_type->value.IsString())
type = rapidjson_get_string(iter_type->value);
const auto iter_data = iter->FindMember("data");
if (iter_data != iter->MemberEnd() && iter_data->value.IsArray())
{
auto cl = std::make_shared<contactlist>();
cl->unserialize_from_diff(iter_data->value);
diff_->insert(std::make_pair(std::move(type), std::move(cl)));
}
}
}
catch (const std::exception&)
{
return wpie_error_parse_response;
}
return 0;
}
示例4: conversion_error
template<class OutputIterator> inline void
tws::core::copy_string_array(const rapidjson::Value& jvalues,
OutputIterator result)
{
if(!jvalues.IsArray())
throw conversion_error() << tws::error_description("copy_string_array: can only copy arrays of strings.");
if(jvalues.Empty())
return;
const rapidjson::SizeType nelements = jvalues.Size();
for(rapidjson::SizeType i = 0; i != nelements; ++i)
{
const rapidjson::Value& jelement = jvalues[i];
if(!jelement.IsString())
throw conversion_error() << tws::error_description("copy_string_array: only string elements are allowed in array.");
if(jelement.IsNull())
continue;
*result++ = jelement.GetString();
}
}
示例5: Parse
bool System::Parse(rapidjson::Value& node) {
if(node.IsArray()) {
for(auto sound_itr = node.Begin(); sound_itr != node.End(); sound_itr ++) {
if(sound_itr->IsObject()) {
auto& element = (*sound_itr);
std::shared_ptr<sound_info> sinfo = std::shared_ptr<sound_info>(new sound_info());
if(element.HasMember("id") && element["id"].IsString()) {
sinfo->id = element["id"].GetString();
}
if(element.HasMember("src") && element["src"].IsString()) {
sinfo->src = element["src"].GetString();
}
if(element.HasMember("loop") && element["loop"].IsBool()) {
sinfo->loop = element["loop"].GetBool();
}
if(element.HasMember("volume") && element["volume"].IsNumber()) {
sinfo->volume = element["volume"].GetDouble();
}
if(element.HasMember("spatial") && element["spatial"].IsBool()) {
sinfo->spatial = element["spatial"].GetBool();
}
// store sound info
sounds[sinfo->id] = sinfo;
}
}
}
return true;
}
示例6: values
void OptionParser::values(rapidjson::Value& arrayValue, std::vector<std::string>& var) {
if (!arrayValue.IsArray()) {
return;
}
for (int i = 0; i < arrayValue.Size(); i++) {
var.push_back(arrayValue[i].GetString());
}
}
示例7: ParseRange
bool JSASTNode::ParseRange(const rapidjson::Value& value)
{
assert(value.IsArray() && value.Size() == 2);
rangeStart_ = value[SizeType(0)].GetInt();
rangeEnd_ = value[SizeType(1)].GetInt();
return true;
}
示例8: node_set_flip
static void node_set_flip(cocos2d::Sprite *node, const rapidjson::Value &value)
{
if(value.IsArray() && value.Size() >= 2)
{
bool flipX, flipY;
value[0u] >> flipX;
value[1] >> flipY;
node->setFlipX(flipX);
node->setFlipY(flipY);
}
示例9: checkObjectExist_json
bool DictionaryHelper::checkObjectExist_json(const rapidjson::Value &root, int index)
{
bool bRet = false;
do {
CC_BREAK_IF(root.IsNull());
CC_BREAK_IF(!root.IsArray());
CC_BREAK_IF(index < 0 || root.Size() <= (unsigned int )index);
bRet = true;
} while (0);
return bRet;
}
示例10: JSONArrayToStringSet
void JSONArrayToStringSet(const rapidjson::Value& Obj, std::set<T>& Set)
{
Set.clear();
if (Obj.IsArray() && !Obj.Empty())
{
for (unsigned int i=0; i<Obj.Capacity(); i++)
{
if (Obj[i].IsString())
Set.insert(T(Obj[i].GetString()));
}
}
}
示例11: JSONArrayToStringVector
void JSONArrayToStringVector(const rapidjson::Value& Obj, std::vector<std::string>& Vector)
{
Vector.clear();
if (Obj.IsArray() && !Obj.Empty())
{
for (unsigned int i=0; i<Obj.Capacity(); i++)
{
if (Obj[i].IsString())
Vector.push_back(std::string(Obj[i].GetString()));
}
}
}
示例12: get_defines_source
std::string Effect_provider::get_defines_source(const rapidjson::Value& defines)
{
std::stringstream source;
if (defines.IsArray())
{
for (rapidjson::SizeType i = 0; i < defines.Size(); ++i)
{
source << "#define " << defines[i].GetString() << std::endl;
}
}
return source.str();
}
示例13: ParseStatementArray
bool JSASTNode::ParseStatementArray(const rapidjson::Value &value, Vector<JSASTStatement *> &statements)
{
assert(value.IsArray());
for (Value::ConstValueIterator itr = value.Begin(); itr != value.End(); itr++)
{
JSASTStatement* stmt = ParseStatement(*itr);
//assert(stmt);
statements.Push(stmt);
}
return true;
}
示例14:
Mat3x3f Deserialize_Mat3x3f(const rapidjson::Value& value)
{
Mat3x3f result;
assert(value.IsArray());
assert(value.Size() == 9);
for (unsigned i = 0; i < 9; ++i)
{
assert(value[i].IsNumber());
result[i] = value[i].GetFloat();
}
return result;
}
示例15: ParseExpressionArray
bool JSASTNode::ParseExpressionArray(const rapidjson::Value &value, Vector<JSASTExpression *> &expressions)
{
assert(value.IsArray());
for (Value::ConstValueIterator itr = value.Begin(); itr != value.End(); itr++)
{
JSASTExpression* expr = ParseExpression(*itr);
//assert(expr);
expressions.Push(expr);
}
return true;
}