XML RPC - 如何在C++版本的 XMLRPC-C 库中包装、返回和获取 vector<map<string、string> > 的对象?
xml rpc - how to wrap, return and get the object of vector<map<string, string> > in C++ version of xmlrpc-c library?
我正在使用xmlrpc-c库(http://xmlrpc-c.sourceforge.net),我正在编写服务器和客户端代码。我知道xmlrpc提供了许多内置结构,如xmlrpc_c::value_struct,但文档不能帮助我弄清楚如何实现我的对象。
在服务器中,我试图返回一个结构vector<map<string,string>>
,代码片段如下:
SomeDefaultMethod::execute(string const& methodName, xmlrpc_c::paramList const& paramList, xmlrpc_c::value* const retvalP)
{
*retvalP = structure; // suppose the variable structure is of type vector<map<string,string> >
}
在客户端,我试图打印来自服务器的所有值,也就是说,打印每个映射的键和整个向量的值。
string const serverUrl("http://localhost:8183/RPC2");
string const methodName("webcommands.bulkpagestatus");
xmlrpc_c::clientSimple myClient;
xmlrpc_c::value result;
myClient.call(serverUrl, methodName, &result)
// do not know how to get the values then through result in this situation.
谁能给我一个c++示例代码或虚拟代码使用xmlrpc-c来实现我的对象?非常感谢你的帮助!
您必须在服务器端进行封送,在客户端进行反封送。也称为序列化和反序列化。
你要求我们提供大量代码。
相关文章:
- 请解释这句话(cout<<1+int((a<b)^((b-a)&1) )<<endl
- 呼叫运营商<<临时
- cppcheck在const std::string[]上引发警告
- 将std::string传递给WriteConsole API
- 如何防止clang格式在流运算符调用之间添加换行符<<
- 为std::string的某个索引赋值
- <<操作员在下面的行中工作
- std中有类似find_last_of的函数,而string中没有
- 使用 std::string () const 函数启动线程或未来
- 使用char类型将decimal转换为string,将string转换为decimal
- 迭代和比较映射<字符串、矢量<string>> c++ 中的值
- 当我们进行一些操作时,应该使用什么'std::string'或'std::stringstream'?
- 将向量解析<string>为字符串
- 'string.assign(string.data(), 5)' 是明确定义的还是 UB?
- 如何更改大小(std::string)
- "string.h"在构建适用于iOS的qt应用程序中找不到消息
- C++:如何将 unix 时间的字符串转换为 *tm?(使用时间错误:"cannot convert 'String' to 'tm*' ")
- std::string 的对象真的可以移动吗?
- 与'operator='不匹配(操作数类型'String'且"void")
- SegFault 同时使用 std::string::operator+= 和函数作为参数