2012-10-02 09:12:39 +02:00
|
|
|
/****************************************************************************
|
2010-08-13 16:38:45 +02:00
|
|
|
**
|
2016-01-15 14:57:40 +01:00
|
|
|
** Copyright (C) 2016 The Qt Company Ltd.
|
|
|
|
|
** Contact: https://www.qt.io/licensing/
|
2010-08-13 16:38:45 +02:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** This file is part of Qt Creator.
|
2010-08-13 16:38:45 +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.
|
2010-08-13 16:38:45 +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.
|
2010-12-17 16:01:08 +01:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
****************************************************************************/
|
2010-08-13 16:38:45 +02:00
|
|
|
|
2016-03-18 07:55:01 +01:00
|
|
|
#pragma once
|
2010-08-13 16:38:45 +02:00
|
|
|
|
2018-01-11 17:06:26 +01:00
|
|
|
#include "cpptools_global.h"
|
|
|
|
|
|
2019-01-24 11:30:58 +01:00
|
|
|
#include <coreplugin/helpitem.h>
|
2014-09-26 09:14:03 +02:00
|
|
|
#include <texteditor/texteditor.h>
|
2013-03-27 18:54:03 +01:00
|
|
|
|
2015-03-05 08:22:48 +01:00
|
|
|
#include <cplusplus/CppDocument.h>
|
|
|
|
|
|
2020-11-30 17:02:33 +01:00
|
|
|
#include <QFuture>
|
|
|
|
|
#include <QIcon>
|
|
|
|
|
#include <QSharedPointer>
|
2012-02-15 10:42:41 +01:00
|
|
|
#include <QString>
|
|
|
|
|
#include <QStringList>
|
|
|
|
|
#include <QTextCursor>
|
2010-08-13 16:38:45 +02:00
|
|
|
|
2021-01-06 15:28:21 +01:00
|
|
|
#include <functional>
|
|
|
|
|
|
2010-08-13 16:38:45 +02:00
|
|
|
namespace CPlusPlus {
|
|
|
|
|
class LookupItem;
|
|
|
|
|
class LookupContext;
|
|
|
|
|
}
|
|
|
|
|
|
2018-01-11 17:06:26 +01:00
|
|
|
namespace CppTools {
|
2010-08-13 16:38:45 +02:00
|
|
|
class CppElement;
|
2018-01-11 17:06:26 +01:00
|
|
|
class CppModelManager;
|
2010-08-13 16:38:45 +02:00
|
|
|
|
2021-01-06 15:28:21 +01:00
|
|
|
class CPPTOOLS_EXPORT CppElementEvaluator final
|
2010-08-13 16:38:45 +02:00
|
|
|
{
|
|
|
|
|
public:
|
2014-09-26 11:37:54 +02:00
|
|
|
explicit CppElementEvaluator(TextEditor::TextEditorWidget *editor);
|
2021-01-06 15:28:21 +01:00
|
|
|
~CppElementEvaluator();
|
2010-08-13 16:38:45 +02:00
|
|
|
|
|
|
|
|
void setTextCursor(const QTextCursor &tc);
|
|
|
|
|
|
2011-01-17 16:29:57 +01:00
|
|
|
void execute();
|
2021-01-06 15:28:21 +01:00
|
|
|
static QFuture<QSharedPointer<CppElement>> asyncExecute(TextEditor::TextEditorWidget *editor);
|
|
|
|
|
static QFuture<QSharedPointer<CppElement>> asyncExecute(const QString &expression,
|
|
|
|
|
const QString &fileName);
|
2011-01-17 16:29:57 +01:00
|
|
|
bool identifiedCppElement() const;
|
|
|
|
|
const QSharedPointer<CppElement> &cppElement() const;
|
|
|
|
|
bool hasDiagnosis() const;
|
|
|
|
|
const QString &diagnosis() const;
|
2010-08-13 16:38:45 +02:00
|
|
|
|
2020-12-18 14:40:18 +01:00
|
|
|
static Utils::Link linkFromExpression(const QString &expression, const QString &fileName);
|
|
|
|
|
|
2010-08-13 16:38:45 +02:00
|
|
|
private:
|
2021-01-06 15:28:21 +01:00
|
|
|
class CppElementEvaluatorPrivate *d;
|
2010-08-13 16:38:45 +02:00
|
|
|
};
|
|
|
|
|
|
2018-03-08 19:25:04 +01:00
|
|
|
class CppClass;
|
|
|
|
|
|
2018-01-11 17:06:26 +01:00
|
|
|
class CPPTOOLS_EXPORT CppElement
|
2010-08-13 16:38:45 +02:00
|
|
|
{
|
|
|
|
|
protected:
|
|
|
|
|
CppElement();
|
|
|
|
|
|
2012-10-10 22:32:31 +02:00
|
|
|
public:
|
|
|
|
|
virtual ~CppElement();
|
2010-08-13 16:38:45 +02:00
|
|
|
|
2018-03-08 19:25:04 +01:00
|
|
|
virtual CppClass *toCppClass();
|
|
|
|
|
|
2019-01-24 11:30:58 +01:00
|
|
|
Core::HelpItem::Category helpCategory = Core::HelpItem::Unknown;
|
2012-10-10 22:32:31 +02:00
|
|
|
QStringList helpIdCandidates;
|
|
|
|
|
QString helpMark;
|
2017-10-05 09:45:33 +02:00
|
|
|
Utils::Link link;
|
2012-10-10 22:32:31 +02:00
|
|
|
QString tooltip;
|
2010-08-13 16:38:45 +02:00
|
|
|
};
|
|
|
|
|
|
2018-03-08 19:25:04 +01:00
|
|
|
class CPPTOOLS_EXPORT CppDeclarableElement : public CppElement
|
2010-08-13 16:38:45 +02:00
|
|
|
{
|
|
|
|
|
public:
|
2011-06-09 09:30:32 +02:00
|
|
|
explicit CppDeclarableElement(CPlusPlus::Symbol *declaration);
|
2010-08-13 16:38:45 +02:00
|
|
|
|
2012-10-10 22:32:31 +02:00
|
|
|
public:
|
2013-07-04 20:11:10 +02:00
|
|
|
CPlusPlus::Symbol *declaration;
|
2012-10-10 22:32:31 +02:00
|
|
|
QString name;
|
|
|
|
|
QString qualifiedName;
|
|
|
|
|
QString type;
|
|
|
|
|
QIcon icon;
|
2010-08-13 16:38:45 +02:00
|
|
|
};
|
|
|
|
|
|
2018-03-08 19:25:04 +01:00
|
|
|
class CPPTOOLS_EXPORT CppClass : public CppDeclarableElement
|
2010-08-13 16:38:45 +02:00
|
|
|
{
|
|
|
|
|
public:
|
2011-07-08 09:56:02 +02:00
|
|
|
CppClass();
|
2011-06-09 09:30:32 +02:00
|
|
|
explicit CppClass(CPlusPlus::Symbol *declaration);
|
2010-08-13 16:38:45 +02:00
|
|
|
|
2013-07-04 20:11:10 +02:00
|
|
|
bool operator==(const CppClass &other);
|
|
|
|
|
|
2018-03-08 19:25:04 +01:00
|
|
|
CppClass *toCppClass() final;
|
|
|
|
|
|
2020-11-30 17:02:33 +01:00
|
|
|
void lookupBases(QFutureInterfaceBase &futureInterface,
|
|
|
|
|
CPlusPlus::Symbol *declaration, const CPlusPlus::LookupContext &context);
|
|
|
|
|
void lookupDerived(QFutureInterfaceBase &futureInterface,
|
|
|
|
|
CPlusPlus::Symbol *declaration, const CPlusPlus::Snapshot &snapshot);
|
2010-08-13 16:38:45 +02:00
|
|
|
|
2012-10-10 22:32:31 +02:00
|
|
|
public:
|
|
|
|
|
QList<CppClass> bases;
|
|
|
|
|
QList<CppClass> derived;
|
2010-08-13 16:38:45 +02:00
|
|
|
};
|
|
|
|
|
|
2018-01-11 17:06:26 +01:00
|
|
|
} // namespace CppTools
|