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


C++ AmArg类代码示例

本文整理汇总了C++中AmArg的典型用法代码示例。如果您正苦于以下问题:C++ AmArg类的具体用法?C++ AmArg怎么用?C++ AmArg使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了AmArg类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: vqConferenceFeedback

void WebConferenceFactory::vqConferenceFeedback(const AmArg& args, AmArg& ret) {
  assertArgCStr(args.get(0));
  assertArgCStr(args.get(1));
  assertArgCStr(args.get(2));
  assertArgCStr(args.get(3));
  assertArgInt(args.get(4));

  string room = args.get(0).asCStr();
  string adminpin = args.get(1).asCStr();
  string sender = args.get(2).asCStr();
  string comment = args.get(3).asCStr();
  int opinion = args.get(4).asInt();

  saveFeedback("CO|||"+ room + "|||" + adminpin + "|||" + int2str(opinion) + "|||" + 
	       sender + "|||" + comment +"|||" + int2str(time(NULL)) + "|||\n");

  ret.push(0);
  ret.push("OK");
}
开发者ID:BackupTheBerlios,项目名称:sems-svn,代码行数:19,代码来源:WebConference.cpp

示例2: 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((unsigned int)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((unsigned int)i)] = it->second.get(i).asCStr();
	else
	  vars[it->first+"_"+int2str((unsigned int)i)] = AmArg::print(it->second.get(i));
      }
    } else {
      vars[it->first] = AmArg::print(it->second);	
    }
  }
}
开发者ID:Chocolatbuddha,项目名称:sems,代码行数:19,代码来源:DSM.cpp

示例3: preloadModules

void DSMFactory::preloadModules(const AmArg& args, AmArg& ret) {
  AmConfigReader cfg;
  if(cfg.loadFile(AmConfig::ModConfigPath + string(MOD_NAME ".conf"))) {
      ret.push(500);
      ret.push("loading config file " +AmConfig::ModConfigPath + string(MOD_NAME ".conf"));
      return ;
  }
  string err;

  string ModPath = cfg.getParameter("mod_path");

  int res = preloadModules(cfg, err, ModPath);
  if (res<0) {
    ret.push(500);
    ret.push(err);
  } else {
    ret.push(200);
    ret.push("modules preloaded");
  }
}
开发者ID:BackupTheBerlios,项目名称:sems-svn,代码行数:20,代码来源:DSM.cpp

示例4: execRpc

void JsonRPCServerModule::execRpc(const AmArg& args, AmArg& ret) {
  AmArg none_params;
  AmArg& params = none_params;
  if (args.size()>7)
    params = args.get(7);

  AmArg u_none_params;
  AmArg& udata = u_none_params;
  if (args.size()>8)
    udata = args.get(8);

  JsonRPCServerLoop::execRpc(// evq_link, notification_link, request_link
			     args.get(0).asCStr(), args.get(1).asCStr(),
			     args.get(2).asCStr(), 
			     // flags
			     args.get(3).asInt(), 
			     // host, port, method
			     args.get(4).asCStr(), 
			     args.get(5).asInt(), args.get(6).asCStr(), 
			     params, udata, ret);
}
开发者ID:Chocolatbuddha,项目名称:sems,代码行数:21,代码来源:JsonRPC.cpp

示例5: listProfiles

void SBCFactory::listProfiles(const AmArg& args, AmArg& ret) {
  profiles_mut.lock();
  for (std::map<string, SBCCallProfile>::iterator it=
	 call_profiles.begin(); it != call_profiles.end(); it++) {
    AmArg p;
    p["name"] = it->first;
    p["md5"] = it->second.md5hash;
    p["path"] = it->second.profile_file;
    ret.push((p));
  }
  profiles_mut.unlock();
}
开发者ID:Chocolatbuddha,项目名称:sems,代码行数:12,代码来源:SBC.cpp

示例6: asArgArray

AmArg ConferenceRoomParticipant::asArgArray() {
  AmArg res;
  res.push(AmArg(localtag.c_str()));
  res.push(AmArg(number.c_str()));
  res.push(AmArg((int)status));
  res.push(AmArg(last_reason.c_str()));
  res.push(AmArg((int)muted));
  res.push(AmArg(participant_id));
  return res;
}
开发者ID:arovetto,项目名称:sems,代码行数:10,代码来源:RoomInfo.cpp

