aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/cppeditor/clangdiagnosticconfigsmodel.h
blob: 1fc602dca6cf3c8b777f65348dffe1ace1f3f720 (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
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0

#pragma once

#include "cppeditor_global.h"

#include "clangdiagnosticconfig.h"

#include <QVector>

namespace CppEditor {

class CPPEDITOR_EXPORT ClangDiagnosticConfigsModel
{
public:
    ClangDiagnosticConfigsModel() = default;
    explicit ClangDiagnosticConfigsModel(const ClangDiagnosticConfigs &configs);

    int size() const;
    const ClangDiagnosticConfig &at(int index) const;

    void appendOrUpdate(const ClangDiagnosticConfig &config);
    void removeConfigWithId(const Utils::Id &id);

    ClangDiagnosticConfigs allConfigs() const;
    ClangDiagnosticConfigs customConfigs() const;

    bool hasConfigWithId(const Utils::Id &id) const;
    const ClangDiagnosticConfig &configWithId(const Utils::Id &id) const;
    int indexOfConfig(const Utils::Id &id) const;

    static ClangDiagnosticConfig createCustomConfig(const ClangDiagnosticConfig &baseConfig,
                                                    const QString &displayName);
    static QStringList globalDiagnosticOptions();

private:
    ClangDiagnosticConfigs m_diagnosticConfigs;
};

} // namespace CppEditor