diff --git a/a8/xobject.cc b/a8/xobject.cc index 671a83c..0af198d 100644 --- a/a8/xobject.cc +++ b/a8/xobject.cc @@ -420,6 +420,15 @@ namespace a8 } } + void XObject::ToKVList(std::map& kv_list) + { + if (type_ == a8::XOT_OBJECT) { + for (auto& pair : *value_.object_value) { + kv_list[pair.first] = pair.second->AsXValue().GetString(); + } + } + } + void XObject::JsonValueToXObject(Json::Value& json_val, a8::XObject& xobject) { Json::ValueType val_type = json_val.type(); diff --git a/a8/xobject.h b/a8/xobject.h index 1214d11..4e2d8ce 100644 --- a/a8/xobject.h +++ b/a8/xobject.h @@ -52,6 +52,7 @@ namespace a8 void ToJsonStr(std::string& data); std::string ToJsonStr(); void ToUrlEncodeStr(std::string& data); + void ToKVList(std::map& kv_list); private: void JsonValueToXObject(Json::Value& json_val, a8::XObject& xobject);