CppEditor: Hide CppRefactoringChangesData

Change-Id: I5d88651a9b3a295bd95de5ee5e9b117e449195b3
Reviewed-by: David Schulz <david.schulz@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
This commit is contained in:
Christian Kandeler
2023-11-17 13:26:13 +01:00
parent ac952955a4
commit b8c2be4cf8
2 changed files with 19 additions and 17 deletions

View File

@@ -4,6 +4,7 @@
#include "cpprefactoringchanges.h" #include "cpprefactoringchanges.h"
#include "cppeditorconstants.h" #include "cppeditorconstants.h"
#include "cppworkingcopy.h"
#include <projectexplorer/editorconfiguration.h> #include <projectexplorer/editorconfiguration.h>
@@ -22,6 +23,18 @@ using namespace CPlusPlus;
using namespace Utils; using namespace Utils;
namespace CppEditor { namespace CppEditor {
namespace Internal {
class CppRefactoringChangesData
{
public:
explicit CppRefactoringChangesData(const CPlusPlus::Snapshot &snapshot);
CPlusPlus::Snapshot m_snapshot;
WorkingCopy m_workingCopy;
};
} // namespace Internal
using namespace Internal;
static std::unique_ptr<TextEditor::Indenter> createIndenter(const FilePath &filePath, static std::unique_ptr<TextEditor::Indenter> createIndenter(const FilePath &filePath,
QTextDocument *textDocument) QTextDocument *textDocument)

View File

@@ -6,22 +6,19 @@
#include "cppeditor_global.h" #include "cppeditor_global.h"
#include "cppmodelmanager.h" #include "cppmodelmanager.h"
#include "cppworkingcopy.h"
#include <cplusplus/CppDocument.h> #include <cplusplus/CppDocument.h>
#include <texteditor/refactoringchanges.h> #include <texteditor/refactoringchanges.h>
#include <optional>
namespace CppEditor { namespace CppEditor {
class CppRefactoringChanges; class CppRefactoringChanges;
class CppRefactoringFile; class CppRefactoringFile;
class CppRefactoringChangesData;
using CppRefactoringFilePtr = QSharedPointer<CppRefactoringFile>; using CppRefactoringFilePtr = QSharedPointer<CppRefactoringFile>;
using CppRefactoringFileConstPtr = QSharedPointer<const CppRefactoringFile>; using CppRefactoringFileConstPtr = QSharedPointer<const CppRefactoringFile>;
namespace Internal { class CppRefactoringChangesData; }
class CPPEDITOR_EXPORT CppRefactoringFile: public TextEditor::RefactoringFile class CPPEDITOR_EXPORT CppRefactoringFile: public TextEditor::RefactoringFile
{ {
public: public:
@@ -52,7 +49,8 @@ public:
QString textOf(const CPlusPlus::AST *ast) const; QString textOf(const CPlusPlus::AST *ast) const;
private: private:
CppRefactoringFile(const Utils::FilePath &filePath, const QSharedPointer<CppRefactoringChangesData> &data); CppRefactoringFile(const Utils::FilePath &filePath,
const QSharedPointer<Internal::CppRefactoringChangesData> &data);
CppRefactoringFile(QTextDocument *document, const Utils::FilePath &filePath); CppRefactoringFile(QTextDocument *document, const Utils::FilePath &filePath);
explicit CppRefactoringFile(TextEditor::TextEditorWidget *editor); explicit CppRefactoringFile(TextEditor::TextEditorWidget *editor);
@@ -67,20 +65,11 @@ private:
int startIndex) const; int startIndex) const;
mutable CPlusPlus::Document::Ptr m_cppDocument; mutable CPlusPlus::Document::Ptr m_cppDocument;
QSharedPointer<CppRefactoringChangesData> m_data; QSharedPointer<Internal::CppRefactoringChangesData> m_data;
friend class CppRefactoringChanges; // for access to constructor friend class CppRefactoringChanges; // for access to constructor
}; };
class CPPEDITOR_EXPORT CppRefactoringChangesData
{
public:
explicit CppRefactoringChangesData(const CPlusPlus::Snapshot &snapshot);
CPlusPlus::Snapshot m_snapshot;
WorkingCopy m_workingCopy;
};
class CPPEDITOR_EXPORT CppRefactoringChanges: public TextEditor::RefactoringFileFactory class CPPEDITOR_EXPORT CppRefactoringChanges: public TextEditor::RefactoringFileFactory
{ {
public: public:
@@ -98,7 +87,7 @@ public:
const CPlusPlus::Snapshot &snapshot() const; const CPlusPlus::Snapshot &snapshot() const;
private: private:
const QSharedPointer<CppRefactoringChangesData> m_data; const QSharedPointer<Internal::CppRefactoringChangesData> m_data;
}; };
} // namespace CppEditor } // namespace CppEditor