本文整理汇总了C++中Preferences::getFoldUnary方法的典型用法代码示例。如果您正苦于以下问题:C++ Preferences::getFoldUnary方法的具体用法?C++ Preferences::getFoldUnary怎么用?C++ Preferences::getFoldUnary使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Preferences
的用法示例。
在下文中一共展示了Preferences::getFoldUnary方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: run
void SpinCompiler::run()
{
Preferences pref;
errors.clear();
QFile sf;
QFile df;
QString tmpName;
CompilerTempFile tmpFile;
if (!tmpFile.status()) {
SpinError err(tr("Cannot create temp directory %1").arg(tmpName), "", -1, -1);
err.severity = SpinError::Error;
errors.append(err);
status = CompileError;
return;
}
tmpName = tmpFile.name();
QString topFile;
SpinPreprocessor prepro(srcFileName, pref.getEncoding());
prepro.setSearchPath(pref.getSearchPath());
PreprocessedFiles files = prepro.findFiles();
for (int i = 0; i < files.size(); i++) {
QString src = files.at(i).fileName;
QFileInfo info(src);
QString dst = tmpName + info.fileName();
if (i == 0) topFile = dst;
df.setFileName(dst);
df.open(QIODevice::WriteOnly);
df.write(files.at(i).data);
sf.close();
df.close();
}
binaryFileContent.clear();
eepromFileContent.clear();
listing = "";
bstcOutput.clear();
QString baseName;
QStringList args;
QFileInfo info(srcFileName);
baseName = QDir::toNativeSeparators(tmpName + info.completeBaseName());
QStringList defines = pref.getDefines().split(QRegExp("\\s+"));
args << defines;
if (pref.getInfo()) args << "-w2";
else if (pref.getWarnings()) args << "-w1";
else args << "-w0";
QString opt("");
if (pref.getFastConstants()) opt += "b";
if (pref.getFoldConstants()) opt += "c";
if (pref.getGenericSafe()) opt += "g";
if (pref.getEliminateUnused()) opt += "r";
if (pref.getFoldUnary()) opt += "u";
if (pref.getNonParallaxExt()) opt += "x";
if (!opt.isEmpty()) args << (QString("-O") + opt);
QStringList paths = pref.getSearchPath();
for (int i=0; i < paths.size(); i++) {
args << "-L" << paths[i];
}
args << "-q";
if (dest & EEPROM) args << "-e";
args << "-b";
args << "-lm";
args << topFile;
bstc = runCompiler(tmpName, args);
if (!bstc) return;
while (bstc->bytesAvailable()) bstcOutput.append(bstc->readLine());
parseOutput();
qSort(errors);
if (bstc->exitCode()) {
status = CompileError;
return;
}
if (dest & EEPROM) {
QFile f(baseName + ".eeprom");
f.open(QIODevice::ReadOnly);
eepromFileContent = f.readAll();
}
{
QFile f(baseName + ".binary");
f.open(QIODevice::ReadOnly);
binaryFileContent = f.readAll();
}
QFile f(baseName + ".list");
f.open(QIODevice::ReadOnly);
listing = QString(f.readAll());
f.close();
parseListFile();
}