本文整理汇总了C++中ProFile::deref方法的典型用法代码示例。如果您正苦于以下问题:C++ ProFile::deref方法的具体用法?C++ ProFile::deref怎么用?C++ ProFile::deref使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ProFile
的用法示例。
在下文中一共展示了ProFile::deref方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: multiVar
void tst_ProFileWriter::multiVar()
{
QDir baseDir(BASE_DIR);
QString input = QLatin1String(
"SOURCES = foo bar\n"
"# comment line\n"
"HEADERS = baz bak"
);
QStringList lines = input.split(QLatin1String("\n"));
QString output = QLatin1String(
"SOURCES = bar\n"
"# comment line\n"
"HEADERS = baz"
);
QStringList files; files
<< QString::fromLatin1(BASE_DIR "/foo")
<< QString::fromLatin1(BASE_DIR "/bak");
QStringList vars; vars << QLatin1String("SOURCES") << QLatin1String("HEADERS");
QMakeVfs vfs;
QMakeParser parser(0, &vfs, &parseHandler);
ProFile *proFile = parser.parsedProBlock(input, QLatin1String(BASE_DIR "/test.pro"), 1);
QVERIFY(proFile);
QmakeProjectManager::Internal::ProWriter::removeFiles(proFile, &lines, baseDir, files, vars);
proFile->deref();
QCOMPARE(lines.join(QLatin1String("\n")), output);
}
示例2: evaluate
static int evaluate(const QString &fileName, const QString &in_pwd, const QString &out_pwd,
bool cumulative, QMakeGlobals *option, QMakeParser *parser, int level)
{
static QSet<QString> visited;
if (visited.contains(fileName))
return 0;
visited.insert(fileName);
ProFileEvaluator visitor(option, parser, &evalHandler);
#ifdef PROEVALUATOR_CUMULATIVE
visitor.setCumulative(cumulative);
#endif
visitor.setOutputDir(out_pwd);
ProFile *pro;
if (!(pro = parser->parsedProFile(fileName)))
return 2;
if (!visitor.accept(pro)) {
pro->deref();
return 2;
}
if (visitor.templateType() == ProFileEvaluator::TT_Subdirs) {
QStringList subdirs = visitor.values(QLatin1String("SUBDIRS"));
subdirs.removeDuplicates();
foreach (const QString &subDirVar, subdirs) {
QString realDir;
const QString subDirKey = subDirVar + QLatin1String(".subdir");
const QString subDirFileKey = subDirVar + QLatin1String(".file");
if (visitor.contains(subDirKey))
realDir = QFileInfo(value(visitor, subDirKey)).filePath();
else if (visitor.contains(subDirFileKey))
realDir = QFileInfo(value(visitor, subDirFileKey)).filePath();
else
realDir = subDirVar;
QFileInfo info(realDir);
if (!info.isAbsolute())
info.setFile(in_pwd + QLatin1Char('/') + realDir);
if (info.isDir())
info.setFile(QString::fromLatin1("%1/%2.pro").arg(info.filePath(), info.fileName()));
if (!info.exists()) {
qDebug() << "Could not find sub dir" << info.filePath();
continue;
}
QString inFile = QDir::cleanPath(info.absoluteFilePath()),
inPwd = QDir::cleanPath(info.path()),
outPwd = QDir::cleanPath(QDir(out_pwd).absoluteFilePath(
QDir(in_pwd).relativeFilePath(info.path())));
int nlevel = level;
if (nlevel >= 0) {
printf("%sReading %s%s\n", QByteArray().fill(' ', nlevel).constData(),
qPrintable(inFile), (inPwd == outPwd) ? "" :
qPrintable(QString(QLatin1String(" [") + outPwd + QLatin1Char(']'))));
fflush(stdout);
nlevel++;
}
evaluate(inFile, inPwd, outPwd, cumulative, option, parser, nlevel);
}
示例3: expand
ProString QMakeProject::expand(const QString &expr, const QString &where, int line)
{
ProString ret;
ProFile *pro = m_parser->parsedProBlock(expr, where, line, QMakeParser::ValueGrammar);
if (pro->isOk()) {
m_current.pro = pro;
m_current.line = 0;
const ushort *tokPtr = pro->tokPtr();
ProStringList result = expandVariableReferences(tokPtr, 1, true);
if (!result.isEmpty())
ret = result.at(0);
}
pro->deref();
return ret;
}
示例4: removes
void tst_ProFileWriter::removes()
{
QFETCH(QStringList, values);
QFETCH(QString, input);
QFETCH(QString, output);
QStringList lines = input.split(QLatin1String("\n"));
QStringList vars; vars << QLatin1String("SOURCES");
QMakeParser parser(0, &parseHandler);
ProFile *proFile = parser.parsedProBlock(QLatin1String(BASE_DIR "/test.pro"), input);
QVERIFY(proFile);
Qt4ProjectManager::Internal::ProWriter::removeVarValues(proFile, &lines, values, vars);
proFile->deref();
QCOMPARE(lines.join(QLatin1String("\n")), output);
}
示例5: adds
void tst_ProFileWriter::adds()
{
QFETCH(int, flags);
QFETCH(QStringList, values);
QFETCH(QString, scope);
QFETCH(QString, input);
QFETCH(QString, output);
QStringList lines = input.isEmpty() ? QStringList() : input.split(QLatin1String("\n"));
QString var = QLatin1String("SOURCES");
QMakeParser parser(0, &parseHandler);
ProFile *proFile = parser.parsedProBlock(QLatin1String(BASE_DIR "/test.pro"), input);
QVERIFY(proFile);
PW::putVarValues(proFile, &lines, values, var, PW::PutFlags(flags), scope);
proFile->deref();
QCOMPARE(lines.join(QLatin1String("\n")), output);
}
示例6: removeFiles
void tst_ProFileWriter::removeFiles()
{
QString input = QLatin1String(
"SOURCES = foo.cpp sub/bar.cpp"
);
QStringList lines = input.split(QLatin1String("\n"));
QString output = QLatin1String(
"SOURCES = foo.cpp"
);
QMakeParser parser(0, &parseHandler);
ProFile *proFile = parser.parsedProBlock(QLatin1String(BASE_DIR "/test.pro"), input);
QVERIFY(proFile);
Qt4ProjectManager::Internal::ProWriter::removeFiles(proFile, &lines, QDir(BASE_DIR),
QStringList() << QString::fromLatin1(BASE_DIR "/sub/bar.cpp"),
QStringList() << QLatin1String("SOURCES") << QLatin1String("HEADERS"));
proFile->deref();
QCOMPARE(lines.join(QLatin1String("\n")), output);
}
示例7: addFiles
void tst_ProFileWriter::addFiles()
{
QString input = QLatin1String(
"SOURCES = foo.cpp"
);
QStringList lines = input.split(QLatin1String("\n"));
QString output = QLatin1String(
"SOURCES = foo.cpp \\\n"
" sub/bar.cpp"
);
QMakeVfs vfs;
QMakeParser parser(0, &vfs, &parseHandler);
ProFile *proFile = parser.parsedProBlock(input, QLatin1String(BASE_DIR "/test.pro"), 1);
QVERIFY(proFile);
QmakeProjectManager::Internal::ProWriter::addFiles(proFile, &lines,
QStringList() << QString::fromLatin1(BASE_DIR "/sub/bar.cpp"),
QLatin1String("SOURCES"));
proFile->deref();
QCOMPARE(lines.join(QLatin1String("\n")), output);
}
示例8: tr
void S60PublisherOvi::completeCreation()
{
#if 0 // FIXME: This needs serious reworking!
// set active target
m_activeTargetOfProject = qobject_cast<Qt4SymbianTarget *>(m_qt4bc->target());
QTC_ASSERT(m_activeTargetOfProject, return);
//set up project
m_qt4project = m_activeTargetOfProject->qt4Project();
// set up pro file reader
m_reader = m_qt4project->createProFileReader(m_qt4project->rootQt4ProjectNode(), m_qt4bc);
//m_reader->setCumulative(false); // todo need to reenable that, after fixing parsing for symbian scopes
ProFile *profile = m_reader->parsedProFile(m_qt4project->rootProjectNode()->path());
m_reader->accept(profile, QMakeEvaluator::LoadProOnly);
profile->deref();
// set up process for creating the resulting SIS files
ProjectExplorer::AbstractProcessStep * makeStep = m_qt4bc->makeStep();
makeStep->init();
const ProjectExplorer::ProcessParameters * const makepp = makeStep->processParameters();
ProjectExplorer::AbstractProcessStep *qmakeStep = m_qt4bc->qmakeStep();
qmakeStep->init();
const ProjectExplorer::ProcessParameters * const qmakepp = qmakeStep->processParameters();
m_publishSteps.clear();
const QChar space = QLatin1Char(' ');
m_publishSteps.append(new S60CommandPublishStep(*m_qt4bc,
makepp->effectiveCommand() + QLatin1String(" clean -w"),
tr("Clean"),
false));
m_publishSteps.append(new S60CommandPublishStep(*m_qt4bc,
qmakepp->effectiveCommand() + space + qmakepp->arguments(),
tr("qmake")));
m_publishSteps.append(new S60CommandPublishStep(*m_qt4bc,
makepp->effectiveCommand() + space + makepp->arguments(),
tr("Build")));
if (isDynamicLibrary(*m_qt4project)) {
const QString freezeArg = QLatin1String("freeze-") + makepp->arguments();
m_publishSteps.append(new S60CommandPublishStep(*m_qt4bc,
makepp->effectiveCommand() + space + freezeArg,
tr("Freeze")));
m_publishSteps.append(new S60CommandPublishStep(*m_qt4bc,
makepp->effectiveCommand() + QLatin1String(" clean -w"),
tr("Secondary clean"),
false));
m_publishSteps.append(new S60CommandPublishStep(*m_qt4bc,
qmakepp->effectiveCommand() + space + qmakepp->arguments(),
tr("Secondary qmake")));
m_publishSteps.append(new S60CommandPublishStep(*m_qt4bc,
makepp->effectiveCommand() + space + makepp->arguments(),
tr("Secondary build")));
}
QString signArg = QLatin1String("unsigned_installer_sis");
if (m_qt4bc->qtVersion()->qtVersion() == QtSupport::QtVersionNumber(4,6,3) )
signArg = QLatin1String("installer_sis");
m_publishSteps.append(new S60CommandPublishStep(*m_qt4bc,
makepp->effectiveCommand() + space + signArg,
tr("Making SIS file")));
// set up access to vendor names
QStringList deploymentLevelVars = m_reader->values(QLatin1String("DEPLOYMENT"));
QStringList vendorInfoVars;
QStringList valueLevelVars;
foreach (const QString &deploymentLevelVar, deploymentLevelVars) {
vendorInfoVars = m_reader->values(deploymentLevelVar+QLatin1String(".pkg_prerules"));
foreach (const QString &vendorInfoVar, vendorInfoVars) {
valueLevelVars = m_reader->values(vendorInfoVar);
foreach (const QString &valueLevelVar, valueLevelVars) {
if (valueLevelVar.startsWith(QLatin1String("%{\""))) {
m_vendorInfoVariable = vendorInfoVar;
break;
}
}
}
示例9: main
//.........这里部分代码省略.........
QStringList inputFiles;
QString outputFile;
for (int i = 1; i < argc; ++i) {
if (!strcmp(argv[i], "-compress")) {
cd.m_saveMode = SaveStripped;
continue;
} else if (!strcmp(argv[i], "-idbased")) {
cd.m_idBased = true;
continue;
} else if (!strcmp(argv[i], "-nocompress")) {
cd.m_saveMode = SaveEverything;
continue;
} else if (!strcmp(argv[i], "-removeidentical")) {
removeIdentical = true;
continue;
} else if (!strcmp(argv[i], "-nounfinished")) {
cd.m_ignoreUnfinished = true;
continue;
} else if (!strcmp(argv[i], "-markuntranslated")) {
if (i == argc - 1) {
printUsage();
return 1;
}
cd.m_unTrPrefix = QString::fromLocal8Bit(argv[++i]);
} else if (!strcmp(argv[i], "-silent")) {
cd.m_verbose = false;
continue;
} else if (!strcmp(argv[i], "-verbose")) {
cd.m_verbose = true;
continue;
} else if (!strcmp(argv[i], "-version")) {
printOut(LR::tr("lrelease version %1\n").arg(QLatin1String(QT_VERSION_STR)));
return 0;
} else if (!strcmp(argv[i], "-qm")) {
if (i == argc - 1) {
printUsage();
return 1;
}
outputFile = QString::fromLocal8Bit(argv[++i]);
} else if (!strcmp(argv[i], "-help")) {
printUsage();
return 0;
} else if (argv[i][0] == '-') {
printUsage();
return 1;
} else {
inputFiles << QString::fromLocal8Bit(argv[i]);
}
}
if (inputFiles.isEmpty()) {
printUsage();
return 1;
}
foreach (const QString &inputFile, inputFiles) {
if (inputFile.endsWith(QLatin1String(".pro"), Qt::CaseInsensitive)
|| inputFile.endsWith(QLatin1String(".pri"), Qt::CaseInsensitive)) {
QFileInfo fi(inputFile);
parseHandler.verbose = evalHandler.verbose = cd.isVerbose();
ProFileOption option;
#ifdef QT_BOOTSTRAPPED
option.initProperties(binDir + QLatin1String("/qmake"));
#else
option.initProperties(app.applicationDirPath() + QLatin1String("/qmake"));
#endif
ProFileParser parser(0, &parseHandler);
ProFileEvaluator visitor(&option, &parser, &evalHandler);
ProFile *pro;
if (!(pro = parser.parsedProFile(QDir::cleanPath(fi.absoluteFilePath())))) {
printErr(LR::tr(
"lrelease error: cannot read project file '%1'.\n")
.arg(inputFile));
continue;
}
if (!visitor.accept(pro)) {
printErr(LR::tr(
"lrelease error: cannot process project file '%1'.\n")
.arg(inputFile));
pro->deref();
continue;
}
pro->deref();
QStringList translations = visitor.values(QLatin1String("TRANSLATIONS"));
if (translations.isEmpty()) {
printErr(LR::tr(
"lrelease warning: Met no 'TRANSLATIONS' entry in project file '%1'\n")
.arg(inputFile));
} else {
QDir proDir(fi.absolutePath());
foreach (const QString &trans, translations)
if (!releaseTsFile(QFileInfo(proDir, trans).filePath(), cd, removeIdentical))
return 1;
}
} else {
if (outputFile.isEmpty()) {