本文整理汇总了C++中rapidjson::GenericValue类的典型用法代码示例。如果您正苦于以下问题:C++ GenericValue类的具体用法?C++ GenericValue怎么用?C++ GenericValue使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了GenericValue类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: parseHstsPolicy
void Endpoint::parseHstsPolicy(const rapidjson::GenericValue<rapidjson::UTF8<char>,
rapidjson::MemoryPoolAllocator<rapidjson::CrtAllocator>>::ConstObject &obj, labsHstsPolicy_t &hstsPolicy) {
if (obj.HasMember("LONG_MAX_AGE") && obj["LONG_MAX_AGE"].IsInt64()) {
hstsPolicy.LONG_MAX_AGE = obj["LONG_MAX_AGE"].GetInt64();
}
if (obj.HasMember("header") && obj["header"].IsString()) {
hstsPolicy.Header.assign(obj["header"].GetString());
}
if (obj.HasMember("status") && obj["status"].IsString()) {
hstsPolicy.Status.assign(obj["status"].GetString());
}
if (obj.HasMember("maxAge") && obj["maxAge"].IsInt64()) {
hstsPolicy.MaxAge = obj["maxAge"].GetInt64();
}
if (obj.HasMember("directives") && obj["directives"].IsObject()) {
}
return;
}
示例2: JsonAddModel
void Model::JsonAddModel(rapidjson::GenericValue<rapidjson::UTF8<char>, rapidjson::MemoryPoolAllocator<rapidjson::CrtAllocator>> &data,ValueMap& model)
{
for (auto member = data.MemberonBegin(); member < data.MemberonEnd(); ++member)
{
auto name = member->name.GetString();
if(model[name].isNull())
{
if(member->value.IsInt())
{
model[name] = member->value.GetInt();
}
else if(member->value.IsString())
{
model[name] = member->value.GetString();
}
else if(member->value.IsBool())
{
model[name] = member->value.GetBool();
}
else if(member->value.IsDouble())
{
model[name] = member->value.GetDouble();
}
}
}
}
示例3: member_compare
bool
member_compare(const std::set<std::string>& members_,
const rapidjson::GenericValue<Encoding, Allocator>& v_)
{
if (v_.IsObject())
{
decltype(members_.size()) n = 0;
for (auto i = v_.MemberBegin(), e = v_.MemberEnd(); i != e; ++i)
{
const auto& name = i->name;
if (!name.IsString() ||
members_.find(
std::string(name.GetString(), name.GetStringLength())) ==
members_.end())
{
return false;
}
if (ExpectFullMatch)
{
++n;
}
}
return !ExpectFullMatch || n == members_.size();
}
else
{
return false;
}
}
示例4: has_members
bool has_members(std::set<std::string> members_,
const rapidjson::GenericValue<Encoding, Allocator>& v_)
{
if (v_.IsObject())
{
for (auto i = v_.MemberBegin(), e = v_.MemberEnd(); i != e; ++i)
{
const auto& name = i->name;
if (name.IsString())
{
const auto m = members_.find(
std::string(name.GetString(), name.GetStringLength()));
if (m != members_.end())
{
members_.erase(m);
if (members_.empty())
{
return true;
}
}
}
}
return members_.empty();
}
return false;
}
示例5: operator
void operator()(
rapidjson::GenericValue<Encoding, Allocator>& rja,
Allocator& alloc,
const Range& r
) const {
using namespace puddle;
rja.SetArray();
for(const auto& e : r) {
rapidjson::Value rje;
_comp(rje, alloc, e);
rja.PushBack(rje, alloc);
}
}
示例6: deserializeGetAccountAssets
bool JsonQueryFactory::deserializeGetAccountAssets(
rapidjson::GenericValue<rapidjson::UTF8<char>>::Object &obj_query,
protocol::Query &pb_query) {
if (not(obj_query.HasMember("account_id") &&
obj_query.HasMember("asset_id"))) {
log_->error("No account, asset id in json");
return false;
}
auto pb_get_account_assets = pb_query.mutable_get_account_assets();
pb_get_account_assets->set_account_id(
obj_query["account_id"].GetString());
pb_get_account_assets->set_asset_id(obj_query["asset_id"].GetString());
return true;
}
示例7: parseProtocosls
void Endpoint::parseProtocosls(const rapidjson::GenericValue<rapidjson::UTF8<char>,
rapidjson::MemoryPoolAllocator<rapidjson::CrtAllocator>>::ConstObject &obj, labsProtocol_t &labsProtocol) {
if (obj.HasMember("id") && obj["id"].IsInt()) {
labsProtocol.Id = obj["id"].GetInt();
}
if (obj.HasMember("name") && obj["name"].IsString()) {
labsProtocol.Name.assign(obj["name"].GetString());
}
if (obj.HasMember("version") && obj["version"].IsString()) {
labsProtocol.Version.assign(obj["version"].GetString());
}
}
示例8: getUserSkillList
vector<UserSkillInfo> UserSkill::createUserSkillDataFromJson(rapidjson::GenericValue<rapidjson::UTF8<char>, rapidjson::MemoryPoolAllocator<rapidjson::CrtAllocator>>& value)
{
vector<UserSkillInfo> vInfo;
vector<UserSkillInfo> pInfo;
UserSkillInfo info;
for (int i = 0; i < value.Size(); i++)
{
info.mst_skill_id = DataUtils::stringToFloat(value[i]["mst_skill_id"].GetString());
info.name = value[i]["name"].GetString();
info.skill_type = DataUtils::stringToFloat(value[i]["skill_type"].GetString());
info.mp_cost = DataUtils::stringToFloat(value[i]["mp_cost"].GetString());
info.cooldown_time = DataUtils::stringToFloat(value[i]["cooldown_time"].GetString());
info.range_type = DataUtils::stringToFloat(value[i]["range_type"].GetString());
info.range_distance = DataUtils::stringToFloat(value[i]["range_distance"].GetString());
info.multi_effect = DataUtils::stringToFloat(value[i]["multi_effect"].GetString());
info.target_type = DataUtils::stringToFloat(value[i]["target_type"].GetString());
info.effect_type = DataUtils::stringToFloat(value[i]["effect_type"].GetString());
info.buff_effect_type = DataUtils::stringToFloat(value[i]["buff_effect_type"].GetString());
info.duration = DataUtils::stringToFloat(value[i]["effect_duration"].GetString());
info.correct_type = DataUtils::stringToFloat(value[i]["correct_type"].GetString());
info.corrett_value = DataUtils::stringToFloat(value[i]["corrett_value"].GetString());
info.skill_des = value[i]["description"].GetString();
info.image_path = value[i]["image_path"].GetString();
info.skill_icon_path = value[i]["skill_icon_path"].GetString();
vInfo.push_back(info);
if (info.skill_type == 1) {
pInfo.push_back(info);
}
log("skill %d name: %s", i+1, value[i]["name"].GetString());
}
setUserSkillList(vInfo);
setPlayerSkillsList(pInfo);
return getUserSkillList();
}
示例9: parseLabsSuites
void Endpoint::parseLabsSuites(const rapidjson::GenericValue<rapidjson::UTF8<char>,
rapidjson::MemoryPoolAllocator<rapidjson::CrtAllocator>>::ConstObject &obj, labsSuites_t &labsSuites) {
if (obj.HasMember("preference") && obj["preference"].IsBool()) {
labsSuites.Preference = obj["preference"].GetBool();
}
if (obj.HasMember("list") && obj["list"].IsArray()) {
labsSuite_t labsSuite;
for (auto itr = obj["list"].GetArray().Begin(); itr != obj["list"].GetArray().End(); itr++) {
parseSuitesList(itr->GetObject(), labsSuite);
labsSuites.List.push_back(labsSuite);
}
}
}
示例10: parseChain
void Endpoint::parseChain(const rapidjson::GenericValue<rapidjson::UTF8<char>,
rapidjson::MemoryPoolAllocator<rapidjson::CrtAllocator>>::ConstObject &obj, labsChain_t &labsChain) {
if (obj.HasMember("issues") && obj["issues"].IsInt()) {
labsChain.Issues = obj["issues"].GetInt();
}
if (obj.HasMember("certs") && obj["certs"].IsArray()) {
labsChainCert_t labsChainCert;
for (auto itr = obj["certs"].GetArray().Begin(); itr != obj["certs"].GetArray().End(); itr++) {
parseChainCert(itr->GetObject(), labsChainCert);
labsChain.Certs.push_back(labsChainCert);
}
}
}
示例11: parseSuitesList
void Endpoint::parseSuitesList(const rapidjson::GenericValue<rapidjson::UTF8<char>,
rapidjson::MemoryPoolAllocator<rapidjson::CrtAllocator>>::ConstObject &obj, labsSuite_t &labsSuite) {
if (obj.HasMember("id") && obj["id"].IsInt()) {
labsSuite.Id = obj["id"].GetInt();
}
if (obj.HasMember("name") && obj["name"].IsString()) {
labsSuite.Name.assign(obj["name"].GetString());
}
if (obj.HasMember("cipherStrength") && obj["cipherStrength"].IsInt()) {
labsSuite.CipherStrength = obj["cipherStrength"].GetInt();
}
if (obj.HasMember("dhStrength") && obj["dhStrength"].IsInt()) {
labsSuite.DhStrength = obj["dhStrength"].GetInt();
}
if (obj.HasMember("dhP") && obj["dhP"].IsInt()) {
labsSuite.DhP = obj["dhP"].GetInt();
}
if (obj.HasMember("dhG") && obj["dhG"].IsInt()) {
labsSuite.DhG = obj["dhG"].GetInt();
}
if (obj.HasMember("dhYs") && obj["dhYs"].IsInt()) {
labsSuite.DhYs = obj["dhYs"].GetInt();
}
}
示例12: setExternValue
void PFMSceneryPreset::setExternValue(rapidjson::GenericValue<rapidjson::UTF8<>>& value,std::string key)
{
if(key == "route")
{
routeStrategy = value.GetString();
}
else if(key == "shoot")
{
shootStrategy = value.GetString();
}
else if(key == "composition")
{
compositionStrategy = value.GetString();
}
else if(key == "health")
{
health = value.GetDouble();
}
}
示例13: parseKey
void Endpoint::parseKey(const rapidjson::GenericValue<rapidjson::UTF8<char>,
rapidjson::MemoryPoolAllocator<rapidjson::CrtAllocator>>::ConstObject &obj, labsKey_t &labsKey) {
if (obj.HasMember("size") && obj["size"].IsInt()) {
labsKey.Size = obj["size"].GetInt();
}
if (obj.HasMember("alg") && obj["alg"].IsString()) {
labsKey.Algorithm.assign(obj["alg"].GetString());
}
if (obj.HasMember("debianFlaw") && obj["debianFlaw"].IsBool()) {
labsKey.DebianFlaw = obj["debianFlaw"].GetBool();
}
if (obj.HasMember("strength") && obj["strength"].IsInt()) {
labsKey.Strength = obj["strength"].GetInt();
}
}
示例14: parseSimulationClient
void Endpoint::parseSimulationClient(const rapidjson::GenericValue<rapidjson::UTF8<char>,
rapidjson::MemoryPoolAllocator<rapidjson::CrtAllocator>>::ConstObject &obj,
labsSimClient_t &labsSimClient) {
if (obj.HasMember("id") && obj["id"].IsInt()) {
labsSimClient.Id = obj["id"].GetInt();
}
if (obj.HasMember("name") && obj["name"].IsString()) {
labsSimClient.Name.assign(obj["name"].GetString());
}
if (obj.HasMember("version") && obj["version"].IsString()) {
labsSimClient.Version.assign(obj["version"].GetString());
}
if (obj.HasMember("isReference") && obj["isReference"].IsBool()) {
labsSimClient.IsReference = obj["isReference"].GetBool();
}
}
示例15: _compose_element
bool _compose_element(
rapidjson::GenericValue<Enc, Alloc>& rja,
Alloc& alloc,
const E& e,
const rapidjson_compositor<E>& comp
) const {
rapidjson::Value rje;
comp(rje, alloc, e);
rja.PushBack(rje, alloc);
return true;
}