File indexing completed on 2024-05-12 04:39:09

0001 /*
0002     SPDX-FileCopyrightText: 2015 Sergey Kalinichev <kalinichev.so.0@gmail.com>
0003 
0004     SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
0005 */
0006 
0007 #ifndef CLANGREFACTORING_H
0008 #define CLANGREFACTORING_H
0009 
0010 #include "clangprivateexport.h"
0011 
0012 #include <language/codegen/basicrefactoring.h>
0013 
0014 class TestRefactoring;
0015 
0016 namespace KDevelop
0017 {
0018 class Declaration;
0019 }
0020 
0021 class KDEVCLANGPRIVATE_EXPORT ClangRefactoring : public KDevelop::BasicRefactoring
0022 {
0023     Q_OBJECT
0024 
0025 public:
0026     explicit ClangRefactoring(QObject* parent = nullptr);
0027 
0028     void fillContextMenu(KDevelop::ContextMenuExtension& extension, KDevelop::Context* context, QWidget* parent) override;
0029 
0030     QString moveIntoSource(const KDevelop::IndexedDeclaration& iDecl);
0031 
0032 public Q_SLOTS:
0033     void executeMoveIntoSourceAction();
0034 
0035 protected:
0036     KDevelop::DocumentChangeSet::ChangeResult applyChangesToDeclarations(const QString& oldName, const QString& newName, KDevelop::DocumentChangeSet& changes, const QList<KDevelop::IndexedDeclaration>& declarations) override;
0037 
0038 private:
0039     friend TestRefactoring;
0040 
0041     bool validCandidateToMoveIntoSource(KDevelop::Declaration* decl);
0042 };
0043 
0044 #endif