本文整理汇总了C++中AmArg::begin方法的典型用法代码示例。如果您正苦于以下问题:C++ AmArg::begin方法的具体用法?C++ AmArg::begin怎么用?C++ AmArg::begin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AmArg
的用法示例。
在下文中一共展示了AmArg::begin方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AmArg2DSMStrMap
void AmArg2DSMStrMap(const AmArg& arg,
map<string, string>& vars) {
for (AmArg::ValueStruct::const_iterator it=arg.begin();
it != arg.end(); it++) {
if (it->second.getType() == AmArg::CStr)
vars[it->first] = it->second.asCStr();
else if (it->second.getType() == AmArg::Array) {
vars[it->first+"_size"] = int2str(it->second.size());
for (size_t i=0;i<it->second.size();i++) {
if (it->second.get(i).getType() == AmArg::CStr)
vars[it->first+"_"+int2str(i)] = it->second.get(i).asCStr();
else
vars[it->first+"_"+int2str(i)] = AmArg::print(it->second.get(i));
}
} else {
vars[it->first] = AmArg::print(it->second);
}
}
}
示例2: switch
void XMLRPC2DIServer::amarg2xmlrpcval(const AmArg& a,
XmlRpcValue& result) {
switch (a.getType()) {
case AmArg::CStr:
// DBG("a->X CSTR\n");
result = string(a.asCStr()); break;
case AmArg::Int:
// DBG("a->X INT\n");
result=a.asInt(); break;
case AmArg::Double:
// DBG("a->X DOUBLE\n");
result=a.asDouble(); break;
case AmArg::Array:
// DBG("a->X ARRAY size %u\n", a.size());
result.setSize(a.size());
for (size_t i=0;i<a.size();i++) {
// duh... recursion...
amarg2xmlrpcval(a.get(i), result[i]);
}
break;
case AmArg::Struct:
// DBG("a->X STRUCT size %u\n", a.size());
for (AmArg::ValueStruct::const_iterator it =
a.begin(); it != a.end(); it++) {
// duh... recursion...
amarg2xmlrpcval(it->second, result[it->first]);
}
break;
default: { WARN("unsupported return value type %d\n", a.getType()); } break;
// TODO: do sth with the data here ?
}
}