| 1 | // Copyright (C) 2018 The Qt Company Ltd. |
|---|---|
| 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 |
| 3 | |
| 4 | #ifndef PROFILEUTILS_H |
| 5 | #define PROFILEUTILS_H |
| 6 | |
| 7 | #include <QtCore/qstring.h> |
| 8 | #include <QtCore/qstringlist.h> |
| 9 | |
| 10 | #include <algorithm> |
| 11 | |
| 12 | inline bool isProOrPriFile(const QString &filePath) |
| 13 | { |
| 14 | return filePath.endsWith(s: QLatin1String(".pro"), cs: Qt::CaseInsensitive) |
| 15 | || filePath.endsWith(s: QLatin1String(".pri"), cs: Qt::CaseInsensitive); |
| 16 | } |
| 17 | |
| 18 | inline QStringList extractProFiles(QStringList *files) |
| 19 | { |
| 20 | QStringList result; |
| 21 | auto it = std::remove_if(first: files->begin(), last: files->end(), pred: &isProOrPriFile); |
| 22 | if (it == files->end()) |
| 23 | return result; |
| 24 | std::move(first: it, last: files->end(), result: std::back_inserter(x&: result)); |
| 25 | files->erase(abegin: it, aend: files->end()); |
| 26 | return result; |
| 27 | } |
| 28 | |
| 29 | #endif // PROFILEUTILS_H |
| 30 |
