I am implementing libxmlrpc into C++ project, anywayy, my RPC server has returned a struct with 52 member structs in them.
I do not know what the keys are as they are opaque references, so I cannot rely on them.
How can I iterate through the struct, I would have thought it was with the following code:
XmlRpcValue param_array = XmlRpcValue::makeArray();
param_array.arrayAppendItem(XmlRpcValue::makeString(this->sessionKey));
param_array.arrayAppendItem(XmlRpcValue::makeString("petabytes"));
XmlRpcValue result = ServerCall("Charter.getDataWarehouse.storage.capacity", param_array, url);
int index = 0;
while(index < result.structSize())
{
XmlRpcValue Data = result.getStruct();
//Would have thought it would work with this ;( shit documentation libxmlrpc has, grrrr
//Data.structGetKeyAndValue(index);
//This for example works, because I know the opaque reference, but in real life I wont
cout << Data.structGetValue("OpaqueRef:d4e60db6-2271-b0ac-d362-1b51220980af").structSize() << endl;
index++;
}
However, Data.structGetKeyAndValue(index) errors with:
no matching function for call to 'XmlRpcValue::structGetKeyAndValue(int&)
Which is fine, I understand it's not a public (well I think it's not a public member function) of xmlrpcvalue
, however I cannot find anything that would allow me to do this.
Anyone have any experience with this?
一些快速的Google搜索似乎表明您的函数签名错误:
void XmlRpcValue::structGetKeyAndValue(const int index, std::string& out_key, XmlRpcValue& out_value);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.