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
|
|
|
|
2012-02-07 15:09:08 +01:00
|
|
|
#include <cpptools/cppsemanticinfo.h>
|
2014-09-04 00:04:18 +02:00
|
|
|
#include <texteditor/codeassist/assistinterface.h>
|
2011-04-15 16:19:23 +02:00
|
|
|
#include <texteditor/codeassist/quickfixassistprovider.h>
|
|
|
|
|
#include <texteditor/codeassist/quickfixassistprocessor.h>
|
|
|
|
|
|
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
|
|
|
|
2011-04-15 16:19:23 +02:00
|
|
|
namespace CppTools {
|
|
|
|
|
class CppRefactoringFile;
|
2011-08-17 11:35:57 +02:00
|
|
|
typedef QSharedPointer<CppRefactoringFile> CppRefactoringFilePtr;
|
2011-04-15 16:19:23 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
namespace CppEditor {
|
|
|
|
|
namespace Internal {
|
|
|
|
|
|
2014-07-30 16:30:31 +02:00
|
|
|
class CppEditorWidget;
|
2011-04-15 16:19:23 +02:00
|
|
|
|
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;
|
2012-02-07 15:09:08 +01:00
|
|
|
CppTools::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
|
|
|
|
2011-08-17 11:35:57 +02:00
|
|
|
CppTools::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;
|
2012-02-07 15:09:08 +01:00
|
|
|
CppTools::SemanticInfo m_semanticInfo;
|
2011-04-15 16:19:23 +02:00
|
|
|
CPlusPlus::Snapshot m_snapshot;
|
2011-08-17 11:35:57 +02:00
|
|
|
CppTools::CppRefactoringFilePtr m_currentFile;
|
2011-04-15 16:19:23 +02:00
|
|
|
CPlusPlus::LookupContext m_context;
|
|
|
|
|
QList<CPlusPlus::AST *> m_path;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class CppQuickFixAssistProvider : public TextEditor::QuickFixAssistProvider
|
|
|
|
|
{
|
|
|
|
|
public:
|
2016-03-16 13:04:05 +01:00
|
|
|
CppQuickFixAssistProvider(QObject *parent = 0) : TextEditor::QuickFixAssistProvider(parent) {}
|
2015-06-03 15:32:45 +02:00
|
|
|
IAssistProvider::RunType runType() const override;
|
|
|
|
|
TextEditor::IAssistProcessor *createProcessor() const override;
|
2011-04-15 16:19:23 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // Internal
|
|
|
|
|
} // CppEditor
|