本文整理汇总了C++中Attachment::AssignKeyValue方法的典型用法代码示例。如果您正苦于以下问题:C++ Attachment::AssignKeyValue方法的具体用法?C++ Attachment::AssignKeyValue怎么用?C++ Attachment::AssignKeyValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Attachment
的用法示例。
在下文中一共展示了Attachment::AssignKeyValue方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Deserialize
void Post::Deserialize(Json::Value& root) {
// General Post
id_ = root.get("id", "").asString();
entity_ = root.get("entity", "").asString();
published_at_ = root.get("published_at", "").asString();
received_at_ = root.get("received_at", "").asString();
type_ = root.get("type", "").asString();
if(type_.find("#") != std::string::npos)
base_type_ = type_.substr(0, type_.find("#")+1);
jsn::DeserializeObject(&version_, root["version"]);
jsn::DeserializeIntoVector(root["licenses"], licenses_);
jsn::DeserializeObjectValueIntoMap(root["content"], content_);
// Deserialize this into an array of objects
Json::Value jsn_attch(Json::arrayValue);
jsn_attch = root["attachments"];
if(jsn_attch.size() > 0) {
Json::ValueIterator itr = jsn_attch.begin();
for(; itr != jsn_attch.end(); itr++) {
//Attachment* pAtch = new Attachment;
Attachment attch;
Json::Value aobj(Json::objectValue);
aobj = (*itr);
if(aobj.isObject()) {
if(aobj.size() >= 4) {
Json::ValueIterator ii = aobj.begin();
for(; ii != aobj.end(); ii++) {
attch.AssignKeyValue(ii.key().asString(), (*ii));
}
}
}
PushBackAttachment(attch);
}
}
Json::Value mentions_array(Json::arrayValue);
mentions_array = root["mentions"];
if(mentions_array.size() > 0) {
Json::ValueIterator itr = mentions_array.begin();
for(;itr != mentions_array.end(); itr++) {
Mention mention;
Json::Value mobj;
mobj = (*itr);
if(mobj.isObject()) {
jsn::DeserializeObject(&mention, mobj);
PushBackMention(mention);
}
}
}
if(root.isMember("app")) {
tent_app_.Deserialize(root["app"]);
}
else {
std::cout<<" post has no app " << std::endl;
}
jsn::DeserializeObjectValueIntoMap(root["views"], views_);
jsn::DeserializeObject(&permissions_,root["permissions"]);
}