本文整理汇总了C++中QScopedPointer::exactMatch方法的典型用法代码示例。如果您正苦于以下问题:C++ QScopedPointer::exactMatch方法的具体用法?C++ QScopedPointer::exactMatch怎么用?C++ QScopedPointer::exactMatch使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QScopedPointer
的用法示例。
在下文中一共展示了QScopedPointer::exactMatch方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: findLocalRepository
// Try to find a matching repository for a project by asking the VcsManager.
QString GerritPlugin::findLocalRepository(QString project, const QString &branch) const
{
const QStringList gitRepositories = VcsManager::repositories(GitPlugin::instance()->gitVersionControl());
// Determine key (file name) to look for (qt/qtbase->'qtbase').
const int slashPos = project.lastIndexOf('/');
if (slashPos != -1)
project.remove(0, slashPos + 1);
// When looking at branch 1.7, try to check folders
// "qtbase_17", 'qtbase1.7' with a semi-smart regular expression.
QScopedPointer<QRegExp> branchRegexp;
if (!branch.isEmpty() && branch != "master") {
QString branchPattern = branch;
branchPattern.replace('.', "[\\.-_]?");
const QString pattern = '^' + project
+ "[-_]?"
+ branchPattern + '$';
branchRegexp.reset(new QRegExp(pattern));
if (!branchRegexp->isValid())
branchRegexp.reset(); // Oops.
}
for (const QString &repository : gitRepositories) {
const QString fileName = Utils::FileName::fromString(repository).fileName();
if ((!branchRegexp.isNull() && branchRegexp->exactMatch(fileName))
|| fileName == project) {
// Perform a check on the branch.
if (branch.isEmpty()) {
return repository;
} else {
const QString repositoryBranch = GerritPlugin::branch(repository);
if (repositoryBranch.isEmpty() || repositoryBranch == branch)
return repository;
} // !branch.isEmpty()
} // branchRegexp or file name match
} // for repositories
// No match, do we have a projects folder?
if (DocumentManager::useProjectsDirectory())
return DocumentManager::projectsDirectory().toString();
return QDir::currentPath();
}