本文整理汇总了C++中rapidjson::Value::MemberEnd方法的典型用法代码示例。如果您正苦于以下问题:C++ Value::MemberEnd方法的具体用法?C++ Value::MemberEnd怎么用?C++ Value::MemberEnd使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类rapidjson::Value
的用法示例。
在下文中一共展示了Value::MemberEnd方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
int32_t core::wim::phone_login::parse_response_data(const rapidjson::Value& _data)
{
int32_t err = wpie_http_parse_response;
try
{
auto iter_phone_verified = _data.FindMember("phone_verified");
if (iter_phone_verified == _data.MemberEnd() || !iter_phone_verified->value.IsBool())
return wpie_http_parse_response;
if (!iter_phone_verified->value.GetBool())
return wpie_phone_not_verified;
auto iter_session_key = _data.FindMember("sessionKey");
if (iter_session_key == _data.MemberEnd() || !iter_session_key->value.IsString())
return wpie_http_parse_response;
session_key_ = iter_session_key->value.GetString();
auto iter_host_time = _data.FindMember("hostTime");
if (iter_host_time == _data.MemberEnd() || !iter_host_time->value.IsUint())
return wpie_http_parse_response;
host_time_ = iter_host_time->value.GetUint();
auto iter_token = _data.FindMember("token");
if (iter_token == _data.MemberEnd() || !iter_token->value.IsObject())
return wpie_http_parse_response;
auto iter_expired_in = iter_token->value.FindMember("expiresIn");
auto iter_a = iter_token->value.FindMember("a");
if (iter_expired_in == iter_token->value.MemberEnd() || iter_a == iter_token->value.MemberEnd() ||
!iter_expired_in->value.IsUint() || !iter_a->value.IsString())
return wpie_http_parse_response;
expired_in_ = iter_expired_in->value.GetUint();
a_token_ = iter_a->value.GetString();
time_offset_ = std::chrono::system_clock::to_time_t(std::chrono::system_clock::now()) - host_time_;
err = 0;
}
catch (const std::exception&)
{
}
return err;
}
示例2:
int32_t core::wim::validate_phone::parse_response_data(const rapidjson::Value& _data)
{
auto iter_trans_id = _data.FindMember("trans_id");
if (iter_trans_id == _data.MemberEnd() || !iter_trans_id->value.IsString())
return wpie_http_parse_response;
trans_id_ = iter_trans_id->value.GetString();
auto iter_existing = _data.FindMember("existring");
if (iter_existing != _data.MemberEnd() && iter_existing->value.IsInt())
existing_ = !!iter_existing->value.GetInt();
return 0;
}
示例3: unserialize
bool search_contacts_response::unserialize(const rapidjson::Value& _node)
{
{ auto i = _node.FindMember("finish"); if (i != _node.MemberEnd() && i->value.IsBool()) finish_ = i->value.GetBool(); }
{ auto i = _node.FindMember("newTag"); if (i != _node.MemberEnd() && i->value.IsString()) next_tag_ = rapidjson_get_string(i->value); }
return unserialize_contacts(_node) && unserialize_chats(_node);
}
示例4: GetVectorFromJSON
bool GetVectorFromJSON(const rapidjson::Value& inObject, const char* inProperty, Vector3& outVector)
{
auto itr = inObject.FindMember(inProperty);
if (itr == inObject.MemberEnd())
{
return false;
}
auto& property = itr->value;
if (!property.IsArray() || property.Size() != 3)
{
return false;
}
for (rapidjson::SizeType i = 0; i < 3; i++)
{
if (!property[i].IsDouble())
{
return false;
}
}
outVector.x = property[0].GetDouble();
outVector.y = property[1].GetDouble();
outVector.z = property[2].GetDouble();
return true;
}
示例5: GetQuaternionFromJSON
bool GetQuaternionFromJSON(const rapidjson::Value& inObject, const char* inProperty, Quaternion& outQuat)
{
auto itr = inObject.FindMember(inProperty);
if (itr == inObject.MemberEnd())
{
return false;
}
auto& property = itr->value;
for (rapidjson::SizeType i = 0; i < 4; i++)
{
if (!property[i].IsDouble())
{
return false;
}
}
outQuat.x = property[0].GetDouble();
outQuat.y = property[1].GetDouble();
outQuat.z = property[2].GetDouble();
outQuat.w = property[3].GetDouble();
return true;
}
示例6: Parse
bool JSASTNode::Parse(const rapidjson::Value& value)
{
assert(value.IsObject());
for (Value::ConstMemberIterator itr = value.MemberBegin();
itr != value.MemberEnd(); ++itr)
{
String name = itr->name.GetString();
if (name == "loc")
{
ParseLoc(itr->value);
}
else if (name == "type")
{
// TODO: Verify type
}
else if (name == "range")
{
ParseRange(itr->value);
}
}
return true;
}
示例7: JSONObjectToDetailedWares
void JSONObjectToDetailedWares(const rapidjson::Value& Obj,
FluidHubAPIClient::WaresDetailsByID_t& WMap)
{
WMap.clear();
if (Obj.IsObject())
{
for (rapidjson::Value::ConstMemberIterator it = Obj.MemberBegin(); it != Obj.MemberEnd(); ++it)
{
if (it->value.IsObject())
{
std::string WareID = it->name.GetString();
WMap[WareID] = FluidHubAPIClient::WareDetailedDescription();
rapidjson::Value::ConstMemberIterator itMember = it->value.FindMember("shortdesc");
if (itMember != it->value.MemberEnd() && itMember->value.IsString())
{
WMap[WareID].ShortDescription = std::string(itMember->value.GetString());
}
itMember = it->value.FindMember("git-url");
if (itMember != it->value.MemberEnd() && itMember->value.IsString())
{
WMap[WareID].GitUrl = std::string(itMember->value.GetString());
}
itMember = it->value.FindMember("git-branches");
if (itMember != it->value.MemberEnd() && itMember->value.IsArray())
{
JSONArrayToStringVector(itMember->value,WMap[WareID].GitBranches);
}
itMember = it->value.FindMember("issues-counts");
if (itMember != it->value.MemberEnd() && itMember->value.IsObject())
{
for (rapidjson::Value::ConstMemberIterator itCounters = itMember->value.MemberBegin();
itCounters != itMember->value.MemberEnd();
++itCounters)
{
if (itCounters->value.IsInt())
WMap[WareID].IssuesCounters[itCounters->name.GetString()] = itCounters->value.GetInt();
}
}
itMember = it->value.FindMember("users-ro");
if (itMember != it->value.MemberEnd() && itMember->value.IsArray())
{
JSONArrayToStringSet(itMember->value,WMap[WareID].ROUsers);
}
itMember = it->value.FindMember("users-rw");
if (itMember != it->value.MemberEnd() && itMember->value.IsArray())
{
JSONArrayToStringSet(itMember->value,WMap[WareID].RWUsers);
}
}
}
}
}
示例8: OnPing
QueryError OnPing(const rapidjson::Value &p_Args, std::string *p_Result)
{
// Get the "address" argument
auto s_AddressValue = p_Args.FindMember("address");
if (s_AddressValue == p_Args.MemberEnd() || !s_AddressValue->value.IsString())
{
*p_Result = "Bad query: An \"address\" argument is required and must be a string";
return QueryError_BadQuery;
}
// Parse it
Blam::Network::NetworkAddress blamAddress;
if (!Blam::Network::NetworkAddress::Parse(s_AddressValue->value.GetString(), 11774, &blamAddress))
{
*p_Result = "Invalid argument: The \"address\" argument is not a valid IP address.";
return QueryError_InvalidArgument;
}
// Register our ping handler if it isn't already
if (!PingHandlerRegistered)
{
PingId = Patches::Network::OnPong(PongReceived);
PingHandlerRegistered = true;
}
// Send a ping message
auto session = Blam::Network::GetActiveSession();
if (!session || !session->Gateway->Ping(blamAddress, PingId))
{
*p_Result = "Network error: Failed to send ping";
return QueryError_NetworkError;
}
return QueryError_Ok;
}
示例9: parse_top
std::size_t GeoJSONFileParser::parse_top(const rapidjson::Value& top) {
const auto json_geometry = top.FindMember("geometry");
if (json_geometry == top.MemberEnd()) {
error("Missing 'geometry' name.");
}
if (!json_geometry->value.IsObject()) {
error("Expected 'geometry' value to be an object.");
}
std::string geometry_type{get_value_as_string(json_geometry->value, "type")};
if (geometry_type.empty()) {
error("Missing 'geometry.type'.");
}
if (geometry_type != "Polygon" && geometry_type != "MultiPolygon") {
error("Expected 'geometry.type' value to be 'Polygon' or 'MultiPolygon'.");
}
const auto json_coordinates = json_geometry->value.FindMember("coordinates");
if (json_coordinates == json_geometry->value.MemberEnd()) {
error("Missing 'coordinates' name in 'geometry' object.");
}
if (!json_coordinates->value.IsArray()) {
error("Expected 'geometry.coordinates' value to be an array.");
}
if (geometry_type == "Polygon") {
return parse_polygon_array(json_coordinates->value, m_buffer);
}
return parse_multipolygon_array(json_coordinates->value, m_buffer);
}
示例10: parse
int32_t fetch_event_typing::parse(const rapidjson::Value& _node_event_data)
{
const auto it_status = _node_event_data.FindMember("typingStatus");
if (it_status != _node_event_data.MemberEnd() && it_status->value.IsString())
{
std::string status = it_status->value.GetString();
is_typing_ = (status == "typing");
}
const auto it_aimid = _node_event_data.FindMember("aimId");
if (it_aimid != _node_event_data.MemberEnd() && it_aimid->value.IsString())
{
aimid_ = it_aimid->value.GetString();
}
else
{
return -1;
}
const auto it_attr = _node_event_data.FindMember("MChat_Attrs");
if (it_attr != _node_event_data.MemberEnd() && it_attr->value.IsObject())
{
const auto itsender = it_attr->value.FindMember("sender");
if (itsender != it_attr->value.MemberEnd() && itsender->value.IsString())
{
chatter_aimid_ = itsender->value.GetString();
}
const auto itoptions = it_attr->value.FindMember("options");
if (itoptions != it_attr->value.MemberEnd() && itoptions->value.IsObject())
{
const auto itname = itoptions->value.FindMember("senderName");
if (itname != itoptions->value.MemberEnd() && itname->value.IsString())
{
chatter_name_ = itname->value.GetString();
}
}
}
return 0;
}
示例11: parseState
void parseState(const std::string& tag, const rapidjson::Value& button, std::unordered_map<std::string, TexturePtr>& stateMap) {
for (auto it = button.MemberBegin(); it != button.MemberEnd(); it++) {
std::string name = it->name.GetString();
const rapidjson::Value& value = it->value;
TexturePtr texture(GCC_NEW Texture(tag, value["x"].GetDouble(), value["y"].GetDouble(), value["w"].GetDouble(), value["h"].GetDouble()));
stateMap.emplace(name, texture);
}
}
示例12: applyConfigToView
void Inspector::applyConfigToView(const rapidjson::Value &config)
{
for(rapidjson::Value::ConstMemberIterator it = config.MemberBegin();
it != config.MemberEnd(); ++it)
{
setTargetProperty(it->name.GetString(), it->value);
}
}
示例13: assert
name_t::name_t(const rapidjson::Value &json_value) {
auto last_iter = json_value.FindMember("last");
if ( last_iter != json_value.MemberEnd() ) {
assert(last_iter->value.IsString());
last = last_iter->value.GetString();
}
auto first_iter = json_value.FindMember("first");
if ( first_iter != json_value.MemberEnd() ) {
assert(first_iter->value.IsString());
first = first_iter->value.GetString();
}
}
示例14: parse
int32_t fetch_event_imstate::parse(const rapidjson::Value& _node_event_data)
{
auto iter_imstates = _node_event_data.FindMember("imStates");
if (iter_imstates == _node_event_data.MemberEnd() || !iter_imstates->value.IsArray())
return wpie_error_parse_response;
for (auto iter_state = iter_imstates->value.Begin(); iter_state != iter_imstates->value.End(); ++iter_state)
{
imstate ustate;
auto iter_request_id = iter_state->FindMember("sendReqId");
if (iter_request_id == iter_state->MemberEnd() || !iter_request_id->value.IsString())
continue;
ustate.set_request_id(rapidjson_get_string(iter_request_id->value));
auto iter_msg_id = iter_state->FindMember("msgId");
if (iter_msg_id == iter_state->MemberEnd() || !iter_msg_id->value.IsString())
continue;
ustate.set_msg_id(rapidjson_get_string(iter_msg_id->value));
auto iter_state_state = iter_state->FindMember("state");
if (iter_state_state == iter_state->MemberEnd() || !iter_state_state->value.IsString())
continue;
const std::string state = rapidjson_get_string(iter_state_state->value);
if (state == "failed")
ustate.set_state(imstate_sent_state::failed);
else if (state == "sent")
ustate.set_state(imstate_sent_state::sent);
else if (state == "delivered")
ustate.set_state(imstate_sent_state::delivered);
auto iter_hist_msg_id = iter_state->FindMember("histMsgId");
if (iter_hist_msg_id != iter_state->MemberEnd() && iter_hist_msg_id->value.IsInt64())
{
ustate.set_hist_msg_id(iter_hist_msg_id->value.GetInt64());
}
auto iter_before_hist_msg_id = iter_state->FindMember("beforeHistMsgId");
if (iter_before_hist_msg_id != iter_state->MemberEnd() && iter_before_hist_msg_id->value.IsInt64())
{
ustate.set_before_hist_msg_id(iter_before_hist_msg_id->value.GetInt64());
}
auto iter_error_code = iter_state->FindMember("errorCode");
if (iter_error_code != iter_state->MemberEnd() && iter_error_code->value.IsInt())
{
ustate.set_error_code(iter_error_code->value.GetInt());
}
states_.push_back(ustate);
}
return 0;
}
示例15: set_geometry
/*!
Sets box geometry from given rapidjson object.
Given object must have "start" and "end" items
and both must be arrays of 3 numbers.
*/
void set_geometry(const rapidjson::Value& object)
{
const auto& obj_start_i = object.FindMember("start");
if (obj_start_i == object.MemberEnd()) {
throw std::invalid_argument(__FILE__ ": Given object doesn't have a start item.");
}
const auto& obj_start = obj_start_i->value;
if (not obj_start.IsArray()) {
throw std::invalid_argument(__FILE__ ": Start item isn't an array.");
}
if (obj_start.Size() != 3) {
throw std::invalid_argument(__FILE__ ": Start item doesn't have a length of 3.");
}
this->start_rw[0] = obj_start[0].GetDouble();
this->start_rw[1] = obj_start[1].GetDouble();
this->start_rw[2] = obj_start[2].GetDouble();
const auto& obj_end_i = object.FindMember("end");
if (obj_end_i == object.MemberEnd()) {
throw std::invalid_argument(__FILE__ ": Given object doesn't have an end item.");
}
const auto& obj_end = obj_end_i->value;
if (not obj_end.IsArray()) {
throw std::invalid_argument(__FILE__ ": End item isn't an array.");
}
if (obj_end.Size() != 3) {
throw std::invalid_argument(__FILE__ ": End item doesn't have a length of 3.");
}
this->end_rw[0] = obj_end[0].GetDouble();
this->end_rw[1] = obj_end[1].GetDouble();
this->end_rw[2] = obj_end[2].GetDouble();
for (size_t i = 0; i < 3; i++) {
if (this->end_rw[i] <= this->start_rw[i]) {
throw std::invalid_argument(__FILE__ ": Given object ends before it starts.");
}
}
}