// Copyright (C) 2019 Sergey Morozov // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0 #pragma once #include #include #include #include namespace Cppcheck { namespace 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; 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 m_filePathToItem; QSet m_diagnostics; }; } // namespace Internal } // namespace Cppcheck