blob: 1920659004c238c7e6d6416ef539479e830907e4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#pragma once
#include "cppprojectfile.h"
#include <projectexplorer/rawprojectpart.h>
#include <QString>
#include <QVector>
namespace CppEditor {
class CPPEDITOR_EXPORT ProjectFileCategorizer
{
public:
using FileIsActive = ProjectExplorer::RawProjectPart::FileIsActive;
using GetMimeType = ProjectExplorer::RawProjectPart::GetMimeType;
public:
ProjectFileCategorizer(const QString &projectPartName,
const QStringList &filePaths,
const FileIsActive &fileIsActive = {},
const GetMimeType &getMimeType = {});
bool hasCSources() const { return !m_cSources.isEmpty(); }
bool hasCxxSources() const { return !m_cxxSources.isEmpty(); }
bool hasObjcSources() const { return !m_objcSources.isEmpty(); }
bool hasObjcxxSources() const { return !m_objcxxSources.isEmpty(); }
ProjectFiles cSources() const { return m_cSources; }
ProjectFiles cxxSources() const { return m_cxxSources; }
ProjectFiles objcSources() const { return m_objcSources; }
ProjectFiles objcxxSources() const { return m_objcxxSources; }
bool hasMultipleParts() const { return m_partCount > 1; }
bool hasParts() const { return m_partCount > 0; }
QString partName(const QString &languageName) const;
private:
ProjectFiles classifyFiles(const QStringList &filePaths,
const FileIsActive &fileIsActive,
const GetMimeType &getMimeType);
void expandSourcesWithAmbiguousHeaders(const ProjectFiles &ambiguousHeaders);
private:
QString m_partName;
ProjectFiles m_cSources;
ProjectFiles m_cxxSources;
ProjectFiles m_objcSources;
ProjectFiles m_objcxxSources;
int m_partCount;
};
} // namespace CppEditor
|