diff --git a/a8/xobject.cc b/a8/xobject.cc index aaab704..ed540ea 100644 --- a/a8/xobject.cc +++ b/a8/xobject.cc @@ -429,6 +429,15 @@ namespace a8 } } + void XObject::GetKeys(std::vector& keys) + { + if (type_ == a8::XOT_OBJECT) { + for (auto& pair : *value_.object_value) { + keys.push_back(pair.first); + } + } + } + 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 566b35e..ce847c3 100644 --- a/a8/xobject.h +++ b/a8/xobject.h @@ -56,6 +56,7 @@ namespace a8 std::string ToJsonStr(); void ToUrlEncodeStr(std::string& data); void ToKVList(std::map& kv_list); + void GetKeys(std::vector& keys); private: void JsonValueToXObject(Json::Value& json_val, a8::XObject& xobject);