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
12using namespace Qt::Literals::StringLiterals;
13
14inline bool isProOrPriFile(const QString &filePath)
15{
16 return filePath.endsWith(s: ".pro"_L1, cs: Qt::CaseInsensitive)
17 || filePath.endsWith(s: ".pri"_L1, cs: Qt::CaseInsensitive);
18}
19
20inline QStringList extractProFiles(QStringList *files)
21{
22 QStringList result;
23 auto it = std::remove_if(first: files->begin(), last: files->end(), pred: &isProOrPriFile);
24 if (it == files->end())
25 return result;
26 std::move(first: it, last: files->end(), result: std::back_inserter(x&: result));
27 files->erase(abegin: it, aend: files->end());
28 return result;
29}
30
31#endif // PROFILEUTILS_H
32

source code of qttools/src/linguist/shared/profileutils.h