forked from qt-creator/qt-creator
CppEditor: Move some related quickfixes into dedicated files
The new file is still too large, but these functions and data structures are so horribly coupled that it will take an extra refactoring round to split them up. Change-Id: I421a3db6dfc74ea78a35d0ccf1a88d782d863b9a Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -95,6 +95,7 @@ add_qtc_plugin(CppEditor
|
||||
insertionpointlocator.cpp insertionpointlocator.h
|
||||
projectinfo.cpp projectinfo.h
|
||||
projectpart.cpp projectpart.h
|
||||
quickfixes/cppcodegenerationquickfixes.cpp quickfixes/cppcodegenerationquickfixes.h
|
||||
quickfixes/cppinsertvirtualmethods.cpp quickfixes/cppinsertvirtualmethods.h
|
||||
quickfixes/cppquickfix.cpp quickfixes/cppquickfix.h
|
||||
quickfixes/cppquickfixassistant.cpp quickfixes/cppquickfixassistant.h
|
||||
|
@@ -219,6 +219,8 @@ QtcPlugin {
|
||||
name: "Quickfixes"
|
||||
prefix: "quickfixes/"
|
||||
files: [
|
||||
"cppcodegenerationquickfixes.cpp",
|
||||
"cppcodegenerationquickfixes.h",
|
||||
"cppinsertvirtualmethods.cpp",
|
||||
"cppinsertvirtualmethods.h",
|
||||
"cppquickfix.cpp",
|
||||
|
5079
src/plugins/cppeditor/quickfixes/cppcodegenerationquickfixes.cpp
Normal file
5079
src/plugins/cppeditor/quickfixes/cppcodegenerationquickfixes.cpp
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,8 @@
|
||||
// Copyright (C) 2024 The Qt Company Ltd.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
||||
|
||||
#pragma once
|
||||
|
||||
namespace CppEditor::Internal {
|
||||
void registerCodeGenerationQuickfixes();
|
||||
} // namespace CppEditor::Internal
|
File diff suppressed because it is too large
Load Diff
@@ -5,6 +5,7 @@
|
||||
|
||||
#include "../cpptoolstestcase.h"
|
||||
#include "cppquickfix.h"
|
||||
#include "cppquickfixsettings.h"
|
||||
|
||||
#include <projectexplorer/headerpath.h>
|
||||
|
||||
@@ -22,6 +23,15 @@ class CppCodeStylePreferences;
|
||||
namespace Internal {
|
||||
namespace Tests {
|
||||
|
||||
class QuickFixSettings
|
||||
{
|
||||
const CppQuickFixSettings original = *CppQuickFixSettings::instance();
|
||||
|
||||
public:
|
||||
CppQuickFixSettings *operator->() { return CppQuickFixSettings::instance(); }
|
||||
~QuickFixSettings() { *CppQuickFixSettings::instance() = original; }
|
||||
};
|
||||
|
||||
class BaseQuickFixTestCase : public CppEditor::Tests::TestCase
|
||||
{
|
||||
public:
|
||||
@@ -47,6 +57,17 @@ private:
|
||||
bool m_restoreHeaderPaths;
|
||||
};
|
||||
|
||||
/// Tests the offered operations provided by a given CppQuickFixFactory
|
||||
class QuickFixOfferedOperationsTest : public BaseQuickFixTestCase
|
||||
{
|
||||
public:
|
||||
QuickFixOfferedOperationsTest(const QList<TestDocumentPtr> &testDocuments,
|
||||
CppQuickFixFactory *factory,
|
||||
const ProjectExplorer::HeaderPaths &headerPaths
|
||||
= ProjectExplorer::HeaderPaths(),
|
||||
const QStringList &expectedOperations = QStringList());
|
||||
};
|
||||
|
||||
/// Tests a concrete QuickFixOperation of a given CppQuickFixFactory
|
||||
class QuickFixOperationTest : public BaseQuickFixTestCase
|
||||
{
|
||||
@@ -76,34 +97,6 @@ private slots:
|
||||
void testGeneric_data();
|
||||
void testGeneric();
|
||||
|
||||
void testGenerateGetterSetterNamespaceHandlingCreate_data();
|
||||
void testGenerateGetterSetterNamespaceHandlingCreate();
|
||||
void testGenerateGetterSetterNamespaceHandlingAddUsing_data();
|
||||
void testGenerateGetterSetterNamespaceHandlingAddUsing();
|
||||
void testGenerateGetterSetterNamespaceHandlingFullyQualify_data();
|
||||
void testGenerateGetterSetterNamespaceHandlingFullyQualify();
|
||||
void testGenerateGetterSetterCustomNames_data();
|
||||
void testGenerateGetterSetterCustomNames();
|
||||
void testGenerateGetterSetterValueTypes_data();
|
||||
void testGenerateGetterSetterValueTypes();
|
||||
void testGenerateGetterSetterCustomTemplate();
|
||||
void testGenerateGetterSetterNeedThis();
|
||||
void testGenerateGetterSetterOfferedFixes_data();
|
||||
void testGenerateGetterSetterOfferedFixes();
|
||||
void testGenerateGetterSetterGeneralTests_data();
|
||||
void testGenerateGetterSetterGeneralTests();
|
||||
void testGenerateGetterSetterOnlyGetter();
|
||||
void testGenerateGetterSetterOnlySetter();
|
||||
void testGenerateGetterSetterAnonymousClass();
|
||||
void testGenerateGetterSetterInlineInHeaderFile();
|
||||
void testGenerateGetterSetterOnlySetterHeaderFileWithIncludeGuard();
|
||||
void testGenerateGetterFunctionAsTemplateArg();
|
||||
void testGenerateGettersSetters_data();
|
||||
void testGenerateGettersSetters();
|
||||
|
||||
void testInsertQtPropertyMembers_data();
|
||||
void testInsertQtPropertyMembers();
|
||||
|
||||
void testInsertMemberFromUse_data();
|
||||
void testInsertMemberFromUse();
|
||||
|
||||
@@ -218,9 +211,6 @@ private slots:
|
||||
void testRemoveUsingNamespaceSimple();
|
||||
void testRemoveUsingNamespaceDifferentSymbols();
|
||||
|
||||
void testGenerateConstructor_data();
|
||||
void testGenerateConstructor();
|
||||
|
||||
void testChangeCommentType_data();
|
||||
void testChangeCommentType();
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -453,39 +453,6 @@ public:
|
||||
void doMatch(const CppQuickFixInterface &interface, TextEditor::QuickFixOperations &result) override;
|
||||
};
|
||||
|
||||
/*!
|
||||
Adds getter and setter functions for a member variable
|
||||
*/
|
||||
class GenerateGetterSetter : public CppQuickFixFactory
|
||||
{
|
||||
public:
|
||||
void doMatch(const CppQuickFixInterface &interface, TextEditor::QuickFixOperations &result) override;
|
||||
};
|
||||
|
||||
/*!
|
||||
Adds getter and setter functions for several member variables
|
||||
*/
|
||||
class GenerateGettersSettersForClass : public CppQuickFixFactory
|
||||
{
|
||||
protected:
|
||||
void setTest() { m_test = true; }
|
||||
|
||||
private:
|
||||
void doMatch(const CppQuickFixInterface &interface,
|
||||
TextEditor::QuickFixOperations &result) override;
|
||||
|
||||
bool m_test = false;
|
||||
};
|
||||
|
||||
/*!
|
||||
Adds missing members for a Q_PROPERTY
|
||||
*/
|
||||
class InsertQtPropertyMembers : public CppQuickFixFactory
|
||||
{
|
||||
public:
|
||||
void doMatch(const CppQuickFixInterface &interface, TextEditor::QuickFixOperations &result) override;
|
||||
};
|
||||
|
||||
/*!
|
||||
Converts a Qt 4 QObject::connect() to Qt 5 style.
|
||||
*/
|
||||
@@ -586,21 +553,6 @@ private:
|
||||
void doMatch(const CppQuickFixInterface &interface, TextEditor::QuickFixOperations &result) override;
|
||||
};
|
||||
|
||||
/*!
|
||||
Generate constructor
|
||||
*/
|
||||
class GenerateConstructor : public CppQuickFixFactory
|
||||
{
|
||||
protected:
|
||||
void setTest() { m_test = true; }
|
||||
|
||||
private:
|
||||
void doMatch(const CppQuickFixInterface &interface,
|
||||
TextEditor::QuickFixOperations &result) override;
|
||||
|
||||
bool m_test = false;
|
||||
};
|
||||
|
||||
//! Converts C-style to C++-style comments and vice versa
|
||||
class ConvertCommentStyle : public CppQuickFixFactory
|
||||
{
|
||||
|
Reference in New Issue
Block a user