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


C++ const_iterator::toAscii方法代码示例

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


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

示例1: main

int main(int argc, char *argv[]) {
    QApplication a(argc, argv);

    QStringList argList = a.arguments();

    if (argList.count() <= 0) {
        return -1;  // should at least have command name
    }

    SkString input;

    QStringList::const_iterator iter = argList.begin();

    SkString commandName(iter->toAscii().data());
    ++iter; // skip the command name

    for ( ; iter != argList.end(); ++iter) {
        if (0 == iter->compare("--help") || 0 == iter->compare("-h")) {
            usage(commandName.c_str());
            return -1;
        } else if (input.isEmpty()) {
            input = SkString(iter->toAscii().data());
        } else {
            usage(commandName.c_str());
            return -1;
        }
    }

    SkDebuggerGUI w;

    if (!input.isEmpty()) {
        if (SkStrEndsWith(input.c_str(), ".skp")) {
            w.openFile(input.c_str());
        } else {
            w.setupDirectoryWidget(input.c_str());
        }
    }

    w.show();
    return a.exec();
}
开发者ID:Adenilson,项目名称:skia,代码行数:41,代码来源:debuggermain.cpp

示例2: LoadDatasetInternal

bool MainWindow::LoadDatasetInternal(QStringList files, QString targetFilename,
                                     bool bNoUserInteraction)
{

  if(files.empty()) {
    T_ERROR("No files!");
    return false;
  }

  PleaseWaitDialog pleaseWait(this);
  pleaseWait.SetText("Loading dataset, please wait  ...");
  pleaseWait.AttachLabel(&m_MasterController);

  // First check to make sure the list of files we've been given makes sense.
  for(QStringList::const_iterator fn = files.begin();
      fn != files.end(); ++fn) {
    if(fn->isEmpty()) {
      T_ERROR("Empty filelist");
      return false;
    }
    if(!SysTools::FileExists(std::string(fn->toAscii()))) {
      QString strText = tr("File %1 not found.").arg(*fn);
      T_ERROR("%s", strText.toStdString().c_str());
      if(!bNoUserInteraction) {
        ShowCriticalDialog( "Load Error", strText);
      }
      return false;
    }
  }

  // now determine if we've been given a UVF, and can just open it and be done,
  // or if we need to convert the files.
  // If we were given multiple files, we don't need to do any work; we *know*
  // that needs to be converted.
  shared_ptr<LuaScripting> ss(m_MasterController.LuaScript());
  bool needs_conversion = true;
  if(files.size() == 1) {
    // check to see if we need to convert this file to a supported format.

    if(!ss->cexecRet<bool>("tuvok.io.needsConversion",files[0].toStdString())) {
      needs_conversion = false;

      // It might also be the case that the checksum is bad && we need to
      // report an error, but we don't bother with the checksum if they've
      // asked us not to in the preferences.
      if(!m_bQuickopen && 
         false == ss->cexecRet<bool>("tuvok.io.verify", files[0].toStdString()))
      {
        QString strText = tr("File %1 appears to be a broken UVF file: "
                             "the header looks ok, "
                             "but the checksum does not match.").arg(files[0]);
        T_ERROR("%s", strText.toStdString().c_str());
        if (!bNoUserInteraction) {
          ShowCriticalDialog("Load Error", strText);
        }
        return false;
      }
    }
  }

  QString filename = files[0];
  if(needs_conversion) {
    if (!bNoUserInteraction && targetFilename.isEmpty()) {
      targetFilename = GetConvFilename(files[0]);
    }
    if (targetFilename.isEmpty()) {
      T_ERROR("User interaction disabled but no targetFilename given");
      return false;
    }

    std::list<std::string> stdfiles;
    for(QStringList::const_iterator fn = files.begin();
        fn != files.end(); ++fn) {
      stdfiles.push_back(std::string(fn->toAscii()));
    }

    PleaseWaitDialog pleaseWait(this);
    pleaseWait.SetText("Converting, please wait  ...");
    pleaseWait.AttachLabel(&m_MasterController);

    try {
      ss->cexec("tuvok.io.convertDataset", stdfiles, 
                std::string(targetFilename.toAscii()), m_strTempDir, 
                bNoUserInteraction, false);
      filename = targetFilename;
    } catch(const tuvok::io::IOException& e) {
      // create a (hopefully) useful error message
      std::ostringstream error;
      error << "Unable to convert ";
      std::copy(stdfiles.begin(), stdfiles.end(),
                std::ostream_iterator<std::string>(error, ", "));
      error << " into " << std::string(targetFilename.toAscii())
            << ": " << e.what();
      T_ERROR("%s", error.str().c_str());
      if(!bNoUserInteraction) {
        ShowCriticalDialog("Conversion Error", QString(error.str().c_str()));
      }

      // now close that dialog and bail.
      pleaseWait.close();
//.........这里部分代码省略.........
开发者ID:RockLobster,项目名称:ImageVis3D,代码行数:101,代码来源:ImageVis3D_FileHandling.cpp


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