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


C++ QProcess::canReadLineStdout方法代码示例

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


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

示例1: launchVizScript

/** Method calls appropriate xxx_launch.sh script to
 *  actually launch the visualization job on the target machine
 */
int Gridifier::launchVizScript(const QString &scriptConfigFileName,
			       const LauncherConfig &config){
                                
  // Construct name of script from name of application
  QProcess *launchVizScriptProcess = new QProcess(QString("./"+config.mAppToLaunch->mAppName+"_launch.sh"));
  launchVizScriptProcess->setWorkingDirectory(mScriptsDir);
  launchVizScriptProcess->addArgument(scriptConfigFileName);
  launchVizScriptProcess->addArgument(QString::number(config.mTimeToRun));

  launchVizScriptProcess->start();

  while (launchVizScriptProcess->isRunning()){
    usleep(10000);
    mApplication->processEvents();
  }


  if (launchVizScriptProcess->canReadLineStdout()){
    QString out(launchVizScriptProcess->readStdout());
    cout << "Stdout:" << endl << out << endl;
    if(out.contains("ERROR")){
      return REG_FAILURE;
    }
  }
  if (launchVizScriptProcess->canReadLineStderr()){
    QString out(launchVizScriptProcess->readStderr());
    cout << "Stderr:" << endl << out << endl;
    if(out.contains("ERROR")){
      return REG_FAILURE;
    }
  }
  return REG_SUCCESS;
}
开发者ID:RealityGrid,项目名称:qt_launcher,代码行数:36,代码来源:Gridifier.cpp

示例2: setServiceData

/** Calls setServiceData on the specified service using the
    second argument as the basis for the argument to setServiceData. 
    (The <ogsi:setByServiceDataNames> tags are added in this 
    routine.) */
void Gridifier::setServiceData(const QString &nameSpace,
			       const QString &gsh,
			       const QString &sdeText){

  QString arg("<ogsi:setByServiceDataNames>");
  arg.append(sdeText);
  arg.append("</ogsi:setByServiceDataNames>");

  QProcess *setServiceDataProcess = new QProcess(QString("./setServiceData.pl"));
  setServiceDataProcess->setWorkingDirectory(mScriptsDir);
  setServiceDataProcess->addArgument(nameSpace);
  setServiceDataProcess->addArgument(gsh);
  setServiceDataProcess->addArgument(arg);
  setServiceDataProcess->start();

  while (setServiceDataProcess->isRunning()){
    usleep(10000);
    mApplication->processEvents();
  }

  if(setServiceDataProcess->canReadLineStdout()){
    cout << "Stdout:" << endl << setServiceDataProcess->readStdout() << endl;
  }
  if (setServiceDataProcess->canReadLineStderr()){
    cout << "Stderr:" << endl << setServiceDataProcess->readStderr() << endl;
  }
}
开发者ID:RealityGrid,项目名称:qt_launcher,代码行数:31,代码来源:Gridifier.cpp

示例3: makeVizSGS

//---------------------------------------------------------------
QString Gridifier::makeVizSGS(const QString &factory,
                              const LauncherConfig &config){
  QString result;

#ifndef REG_WSRF
  QProcess *makeVizSGSProcess = new QProcess(QString("./make_vis_sgs.pl"));
  makeVizSGSProcess->setWorkingDirectory(mScriptsDir);
  makeVizSGSProcess->addArgument(factory);
  makeVizSGSProcess->addArgument(config.mJobData->toXML(QString("SGS")));
  makeVizSGSProcess->addArgument(config.topLevelRegistryGSH);
  makeVizSGSProcess->addArgument(config.simulationGSH.mEPR);
  makeVizSGSProcess->addArgument(QString::number(config.mTimeToRun));
  makeVizSGSProcess->start();

  while (makeVizSGSProcess->isRunning()){
    usleep(10000);
    mApplication->processEvents();
  }

  if(makeVizSGSProcess->canReadLineStdout()){
    result = QString(makeVizSGSProcess->readStdout());
    cout << "stdout: " << result << endl;
  }
  else{
    cout << "Full line of stdout unavailable" << endl;
  }
  if(makeVizSGSProcess->canReadLineStderr()){
    cout << "stderr: " << QString(makeVizSGSProcess->readStderr()) << endl;
  }
  else{
    cout << "Full line of stderr unavailable" << endl;
  }

  result = QString(makeVizSGSProcess->readStdout()).stripWhiteSpace();

#else // REG_WSRF is defined

  char                                       purpose[1024];
  char                                       proxyAddress[1024];
  int                                        proxyPort;
  char                                       iodef_label[256];
  char                                      *ioTypes;
  struct soap                                mySoap;
  char                                      *EPR;
  struct msg_struct                         *msg;
  xmlDocPtr                                  doc;
  xmlNsPtr                                   ns;
  xmlNodePtr                                 cur;
  struct io_struct                          *ioPtr;
  int                                        i, count;
  struct reg_job_details                     job;

  /* Obtain the IOTypes from the data source */
  soap_init(&mySoap);
  if( Get_resource_property (&mySoap,
			     config.simulationGSH.mEPR.ascii(),
			     config.simulationGSH.mSecurity.userDN,
			     config.simulationGSH.mSecurity.passphrase,
			     "ioTypeDefinitions",
			     &ioTypes) != REG_SUCCESS ){

    cout << "Call to get ioTypeDefinitions ResourceProperty on "<< 
      config.simulationGSH.mEPR << " failed" << endl;
    return result;
  }
  cout << "Got ioTypeDefinitions >>" << ioTypes << "<<" << endl;

  if( !(doc = xmlParseMemory(ioTypes, strlen(ioTypes))) ||
      !(cur = xmlDocGetRootElement(doc)) ){
    fprintf(stderr, "Hit error parsing buffer\n");
    xmlFreeDoc(doc);
    xmlCleanupParser();
    return result;
  }

  ns = xmlSearchNsByHref(doc, cur,
            (const xmlChar *) "http://www.realitygrid.org/xml/steering");

  if ( xmlStrcmp(cur->name, (const xmlChar *) "ioTypeDefinitions") ){
    cout << "ioTypeDefinitions not the root element" << endl;
    return result;
  }
  /* Step down to ReG_steer_message and then to IOType_defs */
  cur = cur->xmlChildrenNode->xmlChildrenNode;

  msg = New_msg_struct();
  msg->msg_type = IO_DEFS;
  msg->io_def = New_io_def_struct();
  parseIOTypeDef(doc, ns, cur, msg->io_def);
  Print_msg(msg);

  if(!(ioPtr = msg->io_def->first_io) ){
    fprintf(stderr, "Got no IOType definitions from data source\n");
    return result;
  }
  i = 0;
  printf("Available IOTypes:\n");
  while(ioPtr){
    if( !xmlStrcmp(ioPtr->direction, (const xmlChar *)"OUT") ){
//.........这里部分代码省略.........
开发者ID:RealityGrid,项目名称:qt_launcher,代码行数:101,代码来源:Gridifier.cpp


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