示例7: DBG

void AnnRecorderDialog::saveMessage(FILE* fp) {
  string msg_name = params["type"]+".wav";
  DBG("message name is '%s'\n", msg_name.c_str());

  AmArg di_args,ret;
  di_args.push((params["domain"]+DOMAIN_PROMPT_SUFFIX).c_str()); // domain
  di_args.push(params["user"].c_str());                          // user
  di_args.push(msg_name.c_str());                                // message name
  AmArg df;
  MessageDataFile df_arg(fp);
  df.setBorrowedPointer(&df_arg);
  di_args.push(df);  
  try {
    msg_storage->invoke("msg_new",di_args,ret);  
  } catch(string& s) {
    ERROR("invoking msg_new: '%s'\n", s.c_str());
  } catch(...) {
    ERROR("invoking msg_new.\n");
  }
  // TODO: evaluate ret return value
}
开发者ID:Chocolatbuddha,项目名称:sems,代码行数:21,代码来源:AnnRecorder.cpp

示例8: reloadProfile

void SBCFactory::reloadProfile(const AmArg& args, AmArg& ret) {
  bool failed = false;
  string res = "OK";
  AmArg p;
  if (!args[0].hasMember("name")) {
    ret.push(400);
    ret.push("Parameters error: expected ['name': profile_name] ");
    return;
  }

  profiles_mut.lock();
  std::map<string, SBCCallProfile>::iterator it=
    call_profiles.find(args[0]["name"].asCStr());
  if (it == call_profiles.end()) {
    res = "profile '"+string(args[0]["name"].asCStr())+"' not found";
    failed = true;
  } else {
    SBCCallProfile new_cp;
    if (!new_cp.readFromConfiguration(it->first, it->second.profile_file)) {
      ERROR("reading call profile file '%s'\n", it->second.profile_file.c_str());
      res = "Error reading call profile for "+it->first+" from "+it->second.profile_file;
      failed = true;
    } else {
      it->second = new_cp;
      p["name"] = it->first;
      p["md5"] = it->second.md5hash;
      p["path"] = it->second.profile_file;
    }
  }
  profiles_mut.unlock();

  if (!failed) {
    ret.push(200);
    ret.push(res);
    ret.push(p);
  } else {
    ret.push(500);
    ret.push(res);
  }
}
开发者ID:Chocolatbuddha,项目名称:sems,代码行数:40,代码来源:SBC.cpp

示例9: DBG

string DIDial::dialout_auth(const string& application, 
		       const string& user, 
		       const string& from, 
		       const string& to,
		       const string& a_realm, 
		       const string& a_user, 
		       const string& a_pwd
		       ) {
  DBG("dialout application '%s', user '%s', from '%s', to '%s'", 
      application.c_str(), user.c_str(), from.c_str(), to.c_str());

  AmArg* a = new AmArg();
  a->setBorrowedPointer(new UACAuthCred(a_realm, a_user, a_pwd));

  AmSession* s = AmUAC::dialout(user.c_str(), application,  to,  
				"<" + from +  ">", from, "<" + to + ">", 
				string(""), // callid
				a);
  if (s)
    return s->getLocalTag();
  else 
    return "<failed>\n";
}
开发者ID:BackupTheBerlios,项目名称:sems-svn,代码行数:23,代码来源:DIDial.cpp

示例10: 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

示例11: getRoomPassword

void WebConferenceFactory::getRoomPassword(const AmArg& args, AmArg& ret) {

  string pwd  = args.get(0).asCStr();
  string room = args.get(1).asCStr();

  if ((!MasterPassword.length()) || 
      pwd != MasterPassword) {
    ret.push(403);
    ret.push("Wrong Master Password.\n");
    return;
  }
  int res_code = 404;
  string res = "Room does not exist.";
  rooms_mut.lock();
  map<string, ConferenceRoom>::iterator it = rooms.find(room);
  if (it != rooms.end())  {
    res = it->second.adminpin; 
    res_code = 0;
  }
  rooms_mut.unlock();

  ret.push(res_code);  
  ret.push(res.c_str());  
}
开发者ID:BackupTheBerlios,项目名称:sems-svn,代码行数:24,代码来源:WebConference.cpp

