2011-11-19 152 views
0

我正在將libxmlrpc實現到C++項目中,無論如何,我的RPC服務器已經返回一個包含52個成員結構的struct。libxmlrpc迭代遍歷struct

我不知道密鑰是什麼,因爲它們是不透明的引用,所以我不能依賴它們。

我如何能夠通過結構重複,我還以爲這是用下面的代碼:

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++; 
} 

然而,Data.structGetKeyAndValue(指數)與錯誤:

no matching function for call to 'XmlRpcValue::structGetKeyAndValue(int&) 

哪個好吧,我知道這不是一個公衆(嗯,我認爲它不是一個公共成員函數)xmlrpcvalue,但我找不到任何可以讓我這樣做的東西。

任何人都有這方面的經驗?

回答

0

一些快速谷歌搜索似乎表明,你已經得到了函數簽名錯誤:

void XmlRpcValue::structGetKeyAndValue(const int index, std::string& out_key, XmlRpcValue& out_value); 
+0

感謝您的..它並沒有解決這個問題,原來這直接libxmlrpc是有點令人生畏的我的任務,我結束了去與fastrpc(我需要快速完成項目不幸..),以及... fastrpc是..快! –