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


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

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


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

示例1: asArgArray

AmArg ConferenceRoom::asArgArray() {
  cleanExpired();
  AmArg res;
  res.assertArray(0); // make array from it

  for (list<ConferenceRoomParticipant>::iterator it=participants.begin(); 
       it != participants.end(); it++) {
    res.push(it->asArgArray());
  }
  return res;
}
开发者ID:arovetto,项目名称:sems,代码行数:11,代码来源:RoomInfo.cpp

示例2: userdir_open

void MsgStorage::userdir_open(string domain, string user, AmArg& ret) { 
  // TODO: block the directory from delete (increase lock)
  string path = msg_dir + "/" +  domain + "/" + user + "/";
  DBG("trying to list '%s'\n", path.c_str());
  DIR* dir = opendir(path.c_str());
  if (!dir) {
    ret.push(MSG_EUSRNOTFOUND);
    ret.push(AmArg()); // empty list
    return;
  }

  int err=0;
  struct dirent* entry;
  AmArg msglist;
  msglist.assertArray(0); // make it an array
  while( ((entry = readdir(dir)) != NULL) && (err == 0) ){
    string msgname(entry->d_name);
      if(!msgname.length() ||
	 msgname[0] == '.'){
	continue;
      }
    struct stat e_stat;
    if (stat((path+msgname).c_str(), &e_stat)) {
      ERROR("cannot stat '%s': %s\n", 
	    (path+msgname).c_str(),strerror(errno));
      continue;
    }
    AmArg msg;
    msg.push(msgname.c_str());
    // TODO: change the system here, st_atime/mtime/... 
    // is not really safe for saving read status!

    if (e_stat.st_atime != e_stat.st_mtime) {
      msg.push(0);      
    } else {      
      msg.push(1);      
    }
    msg.push((int)e_stat.st_size);      

    msglist.push(msg);
  }
  closedir(dir);
  // uh, this is really inefficient...
  ret.push(MSG_OK);
  ret.push(msglist);
}
开发者ID:Chocolatbuddha,项目名称:sems,代码行数:46,代码来源:MsgStorage.cpp

示例3: roomInfo

void WebConferenceFactory::roomInfo(const AmArg& args, AmArg& ret) {
  assertArgCStr(args.get(0));
  assertArgCStr(args.get(1));
  string room = args.get(0).asCStr();
  string adminpin = args.get(1).asCStr();;

   rooms_mut.lock();
   ConferenceRoom* r = getRoom(room, adminpin);
   if (NULL == r) {
    ret.push(1);
    ret.push("wrong adminpin");
    // for consistency, add an empty array
    AmArg a;
    a.assertArray(0);
    ret.push(a);
   } else {
     ret.push(0);
     ret.push("OK");
     ret.push(r->asArgArray());
   }
   rooms_mut.unlock();
}
开发者ID:BackupTheBerlios,项目名称:sems-svn,代码行数:22,代码来源:WebConference.cpp

示例4: c

void XMLRPC2DI::sendRequest(const AmArg& args, AmArg& ret) {
  string app_name     = args.get(0).asCStr();
  string method       = args.get(1).asCStr();
  AmArg& params       = args.get(2);

  while (true) {
    XMLRPCServerEntry* srv = getServer(app_name);
    if (NULL == srv) {
      ret.push(-1);
      ret.push("no active connections");
      return;
    }
    XmlRpcClient c((const char*)srv->server.c_str(), (int)srv->port, 
		   (const char*)srv->uri.empty()?NULL:srv->uri.c_str()
#ifdef HAVE_XMLRPCPP_SSL
		   , false
#endif
		   );

    XmlRpcValue x_args, x_result;
    XMLRPC2DIServer::amarg2xmlrpcval(params, x_args);
    if (c.execute(method.c_str(), x_args, x_result) &&  !c.isFault()) {
      DBG("successfully executed method %s on server %s:%d\n",
	  method.c_str(), srv->server.c_str(), srv->port);
      ret.push(0);
      ret.push("OK");
      ret.assertArray(3);
      XMLRPC2DIServer::xmlrpcval2amarg(x_result, ret[2]);
      return;      
    } else {
      DBG("executing method %s failed on server %s:%d\n",
	  method.c_str(), srv->server.c_str(), srv->port);
      srv->set_failed();
    }
  }
}
开发者ID:BackupTheBerlios,项目名称:sems-svn,代码行数:36,代码来源:XMLRPC2DI.cpp


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