forked from qt-creator/qt-creator
		
	CppTools: Add CppToolsBridge
We broke the dependency of BaseEditorDocumentProcessor *BaseEditorDocumentProcessor::get(const QString &filePath) It's hiding static calls and it is much easier to do it that way than to provide a reference to every user. It's also possible to exchange it with different implementations for different test cases. Change-Id: Ic74699b45948e8b48f7efb6a1b295ba2641b8951 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
This commit is contained in:
		@@ -31,6 +31,7 @@
 | 
			
		||||
#include "baseeditordocumentprocessor.h"
 | 
			
		||||
 | 
			
		||||
#include "cppmodelmanager.h"
 | 
			
		||||
#include "cpptoolsbridge.h"
 | 
			
		||||
#include "editordocumenthandle.h"
 | 
			
		||||
 | 
			
		||||
#include <texteditor/quickfix.h>
 | 
			
		||||
@@ -62,14 +63,6 @@ BaseEditorDocumentProcessor::extraRefactoringOperations(const TextEditor::Assist
 | 
			
		||||
    return TextEditor::QuickFixOperations();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
BaseEditorDocumentProcessor *BaseEditorDocumentProcessor::get(const QString &filePath)
 | 
			
		||||
{
 | 
			
		||||
    CppModelManager *cmmi = CppModelManager::instance();
 | 
			
		||||
    if (CppEditorDocumentHandle *cppEditorDocument = cmmi->cppEditorDocument(filePath))
 | 
			
		||||
        return cppEditorDocument->processor();
 | 
			
		||||
    return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void BaseEditorDocumentProcessor::runParser(QFutureInterface<void> &future,
 | 
			
		||||
                                            BaseEditorDocumentParser::Ptr parser,
 | 
			
		||||
                                            const WorkingCopy workingCopy)
 | 
			
		||||
@@ -81,8 +74,7 @@ void BaseEditorDocumentProcessor::runParser(QFutureInterface<void> &future,
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    parser->update(workingCopy);
 | 
			
		||||
    CppModelManager::instance()
 | 
			
		||||
        ->finishedRefreshingSourceFiles(QSet<QString>() << parser->filePath());
 | 
			
		||||
    CppToolsBridge::finishedRefreshingSourceFiles({parser->filePath()});
 | 
			
		||||
 | 
			
		||||
    future.setProgressValue(1);
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -70,9 +70,6 @@ public:
 | 
			
		||||
    virtual TextEditor::QuickFixOperations
 | 
			
		||||
    extraRefactoringOperations(const TextEditor::AssistInterface &assistInterface);
 | 
			
		||||
 | 
			
		||||
public:
 | 
			
		||||
    static BaseEditorDocumentProcessor *get(const QString &filePath);
 | 
			
		||||
 | 
			
		||||
signals:
 | 
			
		||||
    // Signal interface to implement
 | 
			
		||||
    void codeWarningsUpdated(unsigned revision,
 | 
			
		||||
 
 | 
			
		||||
@@ -34,6 +34,7 @@
 | 
			
		||||
#include "cppmodelmanager.h"
 | 
			
		||||
#include "cppsourceprocessertesthelper.h"
 | 
			
		||||
#include "cppsourceprocessor.h"
 | 
			
		||||
#include "cpptoolsbridge.h"
 | 
			
		||||
#include "cpptoolstestcase.h"
 | 
			
		||||
#include "editordocumenthandle.h"
 | 
			
		||||
 | 
			
		||||
@@ -135,7 +136,7 @@ void CppToolsPlugin::test_cppsourceprocessor_includes_cyclic()
 | 
			
		||||
 | 
			
		||||
    // Check editor snapshot
 | 
			
		||||
    const QString filePath = editor->document()->filePath().toString();
 | 
			
		||||
    auto *processor = BaseEditorDocumentProcessor::get(filePath);
 | 
			
		||||
    auto *processor = CppToolsBridge::baseEditorDocumentProcessor(filePath);
 | 
			
		||||
    QVERIFY(processor);
 | 
			
		||||
    QVERIFY(TestCase::waitForProcessedEditorDocument(filePath));
 | 
			
		||||
    Snapshot snapshot = processor->snapshot();
 | 
			
		||||
 
 | 
			
		||||
@@ -66,7 +66,10 @@ HEADERS += \
 | 
			
		||||
    symbolfinder.h \
 | 
			
		||||
    symbolsfindfilter.h \
 | 
			
		||||
    typehierarchybuilder.h \
 | 
			
		||||
    senddocumenttracker.h
 | 
			
		||||
    senddocumenttracker.h \
 | 
			
		||||
    cpptoolsbridge.h \
 | 
			
		||||
    cpptoolsbridgeinterface.h \
 | 
			
		||||
    cpptoolsbridgeqtcreatorimplementation.h
 | 
			
		||||
 | 
			
		||||
SOURCES += \
 | 
			
		||||
    abstracteditorsupport.cpp \
 | 
			
		||||
@@ -130,7 +133,9 @@ SOURCES += \
 | 
			
		||||
    symbolfinder.cpp \
 | 
			
		||||
    symbolsfindfilter.cpp \
 | 
			
		||||
    typehierarchybuilder.cpp \
 | 
			
		||||
    senddocumenttracker.cpp
 | 
			
		||||
    senddocumenttracker.cpp \
 | 
			
		||||
    cpptoolsbridge.cpp \
 | 
			
		||||
    cpptoolsbridgeqtcreatorimplementation.cpp
 | 
			
		||||
 | 
			
		||||
FORMS += \
 | 
			
		||||
    completionsettingspage.ui \
 | 
			
		||||
 
 | 
			
		||||
@@ -69,6 +69,9 @@ QtcPlugin {
 | 
			
		||||
        "cppsemanticinfo.cpp", "cppsemanticinfo.h",
 | 
			
		||||
        "cppsemanticinfoupdater.cpp", "cppsemanticinfoupdater.h",
 | 
			
		||||
        "cppsourceprocessor.cpp", "cppsourceprocessor.h",
 | 
			
		||||
        "cpptoolsbridge.cpp", "cpptoolsbridge.h",
 | 
			
		||||
        "cpptoolsbridgeinterface.h",
 | 
			
		||||
        "cpptoolsbridgeqtcreatorimplementation.cpp", "cpptoolsbridgeqtcreatorimplementation.h",
 | 
			
		||||
        "cpptools.qrc",
 | 
			
		||||
        "cpptools_global.h",
 | 
			
		||||
        "cpptoolsconstants.h",
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										64
									
								
								src/plugins/cpptools/cpptoolsbridge.cpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										64
									
								
								src/plugins/cpptools/cpptoolsbridge.cpp
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,64 @@
 | 
			
		||||
/****************************************************************************
 | 
			
		||||
**
 | 
			
		||||
** Copyright (C) 2015 The Qt Company Ltd.
 | 
			
		||||
** Contact: http://www.qt.io/licensing
 | 
			
		||||
**
 | 
			
		||||
** This file is part of Qt Creator.
 | 
			
		||||
**
 | 
			
		||||
** 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
 | 
			
		||||
** a written agreement between you and The Qt Company.  For licensing terms and
 | 
			
		||||
** conditions see http://www.qt.io/terms-conditions.  For further information
 | 
			
		||||
** use the contact form at http://www.qt.io/contact-us.
 | 
			
		||||
**
 | 
			
		||||
** GNU Lesser General Public License Usage
 | 
			
		||||
** Alternatively, this file may be used under the terms of the GNU Lesser
 | 
			
		||||
** General Public License version 2.1 or version 3 as published by the Free
 | 
			
		||||
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
 | 
			
		||||
** LICENSE.LGPLv3 included in the packaging of this file.  Please review the
 | 
			
		||||
** following information to ensure the GNU Lesser General Public License
 | 
			
		||||
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
 | 
			
		||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
 | 
			
		||||
**
 | 
			
		||||
** In addition, as a special exception, The Qt Company gives you certain additional
 | 
			
		||||
** rights.  These rights are described in The Qt Company LGPL Exception
 | 
			
		||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
 | 
			
		||||
**
 | 
			
		||||
****************************************************************************/
 | 
			
		||||
 | 
			
		||||
#include "cpptoolsbridge.h"
 | 
			
		||||
 | 
			
		||||
#include "cpptoolsbridgeinterface.h"
 | 
			
		||||
 | 
			
		||||
namespace CppTools {
 | 
			
		||||
 | 
			
		||||
std::unique_ptr<CppToolsBridgeInterface> CppToolsBridge::m_interface;
 | 
			
		||||
 | 
			
		||||
void CppToolsBridge::setCppToolsBridgeImplementation(std::unique_ptr<CppToolsBridgeInterface> &&interface)
 | 
			
		||||
{
 | 
			
		||||
    m_interface = std::move(interface);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
CppTools::CppEditorDocumentHandle *CppToolsBridge::cppEditorDocument(const QString &filePath)
 | 
			
		||||
{
 | 
			
		||||
    return m_interface->cppEditorDocument(filePath);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
QString CppToolsBridge::projectPartIdForFile(const QString &filePath)
 | 
			
		||||
{
 | 
			
		||||
    return m_interface->projectPartIdForFile(filePath);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
BaseEditorDocumentProcessor *CppToolsBridge::baseEditorDocumentProcessor(const QString &filePath)
 | 
			
		||||
{
 | 
			
		||||
    return m_interface->baseEditorDocumentProcessor(filePath);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void CppToolsBridge::finishedRefreshingSourceFiles(const QSet<QString> &filePaths)
 | 
			
		||||
{
 | 
			
		||||
    m_interface->finishedRefreshingSourceFiles(filePaths);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
} // namespace CppTools
 | 
			
		||||
							
								
								
									
										62
									
								
								src/plugins/cpptools/cpptoolsbridge.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										62
									
								
								src/plugins/cpptools/cpptoolsbridge.h
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,62 @@
 | 
			
		||||
/****************************************************************************
 | 
			
		||||
**
 | 
			
		||||
** Copyright (C) 2015 The Qt Company Ltd.
 | 
			
		||||
** Contact: http://www.qt.io/licensing
 | 
			
		||||
**
 | 
			
		||||
** This file is part of Qt Creator.
 | 
			
		||||
**
 | 
			
		||||
** 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
 | 
			
		||||
** a written agreement between you and The Qt Company.  For licensing terms and
 | 
			
		||||
** conditions see http://www.qt.io/terms-conditions.  For further information
 | 
			
		||||
** use the contact form at http://www.qt.io/contact-us.
 | 
			
		||||
**
 | 
			
		||||
** GNU Lesser General Public License Usage
 | 
			
		||||
** Alternatively, this file may be used under the terms of the GNU Lesser
 | 
			
		||||
** General Public License version 2.1 or version 3 as published by the Free
 | 
			
		||||
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
 | 
			
		||||
** LICENSE.LGPLv3 included in the packaging of this file.  Please review the
 | 
			
		||||
** following information to ensure the GNU Lesser General Public License
 | 
			
		||||
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
 | 
			
		||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
 | 
			
		||||
**
 | 
			
		||||
** In addition, as a special exception, The Qt Company gives you certain additional
 | 
			
		||||
** rights.  These rights are described in The Qt Company LGPL Exception
 | 
			
		||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
 | 
			
		||||
**
 | 
			
		||||
****************************************************************************/
 | 
			
		||||
 | 
			
		||||
#ifndef CPPTOOLS_CPPTOOLSBRIDGE_H
 | 
			
		||||
#define CPPTOOLS_CPPTOOLSBRIDGE_H
 | 
			
		||||
 | 
			
		||||
#include "cpptools_global.h"
 | 
			
		||||
 | 
			
		||||
#include <QString>
 | 
			
		||||
 | 
			
		||||
#include <memory>
 | 
			
		||||
 | 
			
		||||
namespace CppTools {
 | 
			
		||||
class CppEditorDocumentHandle;
 | 
			
		||||
class BaseEditorDocumentProcessor;
 | 
			
		||||
class CppToolsBridgeInterface;
 | 
			
		||||
 | 
			
		||||
class CPPTOOLS_EXPORT CppToolsBridge
 | 
			
		||||
{
 | 
			
		||||
public:
 | 
			
		||||
    static void setCppToolsBridgeImplementation(std::unique_ptr<CppToolsBridgeInterface> &&interface
 | 
			
		||||
);
 | 
			
		||||
 | 
			
		||||
    static CppEditorDocumentHandle *cppEditorDocument(const QString &filePath);
 | 
			
		||||
    static QString projectPartIdForFile(const QString &filePath);
 | 
			
		||||
    static BaseEditorDocumentProcessor *baseEditorDocumentProcessor(const QString &filePath);
 | 
			
		||||
    static void finishedRefreshingSourceFiles(const QSet<QString> &filePaths);
 | 
			
		||||
 | 
			
		||||
private:
 | 
			
		||||
    static std::unique_ptr<CppToolsBridgeInterface> m_interface;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
} // namespace CppTools
 | 
			
		||||
 | 
			
		||||
#endif // CPPTOOLS_CPPTOOLSBRIDGE_H
 | 
			
		||||
							
								
								
									
										56
									
								
								src/plugins/cpptools/cpptoolsbridgeinterface.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										56
									
								
								src/plugins/cpptools/cpptoolsbridgeinterface.h
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,56 @@
 | 
			
		||||
/****************************************************************************
 | 
			
		||||
**
 | 
			
		||||
** Copyright (C) 2015 The Qt Company Ltd.
 | 
			
		||||
** Contact: http://www.qt.io/licensing
 | 
			
		||||
**
 | 
			
		||||
** This file is part of Qt Creator.
 | 
			
		||||
**
 | 
			
		||||
** 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
 | 
			
		||||
** a written agreement between you and The Qt Company.  For licensing terms and
 | 
			
		||||
** conditions see http://www.qt.io/terms-conditions.  For further information
 | 
			
		||||
** use the contact form at http://www.qt.io/contact-us.
 | 
			
		||||
**
 | 
			
		||||
** GNU Lesser General Public License Usage
 | 
			
		||||
** Alternatively, this file may be used under the terms of the GNU Lesser
 | 
			
		||||
** General Public License version 2.1 or version 3 as published by the Free
 | 
			
		||||
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
 | 
			
		||||
** LICENSE.LGPLv3 included in the packaging of this file.  Please review the
 | 
			
		||||
** following information to ensure the GNU Lesser General Public License
 | 
			
		||||
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
 | 
			
		||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
 | 
			
		||||
**
 | 
			
		||||
** In addition, as a special exception, The Qt Company gives you certain additional
 | 
			
		||||
** rights.  These rights are described in The Qt Company LGPL Exception
 | 
			
		||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
 | 
			
		||||
**
 | 
			
		||||
****************************************************************************/
 | 
			
		||||
 | 
			
		||||
#ifndef CPPTOOLSBRIDGEINTERFACE_H
 | 
			
		||||
#define CPPTOOLSBRIDGEINTERFACE_H
 | 
			
		||||
 | 
			
		||||
#include <QtGlobal>
 | 
			
		||||
 | 
			
		||||
QT_BEGIN_NAMESPACE
 | 
			
		||||
class QString;
 | 
			
		||||
QT_END_NAMESPACE
 | 
			
		||||
 | 
			
		||||
namespace CppTools {
 | 
			
		||||
class CppEditorDocumentHandle;
 | 
			
		||||
class BaseEditorDocumentProcessor;
 | 
			
		||||
 | 
			
		||||
class CppToolsBridgeInterface
 | 
			
		||||
{
 | 
			
		||||
public:
 | 
			
		||||
    virtual ~CppToolsBridgeInterface() = default;
 | 
			
		||||
    virtual CppEditorDocumentHandle *cppEditorDocument(const QString &filePath) const = 0;
 | 
			
		||||
    virtual QString projectPartIdForFile(const QString &filePath) const = 0;
 | 
			
		||||
    virtual BaseEditorDocumentProcessor *baseEditorDocumentProcessor(const QString &filePath) const = 0;
 | 
			
		||||
    virtual void finishedRefreshingSourceFiles(const QSet<QString> &filePaths) const = 0;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
} // namespace CppTools
 | 
			
		||||
 | 
			
		||||
#endif // CPPTOOLSBRIDGEINTERFACE_H
 | 
			
		||||
@@ -0,0 +1,96 @@
 | 
			
		||||
/****************************************************************************
 | 
			
		||||
**
 | 
			
		||||
** Copyright (C) 2015 The Qt Company Ltd.
 | 
			
		||||
** Contact: http://www.qt.io/licensing
 | 
			
		||||
**
 | 
			
		||||
** This file is part of Qt Creator.
 | 
			
		||||
**
 | 
			
		||||
** 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
 | 
			
		||||
** a written agreement between you and The Qt Company.  For licensing terms and
 | 
			
		||||
** conditions see http://www.qt.io/terms-conditions.  For further information
 | 
			
		||||
** use the contact form at http://www.qt.io/contact-us.
 | 
			
		||||
**
 | 
			
		||||
** GNU Lesser General Public License Usage
 | 
			
		||||
** Alternatively, this file may be used under the terms of the GNU Lesser
 | 
			
		||||
** General Public License version 2.1 or version 3 as published by the Free
 | 
			
		||||
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
 | 
			
		||||
** LICENSE.LGPLv3 included in the packaging of this file.  Please review the
 | 
			
		||||
** following information to ensure the GNU Lesser General Public License
 | 
			
		||||
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
 | 
			
		||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
 | 
			
		||||
**
 | 
			
		||||
** In addition, as a special exception, The Qt Company gives you certain additional
 | 
			
		||||
** rights.  These rights are described in The Qt Company LGPL Exception
 | 
			
		||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
 | 
			
		||||
**
 | 
			
		||||
****************************************************************************/
 | 
			
		||||
 | 
			
		||||
#include "cpptoolsbridgeqtcreatorimplementation.h"
 | 
			
		||||
 | 
			
		||||
#include "baseeditordocumentparser.h"
 | 
			
		||||
#include "cppmodelmanager.h"
 | 
			
		||||
#include "cppprojects.h"
 | 
			
		||||
#include "editordocumenthandle.h"
 | 
			
		||||
 | 
			
		||||
namespace CppTools {
 | 
			
		||||
 | 
			
		||||
namespace Internal {
 | 
			
		||||
 | 
			
		||||
CppEditorDocumentHandle *
 | 
			
		||||
CppToolsBridgeQtCreatorImplementation::cppEditorDocument(const QString &filePath) const
 | 
			
		||||
{
 | 
			
		||||
    return CppModelManager::instance()->cppEditorDocument(filePath);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
namespace {
 | 
			
		||||
 | 
			
		||||
CppTools::ProjectPart::Ptr projectPartForFile(const QString &filePath)
 | 
			
		||||
{
 | 
			
		||||
    if (const auto parser = BaseEditorDocumentParser::get(filePath))
 | 
			
		||||
        return parser->projectPart();
 | 
			
		||||
 | 
			
		||||
    return CppTools::ProjectPart::Ptr();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool isProjectPartValid(const CppTools::ProjectPart::Ptr projectPart)
 | 
			
		||||
{
 | 
			
		||||
    if (projectPart)
 | 
			
		||||
        return CppTools::CppModelManager::instance()->projectPartForId(projectPart->id());
 | 
			
		||||
 | 
			
		||||
    return false;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
} // anonymous namespace
 | 
			
		||||
 | 
			
		||||
QString CppToolsBridgeQtCreatorImplementation::projectPartIdForFile(const QString &filePath) const
 | 
			
		||||
{
 | 
			
		||||
    const CppTools::ProjectPart::Ptr projectPart = projectPartForFile(filePath);
 | 
			
		||||
 | 
			
		||||
    if (isProjectPartValid(projectPart))
 | 
			
		||||
        return projectPart->id(); // OK, Project Part is still loaded
 | 
			
		||||
 | 
			
		||||
    return QString();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
BaseEditorDocumentProcessor *
 | 
			
		||||
CppToolsBridgeQtCreatorImplementation::baseEditorDocumentProcessor(const QString &filePath) const
 | 
			
		||||
{
 | 
			
		||||
    auto *document = cppEditorDocument(filePath);
 | 
			
		||||
    if (document)
 | 
			
		||||
        return document->processor();
 | 
			
		||||
 | 
			
		||||
    return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void CppToolsBridgeQtCreatorImplementation::finishedRefreshingSourceFiles(
 | 
			
		||||
        const QSet<QString> &filePaths) const
 | 
			
		||||
{
 | 
			
		||||
    CppModelManager::instance()->finishedRefreshingSourceFiles(filePaths);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
} // namespace Internal
 | 
			
		||||
 | 
			
		||||
} // namespace CppTools
 | 
			
		||||
							
								
								
									
										52
									
								
								src/plugins/cpptools/cpptoolsbridgeqtcreatorimplementation.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										52
									
								
								src/plugins/cpptools/cpptoolsbridgeqtcreatorimplementation.h
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,52 @@
 | 
			
		||||
/****************************************************************************
 | 
			
		||||
**
 | 
			
		||||
** Copyright (C) 2015 The Qt Company Ltd.
 | 
			
		||||
** Contact: http://www.qt.io/licensing
 | 
			
		||||
**
 | 
			
		||||
** This file is part of Qt Creator.
 | 
			
		||||
**
 | 
			
		||||
** 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
 | 
			
		||||
** a written agreement between you and The Qt Company.  For licensing terms and
 | 
			
		||||
** conditions see http://www.qt.io/terms-conditions.  For further information
 | 
			
		||||
** use the contact form at http://www.qt.io/contact-us.
 | 
			
		||||
**
 | 
			
		||||
** GNU Lesser General Public License Usage
 | 
			
		||||
** Alternatively, this file may be used under the terms of the GNU Lesser
 | 
			
		||||
** General Public License version 2.1 or version 3 as published by the Free
 | 
			
		||||
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
 | 
			
		||||
** LICENSE.LGPLv3 included in the packaging of this file.  Please review the
 | 
			
		||||
** following information to ensure the GNU Lesser General Public License
 | 
			
		||||
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
 | 
			
		||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
 | 
			
		||||
**
 | 
			
		||||
** In addition, as a special exception, The Qt Company gives you certain additional
 | 
			
		||||
** rights.  These rights are described in The Qt Company LGPL Exception
 | 
			
		||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
 | 
			
		||||
**
 | 
			
		||||
****************************************************************************/
 | 
			
		||||
 | 
			
		||||
#ifndef CPPTOOLS_CPPTOOLSBRIDGEQTCREATORIMPLEMENTATION_H
 | 
			
		||||
#define CPPTOOLS_CPPTOOLSBRIDGEQTCREATORIMPLEMENTATION_H
 | 
			
		||||
 | 
			
		||||
#include "cpptoolsbridgeinterface.h"
 | 
			
		||||
 | 
			
		||||
namespace CppTools {
 | 
			
		||||
 | 
			
		||||
namespace Internal {
 | 
			
		||||
 | 
			
		||||
class CppToolsBridgeQtCreatorImplementation final : public CppToolsBridgeInterface
 | 
			
		||||
{
 | 
			
		||||
public:
 | 
			
		||||
    CppEditorDocumentHandle *cppEditorDocument(const QString &filePath) const override;
 | 
			
		||||
    QString projectPartIdForFile(const QString &filePath) const override;
 | 
			
		||||
    BaseEditorDocumentProcessor *baseEditorDocumentProcessor(const QString &filePath) const override;
 | 
			
		||||
    void finishedRefreshingSourceFiles(const QSet<QString> &filePaths) const override;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
} // namespace Internal
 | 
			
		||||
} // namespace CppTools
 | 
			
		||||
 | 
			
		||||
#endif // CPPTOOLS_CPPTOOLSBRIDGEQTCREATORIMPLEMENTATION_H
 | 
			
		||||
@@ -45,6 +45,8 @@
 | 
			
		||||
#include "cppprojectfile.h"
 | 
			
		||||
#include "cpplocatordata.h"
 | 
			
		||||
#include "cppincludesfilter.h"
 | 
			
		||||
#include "cpptoolsbridge.h"
 | 
			
		||||
#include "cpptoolsbridgeqtcreatorimplementation.h"
 | 
			
		||||
 | 
			
		||||
#include <coreplugin/actionmanager/actioncontainer.h>
 | 
			
		||||
#include <coreplugin/actionmanager/actionmanager.h>
 | 
			
		||||
@@ -88,6 +90,8 @@ CppToolsPlugin::CppToolsPlugin()
 | 
			
		||||
    , m_codeModelSettings(new CppCodeModelSettings)
 | 
			
		||||
{
 | 
			
		||||
    m_instance = this;
 | 
			
		||||
    auto bridgeImplementation = std::unique_ptr<CppToolsBridgeQtCreatorImplementation>(new CppToolsBridgeQtCreatorImplementation);
 | 
			
		||||
    CppToolsBridge::setCppToolsBridgeImplementation(std::move(bridgeImplementation));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
CppToolsPlugin::~CppToolsPlugin()
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user