aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/qmldesigner/designercore/filemanager/changeimportsvisitor.h
blob: 8fcacef0ce245d29e923942249cca968dcddc5dc (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
// 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 "import.h"
#include "qmlrewriter.h"

namespace QmlDesigner {
namespace Internal {

class ChangeImportsVisitor: public QMLRewriter
{
public:
    ChangeImportsVisitor(QmlDesigner::TextModifier &textModifier, const QString &source);

    bool add(QmlJS::AST::UiProgram *ast, const Import &import);
    bool remove(QmlJS::AST::UiProgram *ast, const Import &import);

private:
    static bool equals(QmlJS::AST::UiImport *ast, const Import &import);

    QString m_source;
};

} // namespace Internal
} // namespace QmlDesigner