blob: c7c7cb4e8c7f595aa1efb6d7e58494f56e5ce59c (
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
|
// 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 "cppeditor_global.h"
#include <utils/filepath.h>
#include <utils/id.h>
#include <utils/store.h>
#include <utils/qtcsettings.h>
#include <QStringList>
namespace ProjectExplorer { class Project; }
namespace CppEditor {
enum class UsePrecompiledHeaders;
class CPPEDITOR_EXPORT CppCodeModelSettings
{
public:
enum PCHUsage {
PchUse_None = 1,
PchUse_BuildSystem = 2
};
CppCodeModelSettings() = default;
CppCodeModelSettings(const Utils::Store &store) { fromMap(store); }
friend bool operator==(const CppCodeModelSettings &s1, const CppCodeModelSettings &s2);
friend bool operator!=(const CppCodeModelSettings &s1, const CppCodeModelSettings &s2)
{
return !(s1 == s2);
}
Utils::Store toMap() const;
void fromMap(const Utils::Store &store);
static CppCodeModelSettings settingsForProject(const ProjectExplorer::Project *project);
static CppCodeModelSettings settingsForProject(const Utils::FilePath &projectFile);
static CppCodeModelSettings settingsForFile(const Utils::FilePath &file);
static const CppCodeModelSettings &global() { return globalInstance(); }
static void setGlobal(const CppCodeModelSettings &settings);
static PCHUsage pchUsageForProject(const ProjectExplorer::Project *project);
UsePrecompiledHeaders usePrecompiledHeaders() const;
static UsePrecompiledHeaders usePrecompiledHeaders(const ProjectExplorer::Project *project);
int effectiveIndexerFileSizeLimitInMb() const;
static bool categorizeFindReferences();
static void setCategorizeFindReferences(bool categorize);
QString ignorePattern;
PCHUsage pchUsage = PchUse_BuildSystem;
int indexerFileSizeLimitInMb = 5;
bool interpretAmbigiousHeadersAsC = false;
bool skipIndexingBigFiles = true;
bool useBuiltinPreprocessor = true;
bool ignoreFiles = false;
bool m_categorizeFindReferences = false; // Ephemeral!
private:
CppCodeModelSettings(Utils::QtcSettings *s) { fromSettings(s); }
static CppCodeModelSettings &globalInstance();
void toSettings(Utils::QtcSettings *s);
void fromSettings(Utils::QtcSettings *s);
};
class CppCodeModelProjectSettings
{
public:
CppCodeModelProjectSettings(ProjectExplorer::Project *project);
CppCodeModelSettings settings() const;
void setSettings(const CppCodeModelSettings &settings);
bool useGlobalSettings() const { return m_useGlobalSettings; }
void setUseGlobalSettings(bool useGlobal);
private:
void loadSettings();
void saveSettings();
ProjectExplorer::Project * const m_project;
CppCodeModelSettings m_customSettings;
bool m_useGlobalSettings = true;
};
namespace Internal {
void setupCppCodeModelSettingsPage();
void setupCppCodeModelProjectSettingsPanel();
} // namespace Internal
} // namespace CppEditor
|