本文整理汇总了C++中AmArg::getType方法的典型用法代码示例。如果您正苦于以下问题:C++ AmArg::getType方法的具体用法?C++ AmArg::getType怎么用?C++ AmArg::getType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AmArg
的用法示例。
在下文中一共展示了AmArg::getType方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: onNewRegistration
void SIPRegistrarClient::onNewRegistration(SIPNewRegistrationEvent* new_reg) {
SIPRegistration* reg = new SIPRegistration(new_reg->handle, new_reg->info,
new_reg->sess_link);
if (uac_auth_i != NULL) {
DBG("enabling UAC Auth for new registration.\n");
// get a sessionEventHandler from uac_auth
AmArg di_args,ret;
AmArg a;
a.setBorrowedPointer(reg);
di_args.push(a);
di_args.push(a);
DBG("arg type is %d\n", a.getType());
uac_auth_i->invoke("getHandler", di_args, ret);
if (!ret.size()) {
ERROR("Can not add auth handler to new registration!\n");
} else {
ArgObject* p = ret.get(0).asObject();
if (p != NULL) {
AmSessionEventHandler* h = dynamic_cast<AmSessionEventHandler*>(p);
if (h != NULL)
reg->setSessionEventHandler(h);
}
}
}
add_reg(new_reg->handle, reg);
reg->doRegistration();
}
示例2: switch
void XMLRPC2DIServer::amarg2xmlrpcval(AmArg& a,
XmlRpcValue& result) {
switch (a.getType()) {
case AmArg::CStr:
result = string(a.asCStr()); break;
case AmArg::Int:
result=a.asInt(); break;
case AmArg::Double:
result=a.asDouble(); break;
case AmArg::Array:
result.setSize(a.size());
for (size_t i=0;i<a.size();i++) {
// duh... recursion...
amarg2xmlrpcval(a.get(i), result[i]);
}
break;
default: { WARN("unsupported return value type %d\n", a.getType()); } break;
// TODO: do sth with the data here ?
}
}
示例3: 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 ?
}
}