当前位置: 首页>>代码示例>>C++>>正文


C++ AmArg::getType方法代码示例

本文整理汇总了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();
}
开发者ID:BackupTheBerlios,项目名称:sems-svn,代码行数:32,代码来源:SIPRegistrarClient.cpp

示例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 ?
  }
}
开发者ID:BackupTheBerlios,项目名称:sems-svn,代码行数:23,代码来源:XMLRPC2DI.cpp

示例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 ?
  }
}
开发者ID:BackupTheBerlios,项目名称:sems-svn,代码行数:37,代码来源:XMLRPC2DI.cpp


注:本文中的AmArg::getType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。