2012-10-02 09:12:39 +02:00
|
|
|
/****************************************************************************
|
2011-04-15 16:19:23 +02:00
|
|
|
**
|
2016-01-15 14:57:40 +01:00
|
|
|
** Copyright (C) 2016 The Qt Company Ltd.
|
|
|
|
|
** Contact: https://www.qt.io/licensing/
|
2011-04-15 16:19:23 +02:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** This file is part of Qt Creator.
|
2011-04-15 16:19:23 +02:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** Commercial License Usage
|
|
|
|
|
** Licensees holding valid commercial Qt licenses may use this file in
|
|
|
|
|
** accordance with the commercial license agreement provided with the
|
|
|
|
|
** Software or, alternatively, in accordance with the terms contained in
|
2016-01-15 14:57:40 +01:00
|
|
|
** a written agreement between you and The Qt Company. For licensing terms
|
|
|
|
|
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
|
|
|
** information use the contact form at https://www.qt.io/contact-us.
|
2011-04-15 16:19:23 +02:00
|
|
|
**
|
2016-01-15 14:57:40 +01:00
|
|
|
** GNU General Public License Usage
|
|
|
|
|
** Alternatively, this file may be used under the terms of the GNU
|
|
|
|
|
** General Public License version 3 as published by the Free Software
|
|
|
|
|
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
|
|
|
** included in the packaging of this file. Please review the following
|
|
|
|
|
** information to ensure the GNU General Public License requirements will
|
|
|
|
|
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
2011-04-15 16:19:23 +02:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
****************************************************************************/
|
2011-04-15 16:19:23 +02:00
|
|
|
|
2016-03-18 07:55:01 +01:00
|
|
|
#pragma once
|
2011-04-15 16:19:23 +02:00
|
|
|
|
2021-08-30 10:58:08 +02:00
|
|
|
#include "cppsemanticinfo.h"
|
2017-12-15 09:46:29 +01:00
|
|
|
|
2014-09-04 00:04:18 +02:00
|
|
|
#include <texteditor/codeassist/assistinterface.h>
|
2017-12-15 09:46:29 +01:00
|
|
|
#include <texteditor/codeassist/iassistprovider.h>
|
2011-04-15 16:19:23 +02:00
|
|
|
|
2013-04-09 10:40:18 +02:00
|
|
|
#include <cplusplus/LookupContext.h>
|
2013-03-27 18:54:03 +01:00
|
|
|
|
2014-02-17 19:23:20 +02:00
|
|
|
|
2021-08-30 10:58:08 +02:00
|
|
|
namespace CppEditor {
|
2021-09-01 18:08:54 +02:00
|
|
|
class CppEditorWidget;
|
2011-04-15 16:19:23 +02:00
|
|
|
class CppRefactoringFile;
|
2019-02-07 11:04:13 +01:00
|
|
|
using CppRefactoringFilePtr = QSharedPointer<CppRefactoringFile>;
|
2011-04-15 16:19:23 +02:00
|
|
|
|
|
|
|
|
namespace Internal {
|
|
|
|
|
|
2014-09-21 01:05:00 +02:00
|
|
|
class CppQuickFixInterface : public TextEditor::AssistInterface
|
2011-04-15 16:19:23 +02:00
|
|
|
{
|
|
|
|
|
public:
|
2014-09-21 01:05:00 +02:00
|
|
|
CppQuickFixInterface(CppEditorWidget *editor, TextEditor::AssistReason reason);
|
2011-04-15 16:19:23 +02:00
|
|
|
|
|
|
|
|
const QList<CPlusPlus::AST *> &path() const;
|
|
|
|
|
CPlusPlus::Snapshot snapshot() const;
|
2021-08-30 10:58:08 +02:00
|
|
|
SemanticInfo semanticInfo() const;
|
2011-04-15 16:19:23 +02:00
|
|
|
const CPlusPlus::LookupContext &context() const;
|
2014-07-30 16:30:31 +02:00
|
|
|
CppEditorWidget *editor() const;
|
2011-04-15 16:19:23 +02:00
|
|
|
|
2021-08-30 10:58:08 +02:00
|
|
|
CppRefactoringFilePtr currentFile() const;
|
2011-04-15 16:19:23 +02:00
|
|
|
|
|
|
|
|
bool isCursorOn(unsigned tokenIndex) const;
|
|
|
|
|
bool isCursorOn(const CPlusPlus::AST *ast) const;
|
|
|
|
|
|
|
|
|
|
private:
|
2014-07-30 16:30:31 +02:00
|
|
|
CppEditorWidget *m_editor;
|
2021-08-30 10:58:08 +02:00
|
|
|
SemanticInfo m_semanticInfo;
|
2011-04-15 16:19:23 +02:00
|
|
|
CPlusPlus::Snapshot m_snapshot;
|
2021-08-30 10:58:08 +02:00
|
|
|
CppRefactoringFilePtr m_currentFile;
|
2011-04-15 16:19:23 +02:00
|
|
|
CPlusPlus::LookupContext m_context;
|
|
|
|
|
QList<CPlusPlus::AST *> m_path;
|
|
|
|
|
};
|
|
|
|
|
|
2017-12-15 09:46:29 +01:00
|
|
|
class CppQuickFixAssistProvider : public TextEditor::IAssistProvider
|
2011-04-15 16:19:23 +02:00
|
|
|
{
|
|
|
|
|
public:
|
2018-02-07 14:51:15 +01:00
|
|
|
CppQuickFixAssistProvider() = default;
|
2015-06-03 15:32:45 +02:00
|
|
|
IAssistProvider::RunType runType() const override;
|
2021-09-15 07:04:12 +02:00
|
|
|
TextEditor::IAssistProcessor *createProcessor(const TextEditor::AssistInterface *) const override;
|
2011-04-15 16:19:23 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // Internal
|
|
|
|
|
} // CppEditor
|