2009-02-25 09:15:00 +01:00
|
|
|
/**************************************************************************
|
2008-12-02 12:01:29 +01:00
|
|
|
**
|
|
|
|
|
** This file is part of Qt Creator
|
|
|
|
|
**
|
2011-01-11 16:28:15 +01:00
|
|
|
** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
|
2008-12-02 12:01:29 +01:00
|
|
|
**
|
2011-04-13 08:42:33 +02:00
|
|
|
** Contact: Nokia Corporation (info@qt.nokia.com)
|
2008-12-02 12:01:29 +01:00
|
|
|
**
|
2008-12-02 14:17:16 +01:00
|
|
|
**
|
2009-02-25 09:15:00 +01:00
|
|
|
** GNU Lesser General Public License Usage
|
2008-12-02 14:17:16 +01:00
|
|
|
**
|
2011-04-13 08:42:33 +02:00
|
|
|
** This file may be used under the terms of the GNU Lesser General Public
|
|
|
|
|
** License version 2.1 as published by the Free Software Foundation and
|
|
|
|
|
** appearing in the file LICENSE.LGPL included in the packaging of this file.
|
|
|
|
|
** Please review the following information to ensure the GNU Lesser General
|
|
|
|
|
** Public License version 2.1 requirements will be met:
|
|
|
|
|
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
2008-12-02 14:17:16 +01:00
|
|
|
**
|
2010-12-17 16:01:08 +01:00
|
|
|
** In addition, as a special exception, Nokia gives you certain additional
|
2011-04-13 08:42:33 +02:00
|
|
|
** rights. These rights are described in the Nokia Qt LGPL Exception
|
2010-12-17 16:01:08 +01:00
|
|
|
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
|
|
|
**
|
2011-04-13 08:42:33 +02:00
|
|
|
** Other Usage
|
|
|
|
|
**
|
|
|
|
|
** Alternatively, this file may be used in accordance with the terms and
|
|
|
|
|
** conditions contained in a signed written agreement between you and Nokia.
|
|
|
|
|
**
|
2010-12-17 16:01:08 +01:00
|
|
|
** If you have questions regarding the use of this file, please contact
|
|
|
|
|
** Nokia at qt-info@nokia.com.
|
2008-12-02 12:01:29 +01:00
|
|
|
**
|
2009-02-25 09:15:00 +01:00
|
|
|
**************************************************************************/
|
2008-12-02 15:08:31 +01:00
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
#ifndef CPPMODELMANAGERINTERFACE_H
|
|
|
|
|
#define CPPMODELMANAGERINTERFACE_H
|
|
|
|
|
|
|
|
|
|
#include <cplusplus/CppDocument.h>
|
2010-12-03 10:13:15 +01:00
|
|
|
#include <languageutils/fakemetaobject.h>
|
2008-12-02 12:01:29 +01:00
|
|
|
#include <QtCore/QObject>
|
2009-12-07 12:36:16 +01:00
|
|
|
#include <QtCore/QHash>
|
2008-12-08 10:44:56 +01:00
|
|
|
#include <QtCore/QPointer>
|
2009-12-07 11:12:55 +01:00
|
|
|
#include <QtCore/QStringList>
|
2010-03-02 12:51:47 +01:00
|
|
|
#include <QtCore/QFuture>
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2010-06-07 12:12:07 +02:00
|
|
|
namespace Core {
|
|
|
|
|
class IEditor;
|
|
|
|
|
}
|
|
|
|
|
|
2010-05-31 12:09:28 +02:00
|
|
|
namespace CPlusPlus {
|
|
|
|
|
class LookupContext;
|
|
|
|
|
}
|
|
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
namespace ProjectExplorer {
|
|
|
|
|
class Project;
|
|
|
|
|
}
|
|
|
|
|
|
2010-06-07 13:06:21 +02:00
|
|
|
namespace TextEditor {
|
|
|
|
|
class ITextEditor;
|
|
|
|
|
}
|
|
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
namespace CppTools {
|
2010-12-03 13:49:35 +01:00
|
|
|
class AbstractEditorSupport;
|
2010-06-07 13:06:21 +02:00
|
|
|
}
|
|
|
|
|
|
2010-12-03 13:49:35 +01:00
|
|
|
namespace CPlusPlus {
|
|
|
|
|
|
|
|
|
|
class CPLUSPLUS_EXPORT CppModelManagerInterface : public QObject
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
|
|
public:
|
2008-12-08 10:44:56 +01:00
|
|
|
class ProjectInfo
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
2008-12-08 10:44:56 +01:00
|
|
|
public:
|
|
|
|
|
ProjectInfo()
|
|
|
|
|
{ }
|
|
|
|
|
|
|
|
|
|
ProjectInfo(QPointer<ProjectExplorer::Project> project)
|
|
|
|
|
: project(project)
|
|
|
|
|
{ }
|
|
|
|
|
|
|
|
|
|
operator bool() const
|
|
|
|
|
{ return ! project.isNull(); }
|
|
|
|
|
|
|
|
|
|
bool isValid() const
|
|
|
|
|
{ return ! project.isNull(); }
|
|
|
|
|
|
|
|
|
|
bool isNull() const
|
|
|
|
|
{ return project.isNull(); }
|
|
|
|
|
|
|
|
|
|
public: // attributes
|
|
|
|
|
QPointer<ProjectExplorer::Project> project;
|
2008-12-02 12:01:29 +01:00
|
|
|
QString projectPath;
|
|
|
|
|
QByteArray defines;
|
|
|
|
|
QStringList sourceFiles;
|
|
|
|
|
QStringList includePaths;
|
|
|
|
|
QStringList frameworkPaths;
|
2010-01-12 13:13:22 +01:00
|
|
|
QStringList precompiledHeaders;
|
2008-12-02 12:01:29 +01:00
|
|
|
};
|
|
|
|
|
|
2009-12-15 15:26:40 +01:00
|
|
|
class WorkingCopy
|
|
|
|
|
{
|
|
|
|
|
public:
|
2009-12-15 15:52:55 +01:00
|
|
|
void insert(const QString &fileName, const QString &source, unsigned revision = 0)
|
|
|
|
|
{ _elements.insert(fileName, qMakePair(source, revision)); }
|
2009-12-15 15:26:40 +01:00
|
|
|
|
|
|
|
|
bool contains(const QString &fileName) const
|
|
|
|
|
{ return _elements.contains(fileName); }
|
|
|
|
|
|
|
|
|
|
QString source(const QString &fileName) const
|
2009-12-15 15:52:55 +01:00
|
|
|
{ return _elements.value(fileName).first; }
|
|
|
|
|
|
|
|
|
|
QPair<QString, unsigned> get(const QString &fileName) const
|
2009-12-15 15:26:40 +01:00
|
|
|
{ return _elements.value(fileName); }
|
|
|
|
|
|
|
|
|
|
private:
|
2009-12-15 15:52:55 +01:00
|
|
|
typedef QHash<QString, QPair<QString, unsigned> > Table;
|
2009-12-15 15:26:40 +01:00
|
|
|
Table _elements;
|
|
|
|
|
};
|
2009-12-15 15:16:46 +01:00
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
public:
|
2010-12-03 13:49:35 +01:00
|
|
|
CppModelManagerInterface(QObject *parent = 0);
|
|
|
|
|
virtual ~CppModelManagerInterface();
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2009-10-05 13:43:05 +02:00
|
|
|
static CppModelManagerInterface *instance();
|
|
|
|
|
|
2010-06-07 12:12:07 +02:00
|
|
|
virtual bool isCppEditor(Core::IEditor *editor) const = 0;
|
|
|
|
|
|
2009-12-15 15:16:46 +01:00
|
|
|
virtual WorkingCopy workingCopy() const = 0;
|
2008-12-12 10:07:58 +01:00
|
|
|
virtual CPlusPlus::Snapshot snapshot() const = 0;
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2008-12-08 10:44:56 +01:00
|
|
|
virtual QList<ProjectInfo> projectInfos() const = 0;
|
|
|
|
|
virtual ProjectInfo projectInfo(ProjectExplorer::Project *project) const = 0;
|
|
|
|
|
virtual void updateProjectInfo(const ProjectInfo &pinfo) = 0;
|
2009-05-12 13:45:24 +02:00
|
|
|
|
2009-07-24 12:50:10 +02:00
|
|
|
virtual QStringList includesInPath(const QString &path) const = 0;
|
|
|
|
|
|
2010-12-03 13:49:35 +01:00
|
|
|
virtual void addEditorSupport(CppTools::AbstractEditorSupport *editorSupport) = 0;
|
|
|
|
|
virtual void removeEditorSupport(CppTools::AbstractEditorSupport *editorSupport) = 0;
|
2009-08-07 13:02:36 +02:00
|
|
|
|
2009-09-30 13:25:40 +02:00
|
|
|
virtual QList<int> references(CPlusPlus::Symbol *symbol,
|
2010-05-31 12:09:28 +02:00
|
|
|
const CPlusPlus::LookupContext &context) = 0;
|
2009-09-30 13:25:40 +02:00
|
|
|
|
2010-07-20 11:02:37 +02:00
|
|
|
virtual void renameUsages(CPlusPlus::Symbol *symbol, const CPlusPlus::LookupContext &context,
|
|
|
|
|
const QString &replacement = QString()) = 0;
|
2010-05-31 12:09:28 +02:00
|
|
|
virtual void findUsages(CPlusPlus::Symbol *symbol, const CPlusPlus::LookupContext &context) = 0;
|
2009-11-05 12:34:02 +01:00
|
|
|
|
2009-12-21 14:54:10 +01:00
|
|
|
virtual void findMacroUsages(const CPlusPlus::Macro ¯o) = 0;
|
|
|
|
|
|
2011-01-06 10:01:45 +01:00
|
|
|
virtual QList<LanguageUtils::FakeMetaObject::ConstPtr> exportedQmlObjects(const CPlusPlus::Document::Ptr &doc) const = 0;
|
2010-12-03 10:13:15 +01:00
|
|
|
|
2010-03-17 14:18:32 +01:00
|
|
|
Q_SIGNALS:
|
|
|
|
|
void documentUpdated(CPlusPlus::Document::Ptr doc);
|
|
|
|
|
|
2009-11-05 12:34:02 +01:00
|
|
|
public Q_SLOTS:
|
2010-12-03 13:49:35 +01:00
|
|
|
virtual void updateModifiedSourceFiles() = 0;
|
2010-03-02 12:51:47 +01:00
|
|
|
virtual QFuture<void> updateSourceFiles(const QStringList &sourceFiles) = 0;
|
2009-11-05 12:34:02 +01:00
|
|
|
virtual void GC() = 0;
|
2009-05-12 13:45:24 +02:00
|
|
|
};
|
|
|
|
|
|
2010-12-03 13:49:35 +01:00
|
|
|
} // namespace CPlusPlus
|
2008-12-02 12:01:29 +01:00
|
|
|
|
|
|
|
|
#endif // CPPMODELMANAGERINTERFACE_H
|