blob: efa3a83894196103e1a83914f473ff0859cf1747 (
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) 2019 Sergey Morozov
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#pragma once
#include <cppcheck/cppcheckdiagnostic.h>
#include <cppcheck/cppcheckdiagnosticmanager.h>
#include <debugger/analyzer/detailederrorview.h>
#include <utils/treemodel.h>
namespace Cppcheck::Internal {
class DiagnosticsModel;
class FilePathItem : public Utils::TreeItem
{
public:
explicit FilePathItem(const QString &filePath);
QVariant data(int column, int role) const override;
private:
const QString m_filePath;
};
class DiagnosticItem : public Utils::TreeItem
{
public:
explicit DiagnosticItem(const Diagnostic &diagnostic);
QVariant data(int column, int role) const override;
private:
const Diagnostic m_diagnostic;
};
using BaseModel = Utils::TreeModel<Utils::TreeItem, FilePathItem, DiagnosticItem>;
class DiagnosticsModel : public BaseModel, public CppcheckDiagnosticManager
{
Q_OBJECT
public:
enum Column {DiagnosticColumn};
explicit DiagnosticsModel(QObject *parent = nullptr);
void clear();
void add(const Diagnostic &diagnostic) override;
signals:
void hasDataChanged(bool hasData);
private:
QHash<QString, FilePathItem *> m_filePathToItem;
QSet<Diagnostic> m_diagnostics;
};
} // Cppcheck::Internal
|