aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/qmljseditor/qmljstextmark.h
blob: e173260d703d003338996e8dfa894d2c117041d3 (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
// Copyright (C) 2017 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 <qmljs/qmljsdocument.h>
#include <qmljs/qmljsstaticanalysismessage.h>

#include <texteditor/textmark.h>

namespace QmlJSEditor {
namespace Internal {

class QmlJSTextMark : public TextEditor::TextMark
{
public:
    using RemovedFromEditorHandler = std::function<void(QmlJSTextMark *)>;

    QmlJSTextMark(const Utils::FilePath &fileName,
                  const QmlJS::DiagnosticMessage &diagnostic,
                  const RemovedFromEditorHandler &removedHandler);
    QmlJSTextMark(const Utils::FilePath &fileName,
                  const QmlJS::StaticAnalysis::Message &message,
                  const RemovedFromEditorHandler &removedHandler);

private:
    void removedFromEditor() override;
    void init(bool warning, const QString &message);

private:
    RemovedFromEditorHandler m_removedFromEditorHandler;
};

} // namespace Internal
} // namespace QmlJSEditor