示例12: sendMessage

void JsonRPCServerModule::sendMessage(const AmArg& args, AmArg& ret) {
  AmArg none_params;
  AmArg& params = none_params;
  if (args.size()>5)
    params = args.get(5);
  AmArg u_none_params;
  AmArg& udata = u_none_params;
  if (args.size()>6)
    udata = args.get(6);

  JsonRPCServerLoop::sendMessage(args.get(0).asCStr(), // conn_id, 
				 args.get(1).asInt(),  // type, (0 == reply)
				 args.get(2).asCStr(), // method,
				 args.get(3).asCStr(), // id
				 args.get(4).asCStr(), // reply_sink
				 params, udata, ret);
}
开发者ID:Chocolatbuddha,项目名称:sems,代码行数:17,代码来源:JsonRPC.cpp

示例13: loadDSM

void DSMFactory::loadDSM(const AmArg& args, AmArg& ret) {
  string dsm_name  = args.get(0).asCStr();

  AmConfigReader cfg;
  if(cfg.loadFile(AmConfig::ModConfigPath + string(MOD_NAME ".conf"))) {
      ret.push(500);
      ret.push("loading config file " +AmConfig::ModConfigPath + string(MOD_NAME ".conf"));
      return;
  }

  string DiagPath = cfg.getParameter("diag_path");
  if (DiagPath.length() && DiagPath[DiagPath.length()-1] != '/')
    DiagPath += '/';

  string ModPath = cfg.getParameter("mod_path");

  string dsm_file_name = DiagPath+dsm_name+".dsm";
  string res = "OK";

  ScriptConfigs_mut.lock();
  try {
    if (MainScriptConfig.diags->hasDiagram(dsm_name)) {
      ret.push(400);
      ret.push("DSM named '" + dsm_name + "' already loaded (use reloadDSMs to reload all)");
    } else {
      if (!MainScriptConfig.diags->loadFile(dsm_file_name, dsm_name, ModPath, DebugDSM)) {
	ret.push(500);
	ret.push("error loading "+dsm_name+" from "+ dsm_file_name);
      } else {
	ret.push(200);
	ret.push("loaded "+dsm_name+" from "+ dsm_file_name);
      }
    }
  } catch(...) {
    ScriptConfigs_mut.unlock();
    throw;
  }
  ScriptConfigs_mut.unlock();
}
开发者ID:BackupTheBerlios,项目名称:sems-svn,代码行数:39,代码来源:DSM.cpp

示例14: vqRoomFeedback

void WebConferenceFactory::vqRoomFeedback(const AmArg& args, AmArg& ret) {
  
  assertArgCStr(args.get(0));
  assertArgCStr(args.get(1));
  assertArgInt(args.get(2));

  string room = args.get(0).asCStr();
  string adminpin = args.get(1).asCStr();
  int opinion = args.get(2).asInt();

  saveFeedback(string("RO "+ room + "|||" + adminpin + "|||" + 
	       int2str(opinion) + "|||" + int2str(time(NULL)) + "|||\n"));

  ret.push(0);
  ret.push("OK");
}
开发者ID:BackupTheBerlios,项目名称:sems-svn,代码行数:16,代码来源:WebConference.cpp

示例15: getFormat

static RestParams::Format getFormat(const AmArg &values, RestParams::Format _default)
{
  if (!values.hasMember("format")) return _default;

  const AmArg &a = values["format"];
  if (!isArgCStr(a)) throw string("configuration error: wrong arg type\n");

  const char *str = a.asCStr();
  if (str) {
    if (strcmp(str, "text") == 0) return RestParams::TEXT;
    if (strcmp(str, "json") == 0) return RestParams::JSON;
    if (strcmp(str, "xml") == 0) return RestParams::XML;
  }

  throw string("invalid format parameter value\n");
  
  return _default;
}
开发者ID:Chocolatbuddha,项目名称:sems,代码行数:18,代码来源:RestModule.cpp


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