2022-08-19 15:59:36 +02:00
|
|
|
// Copyright (C) 2016 The Qt Company Ltd.
|
|
|
|
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
|
2015-08-24 18:26:09 +02:00
|
|
|
|
2016-03-18 07:55:01 +01:00
|
|
|
#pragma once
|
2015-08-24 18:26:09 +02:00
|
|
|
|
2022-05-02 12:29:57 +02:00
|
|
|
#include "clangutils.h"
|
2015-08-24 18:26:09 +02:00
|
|
|
|
2022-05-02 12:29:57 +02:00
|
|
|
#include <texteditor/quickfix.h>
|
2015-12-02 20:07:29 +01:00
|
|
|
|
2015-08-24 18:26:09 +02:00
|
|
|
#include <utils/changeset.h>
|
|
|
|
|
|
|
|
|
|
#include <QVector>
|
2015-12-02 20:07:29 +01:00
|
|
|
#include <QSharedPointer>
|
|
|
|
|
|
2019-02-06 16:17:03 +01:00
|
|
|
namespace TextEditor {
|
2016-06-27 10:45:51 +02:00
|
|
|
class RefactoringChanges;
|
2015-12-02 20:07:29 +01:00
|
|
|
class RefactoringFile;
|
|
|
|
|
}
|
2015-08-24 18:26:09 +02:00
|
|
|
|
|
|
|
|
namespace ClangCodeModel {
|
2019-02-06 16:17:03 +01:00
|
|
|
namespace Internal {
|
2015-08-24 18:26:09 +02:00
|
|
|
|
|
|
|
|
class ClangFixItOperation : public TextEditor::QuickFixOperation
|
|
|
|
|
{
|
|
|
|
|
public:
|
2022-05-02 12:29:57 +02:00
|
|
|
ClangFixItOperation(const QString &fixItText, const QList<ClangFixIt> &fixIts);
|
2015-08-24 18:26:09 +02:00
|
|
|
|
|
|
|
|
int priority() const override;
|
|
|
|
|
QString description() const override;
|
|
|
|
|
void perform() override;
|
|
|
|
|
|
2016-06-27 10:45:51 +02:00
|
|
|
QString firstRefactoringFileContent_forTestOnly() const;
|
2015-12-02 20:07:29 +01:00
|
|
|
|
|
|
|
|
private:
|
2016-06-27 10:45:51 +02:00
|
|
|
void applyFixitsToFile(TextEditor::RefactoringFile &refactoringFile,
|
2022-05-02 12:29:57 +02:00
|
|
|
const QList<ClangFixIt> fixIts);
|
|
|
|
|
Utils::ChangeSet toChangeSet(TextEditor::RefactoringFile &refactoringFile,
|
|
|
|
|
const QList<ClangFixIt> fixIts) const;
|
2015-08-24 18:26:09 +02:00
|
|
|
|
|
|
|
|
private:
|
2022-05-02 12:29:57 +02:00
|
|
|
QString fixItText;
|
2016-06-27 10:45:51 +02:00
|
|
|
QVector<QSharedPointer<TextEditor::RefactoringFile>> refactoringFiles;
|
2022-05-02 12:29:57 +02:00
|
|
|
QList<ClangFixIt> fixIts;
|
2015-08-24 18:26:09 +02:00
|
|
|
};
|
|
|
|
|
|
2019-02-06 16:17:03 +01:00
|
|
|
} // namespace Internal
|
2015-08-24 18:26:09 +02:00
|
|
|
} // namespace ClangCodeModel
|