本文整理汇总了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();
}
示例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();
//.........这里部分代码省略.........