forked from qt-creator/qt-creator
CppEditor: Un-export some classes
Change-Id: I285fe7bd3ac835c4a43f0a200dd7905f577ff211 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -238,7 +238,8 @@ private:
|
|||||||
typeOfExpression.init(m_document, theSnapshot);
|
typeOfExpression.init(m_document, theSnapshot);
|
||||||
typeOfExpression.setExpandTemplates(true);
|
typeOfExpression.setExpandTemplates(true);
|
||||||
|
|
||||||
if (Symbol *s = CanonicalSymbol::canonicalSymbol(m_scope, m_expression, typeOfExpression)) {
|
if (Symbol *s = Internal::CanonicalSymbol::canonicalSymbol(
|
||||||
|
m_scope, m_expression, typeOfExpression)) {
|
||||||
const QList<int> tokenIndices = CppModelManager::instance()
|
const QList<int> tokenIndices = CppModelManager::instance()
|
||||||
->references(s, typeOfExpression.context());
|
->references(s, typeOfExpression.context());
|
||||||
result = toRanges(tokenIndices, m_document->translationUnit());
|
result = toRanges(tokenIndices, m_document->translationUnit());
|
||||||
@@ -339,7 +340,7 @@ QFuture<CursorInfo> BuiltinCursorInfo::run(const CursorInfoParams &cursorInfoPar
|
|||||||
const QTextCursor &textCursor = cursorInfoParams.textCursor;
|
const QTextCursor &textCursor = cursorInfoParams.textCursor;
|
||||||
int line, column;
|
int line, column;
|
||||||
Utils::Text::convertPosition(textCursor.document(), textCursor.position(), &line, &column);
|
Utils::Text::convertPosition(textCursor.document(), textCursor.position(), &line, &column);
|
||||||
CanonicalSymbol canonicalSymbol(document, snapshot);
|
Internal::CanonicalSymbol canonicalSymbol(document, snapshot);
|
||||||
QString expression;
|
QString expression;
|
||||||
Scope *scope = canonicalSymbol.getScopeAndExpression(textCursor, &expression);
|
Scope *scope = canonicalSymbol.getScopeAndExpression(textCursor, &expression);
|
||||||
|
|
||||||
@@ -355,7 +356,7 @@ BuiltinCursorInfo::findLocalUses(const Document::Ptr &document, int line, int co
|
|||||||
AST *ast = document->translationUnit()->ast();
|
AST *ast = document->translationUnit()->ast();
|
||||||
FunctionDefinitionUnderCursor functionDefinitionUnderCursor(document->translationUnit());
|
FunctionDefinitionUnderCursor functionDefinitionUnderCursor(document->translationUnit());
|
||||||
DeclarationAST *declaration = functionDefinitionUnderCursor(ast, line, column);
|
DeclarationAST *declaration = functionDefinitionUnderCursor(ast, line, column);
|
||||||
return LocalSymbols(document, declaration).uses;
|
return Internal::LocalSymbols(document, declaration).uses;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace CppEditor
|
} // namespace CppEditor
|
||||||
|
@@ -341,10 +341,11 @@ void CompilerOptionsBuilder::insertWrappedHeaders(const QStringList &relPaths)
|
|||||||
|
|
||||||
void CompilerOptionsBuilder::addHeaderPathOptions()
|
void CompilerOptionsBuilder::addHeaderPathOptions()
|
||||||
{
|
{
|
||||||
HeaderPathFilter filter{m_projectPart,
|
Internal::HeaderPathFilter filter{
|
||||||
m_useTweakedHeaderPaths,
|
m_projectPart,
|
||||||
m_clangVersion,
|
m_useTweakedHeaderPaths,
|
||||||
m_clangIncludeDirectory};
|
m_clangVersion,
|
||||||
|
m_clangIncludeDirectory};
|
||||||
|
|
||||||
filter.process();
|
filter.process();
|
||||||
|
|
||||||
|
@@ -36,7 +36,7 @@
|
|||||||
|
|
||||||
using namespace CPlusPlus;
|
using namespace CPlusPlus;
|
||||||
|
|
||||||
namespace CppEditor{
|
namespace CppEditor::Internal {
|
||||||
|
|
||||||
CanonicalSymbol::CanonicalSymbol(const Document::Ptr &document,
|
CanonicalSymbol::CanonicalSymbol(const Document::Ptr &document,
|
||||||
const Snapshot &snapshot)
|
const Snapshot &snapshot)
|
||||||
@@ -126,4 +126,4 @@ Symbol *CanonicalSymbol::canonicalSymbol(Scope *scope, const QString &code,
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace CppEditor
|
} // namespace CppEditor::Internal
|
||||||
|
@@ -25,17 +25,15 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "cppeditor_global.h"
|
|
||||||
|
|
||||||
#include <cplusplus/LookupContext.h>
|
#include <cplusplus/LookupContext.h>
|
||||||
#include <cplusplus/Symbol.h>
|
#include <cplusplus/Symbol.h>
|
||||||
#include <cplusplus/TypeOfExpression.h>
|
#include <cplusplus/TypeOfExpression.h>
|
||||||
|
|
||||||
QT_FORWARD_DECLARE_CLASS(QTextCursor)
|
QT_FORWARD_DECLARE_CLASS(QTextCursor)
|
||||||
|
|
||||||
namespace CppEditor {
|
namespace CppEditor::Internal {
|
||||||
|
|
||||||
class CPPEDITOR_EXPORT CanonicalSymbol
|
class CanonicalSymbol
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CanonicalSymbol(const CPlusPlus::Document::Ptr &document,
|
CanonicalSymbol(const CPlusPlus::Document::Ptr &document,
|
||||||
@@ -59,4 +57,4 @@ private:
|
|||||||
CPlusPlus::TypeOfExpression m_typeOfExpression;
|
CPlusPlus::TypeOfExpression m_typeOfExpression;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace CppEditor
|
} // namespace CppEditor::Internal
|
||||||
|
@@ -1136,7 +1136,7 @@ bool CheckSymbols::visit(FunctionDefinitionAST *ast)
|
|||||||
accept(ast->ctor_initializer);
|
accept(ast->ctor_initializer);
|
||||||
accept(ast->function_body);
|
accept(ast->function_body);
|
||||||
|
|
||||||
const LocalSymbols locals(_doc, ast);
|
const Internal::LocalSymbols locals(_doc, ast);
|
||||||
foreach (const QList<Result> &uses, locals.uses) {
|
foreach (const QList<Result> &uses, locals.uses) {
|
||||||
foreach (const Result &u, uses)
|
foreach (const Result &u, uses)
|
||||||
addUse(u);
|
addUse(u);
|
||||||
|
@@ -25,7 +25,6 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "cppeditor_global.h"
|
|
||||||
#include "projectpart.h"
|
#include "projectpart.h"
|
||||||
#include "projectinfo.h"
|
#include "projectinfo.h"
|
||||||
|
|
||||||
@@ -39,7 +38,7 @@ class WorkingCopy;
|
|||||||
|
|
||||||
namespace CppCodeModelInspector {
|
namespace CppCodeModelInspector {
|
||||||
|
|
||||||
struct CPPEDITOR_EXPORT Utils
|
struct Utils
|
||||||
{
|
{
|
||||||
static QString toString(bool value);
|
static QString toString(bool value);
|
||||||
static QString toString(int value);
|
static QString toString(int value);
|
||||||
@@ -63,7 +62,7 @@ struct CPPEDITOR_EXPORT Utils
|
|||||||
static QList<CPlusPlus::Document::Ptr> snapshotToList(const CPlusPlus::Snapshot &snapshot);
|
static QList<CPlusPlus::Document::Ptr> snapshotToList(const CPlusPlus::Snapshot &snapshot);
|
||||||
};
|
};
|
||||||
|
|
||||||
class CPPEDITOR_EXPORT Dumper
|
class Dumper
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit Dumper(const CPlusPlus::Snapshot &globalSnapshot,
|
explicit Dumper(const CPlusPlus::Snapshot &globalSnapshot,
|
||||||
|
@@ -111,7 +111,7 @@ QWidget *CppCodeStylePreferencesFactory::createEditor(TextEditor::ICodeStylePref
|
|||||||
|
|
||||||
TextEditor::Indenter *CppCodeStylePreferencesFactory::createIndenter(QTextDocument *doc) const
|
TextEditor::Indenter *CppCodeStylePreferencesFactory::createIndenter(QTextDocument *doc) const
|
||||||
{
|
{
|
||||||
return new CppQtStyleIndenter(doc);
|
return new Internal::CppQtStyleIndenter(doc);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString CppCodeStylePreferencesFactory::snippetProviderGroupId() const
|
QString CppCodeStylePreferencesFactory::snippetProviderGroupId() const
|
||||||
|
@@ -87,7 +87,7 @@ QTimer *newSingleShotTimer(QObject *parent, int msInternal, const QString &objec
|
|||||||
|
|
||||||
} // anonymous namespace
|
} // anonymous namespace
|
||||||
|
|
||||||
namespace CppEditor {
|
namespace CppEditor::Internal {
|
||||||
|
|
||||||
CppEditorOutline::CppEditorOutline(TextEditor::TextEditorWidget *editorWidget)
|
CppEditorOutline::CppEditorOutline(TextEditor::TextEditorWidget *editorWidget)
|
||||||
: QObject(editorWidget)
|
: QObject(editorWidget)
|
||||||
@@ -296,6 +296,6 @@ QModelIndex CppEditorOutline::indexForPosition(int line, int column,
|
|||||||
return lastIndex;
|
return lastIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace CppEditor
|
} // namespace CppEditor::Internal
|
||||||
|
|
||||||
#include <cppeditoroutline.moc>
|
#include <cppeditoroutline.moc>
|
||||||
|
@@ -25,8 +25,6 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "cppeditor_global.h"
|
|
||||||
|
|
||||||
#include "abstractoverviewmodel.h"
|
#include "abstractoverviewmodel.h"
|
||||||
|
|
||||||
#include <QModelIndex>
|
#include <QModelIndex>
|
||||||
@@ -43,9 +41,9 @@ QT_END_NAMESPACE
|
|||||||
namespace TextEditor { class TextEditorWidget; }
|
namespace TextEditor { class TextEditorWidget; }
|
||||||
namespace Utils { class TreeViewComboBox; }
|
namespace Utils { class TreeViewComboBox; }
|
||||||
|
|
||||||
namespace CppEditor {
|
namespace CppEditor::Internal {
|
||||||
|
|
||||||
class CPPEDITOR_EXPORT CppEditorOutline : public QObject
|
class CppEditorOutline : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
@@ -92,4 +90,4 @@ private:
|
|||||||
QTimer *m_updateIndexTimer;
|
QTimer *m_updateIndexTimer;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace CppEditor
|
} // namespace CppEditor::Internal
|
||||||
|
@@ -32,13 +32,13 @@
|
|||||||
#include <QScopedPointer>
|
#include <QScopedPointer>
|
||||||
|
|
||||||
namespace CppEditor {
|
namespace CppEditor {
|
||||||
class CppEditorOutline;
|
|
||||||
class FollowSymbolInterface;
|
class FollowSymbolInterface;
|
||||||
class SemanticInfo;
|
class SemanticInfo;
|
||||||
class ProjectPart;
|
class ProjectPart;
|
||||||
|
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
class CppEditorDocument;
|
class CppEditorDocument;
|
||||||
|
class CppEditorOutline;
|
||||||
class CppEditorWidgetPrivate;
|
class CppEditorWidgetPrivate;
|
||||||
class FunctionDeclDefLink;
|
class FunctionDeclDefLink;
|
||||||
|
|
||||||
|
@@ -44,7 +44,7 @@
|
|||||||
|
|
||||||
using namespace CPlusPlus;
|
using namespace CPlusPlus;
|
||||||
|
|
||||||
namespace CppEditor {
|
namespace CppEditor::Internal {
|
||||||
|
|
||||||
static QStringList stripName(const QString &name)
|
static QStringList stripName(const QString &name)
|
||||||
{
|
{
|
||||||
@@ -754,4 +754,4 @@ Utils::Link CppElementEvaluator::linkFromExpression(const QString &expression, c
|
|||||||
return Utils::Link();
|
return Utils::Link();
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace CppEditor
|
} // namespace CppEditor::Internal
|
||||||
|
@@ -25,8 +25,6 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "cppeditor_global.h"
|
|
||||||
|
|
||||||
#include <coreplugin/helpitem.h>
|
#include <coreplugin/helpitem.h>
|
||||||
#include <texteditor/texteditor.h>
|
#include <texteditor/texteditor.h>
|
||||||
|
|
||||||
@@ -47,10 +45,12 @@ class LookupContext;
|
|||||||
}
|
}
|
||||||
|
|
||||||
namespace CppEditor {
|
namespace CppEditor {
|
||||||
class CppElement;
|
|
||||||
class CppModelManager;
|
class CppModelManager;
|
||||||
|
|
||||||
class CPPEDITOR_EXPORT CppElementEvaluator final
|
namespace Internal {
|
||||||
|
class CppElement;
|
||||||
|
|
||||||
|
class CppElementEvaluator final
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit CppElementEvaluator(TextEditor::TextEditorWidget *editor);
|
explicit CppElementEvaluator(TextEditor::TextEditorWidget *editor);
|
||||||
@@ -75,7 +75,7 @@ private:
|
|||||||
|
|
||||||
class CppClass;
|
class CppClass;
|
||||||
|
|
||||||
class CPPEDITOR_EXPORT CppElement
|
class CppElement
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
CppElement();
|
CppElement();
|
||||||
@@ -92,7 +92,7 @@ public:
|
|||||||
QString tooltip;
|
QString tooltip;
|
||||||
};
|
};
|
||||||
|
|
||||||
class CPPEDITOR_EXPORT CppDeclarableElement : public CppElement
|
class CppDeclarableElement : public CppElement
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit CppDeclarableElement(CPlusPlus::Symbol *declaration);
|
explicit CppDeclarableElement(CPlusPlus::Symbol *declaration);
|
||||||
@@ -105,7 +105,7 @@ public:
|
|||||||
QIcon icon;
|
QIcon icon;
|
||||||
};
|
};
|
||||||
|
|
||||||
class CPPEDITOR_EXPORT CppClass : public CppDeclarableElement
|
class CppClass : public CppDeclarableElement
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CppClass();
|
CppClass();
|
||||||
@@ -125,4 +125,5 @@ public:
|
|||||||
QList<CppClass> derived;
|
QList<CppClass> derived;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
} // namespace Internal
|
||||||
} // namespace CppEditor
|
} // namespace CppEditor
|
||||||
|
@@ -130,12 +130,12 @@ bool VirtualFunctionHelper::canLookupVirtualFunctionOverrides(Function *function
|
|||||||
if (IdExpressionAST *idExpressionAST = m_baseExpressionAST->asIdExpression()) {
|
if (IdExpressionAST *idExpressionAST = m_baseExpressionAST->asIdExpression()) {
|
||||||
NameAST *name = idExpressionAST->name;
|
NameAST *name = idExpressionAST->name;
|
||||||
const bool nameIsQualified = name && name->asQualifiedName();
|
const bool nameIsQualified = name && name->asQualifiedName();
|
||||||
result = !nameIsQualified && FunctionUtils::isVirtualFunction(
|
result = !nameIsQualified && Internal::FunctionUtils::isVirtualFunction(
|
||||||
function, LookupContext(m_document, m_snapshot));
|
function, LookupContext(m_document, m_snapshot));
|
||||||
} else if (MemberAccessAST *memberAccessAST = m_baseExpressionAST->asMemberAccess()) {
|
} else if (MemberAccessAST *memberAccessAST = m_baseExpressionAST->asMemberAccess()) {
|
||||||
NameAST *name = memberAccessAST->member_name;
|
NameAST *name = memberAccessAST->member_name;
|
||||||
const bool nameIsQualified = name && name->asQualifiedName();
|
const bool nameIsQualified = name && name->asQualifiedName();
|
||||||
if (!nameIsQualified && FunctionUtils::isVirtualFunction(
|
if (!nameIsQualified && Internal::FunctionUtils::isVirtualFunction(
|
||||||
function, LookupContext(m_document, m_snapshot))) {
|
function, LookupContext(m_document, m_snapshot))) {
|
||||||
TranslationUnit *unit = m_expressionDocument->translationUnit();
|
TranslationUnit *unit = m_expressionDocument->translationUnit();
|
||||||
QTC_ASSERT(unit, return false);
|
QTC_ASSERT(unit, return false);
|
||||||
|
@@ -30,7 +30,7 @@
|
|||||||
|
|
||||||
using namespace CPlusPlus;
|
using namespace CPlusPlus;
|
||||||
|
|
||||||
namespace CppEditor {
|
namespace CppEditor::Internal {
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
@@ -309,4 +309,4 @@ LocalSymbols::LocalSymbols(Document::Ptr doc, DeclarationAST *ast)
|
|||||||
uses = findLocalSymbols.localUses;
|
uses = findLocalSymbols.localUses;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace CppEditor
|
} // namespace CppEditor::Internal
|
||||||
|
@@ -25,12 +25,11 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "cppeditor_global.h"
|
|
||||||
#include "cppsemanticinfo.h"
|
#include "cppsemanticinfo.h"
|
||||||
|
|
||||||
namespace CppEditor {
|
namespace CppEditor::Internal {
|
||||||
|
|
||||||
class CPPEDITOR_EXPORT LocalSymbols
|
class LocalSymbols
|
||||||
{
|
{
|
||||||
Q_DISABLE_COPY(LocalSymbols)
|
Q_DISABLE_COPY(LocalSymbols)
|
||||||
|
|
||||||
@@ -40,4 +39,4 @@ public:
|
|||||||
SemanticInfo::LocalUseMap uses;
|
SemanticInfo::LocalUseMap uses;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace CppEditor
|
} // namespace CppEditor::Internal
|
||||||
|
@@ -35,99 +35,113 @@
|
|||||||
#include <utils/link.h>
|
#include <utils/link.h>
|
||||||
|
|
||||||
using namespace CPlusPlus;
|
using namespace CPlusPlus;
|
||||||
namespace CppEditor {
|
namespace CppEditor::Internal {
|
||||||
|
|
||||||
QVariant SymbolItem::data(int /*column*/, int role) const
|
class SymbolItem : public Utils::TreeItem
|
||||||
{
|
{
|
||||||
if (!symbol && parent()) { // account for no symbol item
|
public:
|
||||||
switch (role) {
|
SymbolItem() = default;
|
||||||
case Qt::DisplayRole:
|
explicit SymbolItem(CPlusPlus::Symbol *symbol) : symbol(symbol) {}
|
||||||
if (parent()->childCount() > 1)
|
|
||||||
return QString(QT_TRANSLATE_NOOP("CppEditor::OverviewModel", "<Select Symbol>"));
|
QVariant data(int column, int role) const override
|
||||||
return QString(QT_TRANSLATE_NOOP("CppEditor::OverviewModel", "<No Symbols>"));
|
{
|
||||||
default:
|
Q_UNUSED(column)
|
||||||
|
|
||||||
|
if (!symbol && parent()) { // account for no symbol item
|
||||||
|
switch (role) {
|
||||||
|
case Qt::DisplayRole:
|
||||||
|
if (parent()->childCount() > 1)
|
||||||
|
return QString(QT_TRANSLATE_NOOP("CppEditor::OverviewModel", "<Select Symbol>"));
|
||||||
|
return QString(QT_TRANSLATE_NOOP("CppEditor::OverviewModel", "<No Symbols>"));
|
||||||
|
default:
|
||||||
|
return QVariant();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
auto overviewModel = qobject_cast<const OverviewModel*>(model());
|
||||||
|
if (!symbol || !overviewModel)
|
||||||
return QVariant();
|
return QVariant();
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
auto overviewModel = qobject_cast<const OverviewModel*>(model());
|
switch (role) {
|
||||||
if (!symbol || !overviewModel)
|
case Qt::DisplayRole: {
|
||||||
return QVariant();
|
QString name = overviewModel->_overview.prettyName(symbol->name());
|
||||||
|
if (name.isEmpty())
|
||||||
|
name = QLatin1String("anonymous");
|
||||||
|
if (symbol->isObjCForwardClassDeclaration())
|
||||||
|
name = QLatin1String("@class ") + name;
|
||||||
|
if (symbol->isObjCForwardProtocolDeclaration() || symbol->isObjCProtocol())
|
||||||
|
name = QLatin1String("@protocol ") + name;
|
||||||
|
if (symbol->isObjCClass()) {
|
||||||
|
ObjCClass *clazz = symbol->asObjCClass();
|
||||||
|
if (clazz->isInterface())
|
||||||
|
name = QLatin1String("@interface ") + name;
|
||||||
|
else
|
||||||
|
name = QLatin1String("@implementation ") + name;
|
||||||
|
|
||||||
switch (role) {
|
if (clazz->isCategory()) {
|
||||||
case Qt::DisplayRole: {
|
name += QString(" (%1)").arg(overviewModel->_overview.prettyName(
|
||||||
QString name = overviewModel->_overview.prettyName(symbol->name());
|
clazz->categoryName()));
|
||||||
if (name.isEmpty())
|
|
||||||
name = QLatin1String("anonymous");
|
|
||||||
if (symbol->isObjCForwardClassDeclaration())
|
|
||||||
name = QLatin1String("@class ") + name;
|
|
||||||
if (symbol->isObjCForwardProtocolDeclaration() || symbol->isObjCProtocol())
|
|
||||||
name = QLatin1String("@protocol ") + name;
|
|
||||||
if (symbol->isObjCClass()) {
|
|
||||||
ObjCClass *clazz = symbol->asObjCClass();
|
|
||||||
if (clazz->isInterface())
|
|
||||||
name = QLatin1String("@interface ") + name;
|
|
||||||
else
|
|
||||||
name = QLatin1String("@implementation ") + name;
|
|
||||||
|
|
||||||
if (clazz->isCategory()) {
|
|
||||||
name += QString(" (%1)").arg(overviewModel->_overview.prettyName(
|
|
||||||
clazz->categoryName()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (symbol->isObjCPropertyDeclaration())
|
|
||||||
name = QLatin1String("@property ") + name;
|
|
||||||
// if symbol is a template we might change it now - so, use a copy instead as we're const
|
|
||||||
Symbol *symbl = symbol;
|
|
||||||
if (Template *t = symbl->asTemplate())
|
|
||||||
if (Symbol *templateDeclaration = t->declaration()) {
|
|
||||||
QStringList parameters;
|
|
||||||
parameters.reserve(t->templateParameterCount());
|
|
||||||
for (int i = 0; i < t->templateParameterCount(); ++i) {
|
|
||||||
parameters.append(overviewModel->_overview.prettyName(
|
|
||||||
t->templateParameterAt(i)->name()));
|
|
||||||
}
|
}
|
||||||
name += QString("<%1>").arg(parameters.join(QLatin1String(", ")));
|
|
||||||
symbl = templateDeclaration;
|
|
||||||
}
|
}
|
||||||
if (symbl->isObjCMethod()) {
|
if (symbol->isObjCPropertyDeclaration())
|
||||||
ObjCMethod *method = symbl->asObjCMethod();
|
name = QLatin1String("@property ") + name;
|
||||||
if (method->isStatic())
|
// if symbol is a template we might change it now - so, use a copy instead as we're const
|
||||||
name = QLatin1Char('+') + name;
|
Symbol *symbl = symbol;
|
||||||
else
|
if (Template *t = symbl->asTemplate())
|
||||||
name = QLatin1Char('-') + name;
|
if (Symbol *templateDeclaration = t->declaration()) {
|
||||||
} else if (! symbl->isScope() || symbl->isFunction()) {
|
QStringList parameters;
|
||||||
QString type = overviewModel->_overview.prettyType(symbl->type());
|
parameters.reserve(t->templateParameterCount());
|
||||||
if (Function *f = symbl->type()->asFunctionType()) {
|
for (int i = 0; i < t->templateParameterCount(); ++i) {
|
||||||
name += type;
|
parameters.append(overviewModel->_overview.prettyName(
|
||||||
type = overviewModel->_overview.prettyType(f->returnType());
|
t->templateParameterAt(i)->name()));
|
||||||
|
}
|
||||||
|
name += QString("<%1>").arg(parameters.join(QLatin1String(", ")));
|
||||||
|
symbl = templateDeclaration;
|
||||||
|
}
|
||||||
|
if (symbl->isObjCMethod()) {
|
||||||
|
ObjCMethod *method = symbl->asObjCMethod();
|
||||||
|
if (method->isStatic())
|
||||||
|
name = QLatin1Char('+') + name;
|
||||||
|
else
|
||||||
|
name = QLatin1Char('-') + name;
|
||||||
|
} else if (! symbl->isScope() || symbl->isFunction()) {
|
||||||
|
QString type = overviewModel->_overview.prettyType(symbl->type());
|
||||||
|
if (Function *f = symbl->type()->asFunctionType()) {
|
||||||
|
name += type;
|
||||||
|
type = overviewModel->_overview.prettyType(f->returnType());
|
||||||
|
}
|
||||||
|
if (! type.isEmpty())
|
||||||
|
name += QLatin1String(": ") + type;
|
||||||
}
|
}
|
||||||
if (! type.isEmpty())
|
return name;
|
||||||
name += QLatin1String(": ") + type;
|
|
||||||
}
|
}
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
case Qt::EditRole: {
|
case Qt::EditRole: {
|
||||||
QString name = overviewModel->_overview.prettyName(symbol->name());
|
QString name = overviewModel->_overview.prettyName(symbol->name());
|
||||||
if (name.isEmpty())
|
if (name.isEmpty())
|
||||||
name = QLatin1String("anonymous");
|
name = QLatin1String("anonymous");
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
case Qt::DecorationRole:
|
case Qt::DecorationRole:
|
||||||
return Icons::iconForSymbol(symbol);
|
return Icons::iconForSymbol(symbol);
|
||||||
|
|
||||||
case AbstractOverviewModel::FileNameRole:
|
case AbstractOverviewModel::FileNameRole:
|
||||||
return QString::fromUtf8(symbol->fileName(), symbol->fileNameLength());
|
return QString::fromUtf8(symbol->fileName(), symbol->fileNameLength());
|
||||||
|
|
||||||
case AbstractOverviewModel::LineNumberRole:
|
case AbstractOverviewModel::LineNumberRole:
|
||||||
return symbol->line();
|
return symbol->line();
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return QVariant();
|
return QVariant();
|
||||||
} // switch
|
} // switch
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CPlusPlus::Symbol *symbol = nullptr; // not owned
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
bool OverviewModel::hasDocument() const
|
bool OverviewModel::hasDocument() const
|
||||||
@@ -228,4 +242,4 @@ void OverviewModel::buildTree(SymbolItem *root, bool isRoot)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace CppEditor
|
} // namespace CppEditor::Internal
|
||||||
|
@@ -30,20 +30,10 @@
|
|||||||
#include <cplusplus/CppDocument.h>
|
#include <cplusplus/CppDocument.h>
|
||||||
#include <cplusplus/Overview.h>
|
#include <cplusplus/Overview.h>
|
||||||
|
|
||||||
namespace CppEditor {
|
namespace CppEditor::Internal {
|
||||||
|
class SymbolItem;
|
||||||
|
|
||||||
class SymbolItem : public Utils::TreeItem
|
class OverviewModel : public AbstractOverviewModel
|
||||||
{
|
|
||||||
public:
|
|
||||||
SymbolItem() = default;
|
|
||||||
explicit SymbolItem(CPlusPlus::Symbol *symbol) : symbol(symbol) {}
|
|
||||||
|
|
||||||
QVariant data(int column, int role) const override;
|
|
||||||
|
|
||||||
CPlusPlus::Symbol *symbol = nullptr; // not owned
|
|
||||||
};
|
|
||||||
|
|
||||||
class CPPEDITOR_EXPORT OverviewModel : public AbstractOverviewModel
|
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
@@ -68,4 +58,4 @@ private:
|
|||||||
friend class SymbolItem;
|
friend class SymbolItem;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace CppEditor
|
} // namespace CppEditor::Internal
|
||||||
|
@@ -46,7 +46,7 @@
|
|||||||
#define CHECK_C(cond, err) \
|
#define CHECK_C(cond, err) \
|
||||||
if (!(cond)) { if (DEBUG_OUTPUT) qDebug() << "Discarded:" << (err); continue; }
|
if (!(cond)) { if (DEBUG_OUTPUT) qDebug() << "Discarded:" << (err); continue; }
|
||||||
|
|
||||||
namespace CppEditor {
|
namespace CppEditor::Internal {
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Skips specifiers that are not type relevant and returns the index of the
|
Skips specifiers that are not type relevant and returns the index of the
|
||||||
@@ -471,4 +471,4 @@ void PointerDeclarationFormatter::printCandidate(AST *ast)
|
|||||||
#endif // DEBUG_OUTPUT
|
#endif // DEBUG_OUTPUT
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace CppEditor
|
} // namespace CppEditor::Internal
|
||||||
|
@@ -25,7 +25,6 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "cppeditor_global.h"
|
|
||||||
#include "cpprefactoringchanges.h"
|
#include "cpprefactoringchanges.h"
|
||||||
|
|
||||||
#include <cplusplus/ASTVisitor.h>
|
#include <cplusplus/ASTVisitor.h>
|
||||||
@@ -34,7 +33,7 @@
|
|||||||
|
|
||||||
namespace CPlusPlus { class Overview; }
|
namespace CPlusPlus { class Overview; }
|
||||||
|
|
||||||
namespace CppEditor {
|
namespace CppEditor::Internal {
|
||||||
|
|
||||||
using namespace CPlusPlus;
|
using namespace CPlusPlus;
|
||||||
|
|
||||||
@@ -52,7 +51,7 @@ using namespace CPlusPlus;
|
|||||||
\endlist
|
\endlist
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class CPPEDITOR_EXPORT PointerDeclarationFormatter: protected ASTVisitor
|
class PointerDeclarationFormatter: protected ASTVisitor
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/*!
|
/*!
|
||||||
@@ -117,4 +116,4 @@ private:
|
|||||||
Utils::ChangeSet m_changeSet;
|
Utils::ChangeSet m_changeSet;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace CppEditor
|
} // namespace CppEditor::Internal
|
||||||
|
@@ -47,7 +47,7 @@
|
|||||||
|
|
||||||
using namespace CPlusPlus;
|
using namespace CPlusPlus;
|
||||||
|
|
||||||
Q_DECLARE_METATYPE(CppEditor::Overview)
|
Q_DECLARE_METATYPE(CppEditor::Internal::Overview)
|
||||||
|
|
||||||
namespace CppEditor::Internal {
|
namespace CppEditor::Internal {
|
||||||
namespace {
|
namespace {
|
||||||
|
@@ -166,6 +166,7 @@ void CppProjectUpdater::checkForExtraCompilersFinished()
|
|||||||
m_futureSynchronizer.addFuture(updateFuture);
|
m_futureSynchronizer.addFuture(updateFuture);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
namespace Internal {
|
||||||
CppProjectUpdaterFactory::CppProjectUpdaterFactory()
|
CppProjectUpdaterFactory::CppProjectUpdaterFactory()
|
||||||
{
|
{
|
||||||
setObjectName("CppProjectUpdaterFactory");
|
setObjectName("CppProjectUpdaterFactory");
|
||||||
@@ -175,5 +176,6 @@ CppProjectUpdaterInterface *CppProjectUpdaterFactory::create()
|
|||||||
{
|
{
|
||||||
return new CppProjectUpdater;
|
return new CppProjectUpdater;
|
||||||
}
|
}
|
||||||
|
} // namespace Internal
|
||||||
|
|
||||||
} // namespace CppEditor
|
} // namespace CppEditor
|
||||||
|
@@ -35,11 +35,12 @@
|
|||||||
#include <QFutureWatcher>
|
#include <QFutureWatcher>
|
||||||
|
|
||||||
namespace CppEditor {
|
namespace CppEditor {
|
||||||
|
|
||||||
class ProjectInfo;
|
class ProjectInfo;
|
||||||
|
|
||||||
|
namespace Internal {
|
||||||
|
|
||||||
// registered in extensionsystem's object pool for plugins with weak dependency to CppEditor
|
// registered in extensionsystem's object pool for plugins with weak dependency to CppEditor
|
||||||
class CPPEDITOR_EXPORT CppProjectUpdaterFactory : public QObject
|
class CppProjectUpdaterFactory : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
@@ -49,6 +50,8 @@ public:
|
|||||||
Q_INVOKABLE CppProjectUpdaterInterface *create();
|
Q_INVOKABLE CppProjectUpdaterInterface *create();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
} // namespace Internal
|
||||||
|
|
||||||
class CPPEDITOR_EXPORT CppProjectUpdater final : public QObject, public CppProjectUpdaterInterface
|
class CPPEDITOR_EXPORT CppProjectUpdater final : public QObject, public CppProjectUpdaterInterface
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
@@ -34,7 +34,7 @@
|
|||||||
#include <QTextBlock>
|
#include <QTextBlock>
|
||||||
#include <QTextCursor>
|
#include <QTextCursor>
|
||||||
|
|
||||||
namespace CppEditor {
|
namespace CppEditor::Internal {
|
||||||
|
|
||||||
CppQtStyleIndenter::CppQtStyleIndenter(QTextDocument *doc)
|
CppQtStyleIndenter::CppQtStyleIndenter(QTextDocument *doc)
|
||||||
: TextEditor::TextIndenter(doc)
|
: TextEditor::TextIndenter(doc)
|
||||||
@@ -205,4 +205,4 @@ TextEditor::IndentationForBlock CppQtStyleIndenter::indentationForBlocks(
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace CppEditor
|
} // namespace CppEditor::Internal
|
||||||
|
@@ -25,8 +25,6 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "cppeditor_global.h"
|
|
||||||
|
|
||||||
#include <texteditor/textindenter.h>
|
#include <texteditor/textindenter.h>
|
||||||
|
|
||||||
namespace TextEditor { class ICodeStylePreferences; }
|
namespace TextEditor { class ICodeStylePreferences; }
|
||||||
@@ -35,7 +33,8 @@ namespace CppEditor {
|
|||||||
class CppCodeStyleSettings;
|
class CppCodeStyleSettings;
|
||||||
class CppCodeStylePreferences;
|
class CppCodeStylePreferences;
|
||||||
|
|
||||||
class CPPEDITOR_EXPORT CppQtStyleIndenter : public TextEditor::TextIndenter
|
namespace Internal {
|
||||||
|
class CppQtStyleIndenter : public TextEditor::TextIndenter
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit CppQtStyleIndenter(QTextDocument *doc);
|
explicit CppQtStyleIndenter(QTextDocument *doc);
|
||||||
@@ -66,4 +65,5 @@ private:
|
|||||||
CppCodeStylePreferences *m_cppCodeStylePreferences = nullptr;
|
CppCodeStylePreferences *m_cppCodeStylePreferences = nullptr;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
} // namespace Internal
|
||||||
} // namespace CppEditor
|
} // namespace CppEditor
|
||||||
|
@@ -31,8 +31,7 @@
|
|||||||
using namespace CPlusPlus;
|
using namespace CPlusPlus;
|
||||||
using namespace TextEditor;
|
using namespace TextEditor;
|
||||||
|
|
||||||
namespace CppEditor {
|
namespace CppEditor::Internal {
|
||||||
namespace Internal {
|
|
||||||
|
|
||||||
const QStringList magicQObjectFunctions()
|
const QStringList magicQObjectFunctions()
|
||||||
{
|
{
|
||||||
@@ -40,12 +39,10 @@ const QStringList magicQObjectFunctions()
|
|||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Internal
|
|
||||||
|
|
||||||
CppQuickFixOperation::CppQuickFixOperation(const CppQuickFixInterface &interface, int priority)
|
CppQuickFixOperation::CppQuickFixOperation(const CppQuickFixInterface &interface, int priority)
|
||||||
: QuickFixOperation(priority), CppQuickFixInterface(interface)
|
: QuickFixOperation(priority), CppQuickFixInterface(interface)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
CppQuickFixOperation::~CppQuickFixOperation() = default;
|
CppQuickFixOperation::~CppQuickFixOperation() = default;
|
||||||
|
|
||||||
} // namespace CppEditor
|
} // namespace CppEditor::Internal
|
||||||
|
@@ -37,9 +37,7 @@ class CppQuickFixInterface;
|
|||||||
// These are generated functions that should not be offered in quickfixes.
|
// These are generated functions that should not be offered in quickfixes.
|
||||||
const QStringList magicQObjectFunctions();
|
const QStringList magicQObjectFunctions();
|
||||||
|
|
||||||
}
|
class CppQuickFixOperation
|
||||||
|
|
||||||
class CPPEDITOR_EXPORT CppQuickFixOperation
|
|
||||||
: public TextEditor::QuickFixOperation,
|
: public TextEditor::QuickFixOperation,
|
||||||
public Internal::CppQuickFixInterface
|
public Internal::CppQuickFixInterface
|
||||||
{
|
{
|
||||||
@@ -48,6 +46,8 @@ public:
|
|||||||
~CppQuickFixOperation() override;
|
~CppQuickFixOperation() override;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
} // namespace Internal
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
The QuickFixFactory is responsible for generating QuickFixOperation s which are
|
The QuickFixFactory is responsible for generating QuickFixOperation s which are
|
||||||
applicable to the given QuickFixState.
|
applicable to the given QuickFixState.
|
||||||
|
@@ -50,7 +50,7 @@ using namespace CPlusPlus;
|
|||||||
using namespace TextEditor;
|
using namespace TextEditor;
|
||||||
|
|
||||||
using CppEditor::Tests::TemporaryDir;
|
using CppEditor::Tests::TemporaryDir;
|
||||||
using CppEditor::Tests::TestIncludePaths;
|
using CppEditor::Tests::Internal::TestIncludePaths;
|
||||||
|
|
||||||
typedef QByteArray _;
|
typedef QByteArray _;
|
||||||
|
|
||||||
|
@@ -36,7 +36,7 @@
|
|||||||
|
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
|
|
||||||
namespace CppEditor {
|
namespace CppEditor::Internal {
|
||||||
|
|
||||||
void CppRefactoringEngine::startLocalRenaming(const CursorInEditor &data,
|
void CppRefactoringEngine::startLocalRenaming(const CursorInEditor &data,
|
||||||
const ProjectPart *,
|
const ProjectPart *,
|
||||||
@@ -71,7 +71,7 @@ void CppRefactoringEngine::globalRename(const CursorInEditor &data,
|
|||||||
if (const CPlusPlus::Macro *macro = findCanonicalMacro(cursor, info.doc)) {
|
if (const CPlusPlus::Macro *macro = findCanonicalMacro(cursor, info.doc)) {
|
||||||
modelManager->renameMacroUsages(*macro, replacement);
|
modelManager->renameMacroUsages(*macro, replacement);
|
||||||
} else {
|
} else {
|
||||||
CanonicalSymbol cs(info.doc, info.snapshot);
|
Internal::CanonicalSymbol cs(info.doc, info.snapshot);
|
||||||
CPlusPlus::Symbol *canonicalSymbol = cs(cursor);
|
CPlusPlus::Symbol *canonicalSymbol = cs(cursor);
|
||||||
if (canonicalSymbol)
|
if (canonicalSymbol)
|
||||||
modelManager->renameUsages(canonicalSymbol, cs.context(), replacement);
|
modelManager->renameUsages(canonicalSymbol, cs.context(), replacement);
|
||||||
@@ -95,7 +95,7 @@ void CppRefactoringEngine::findUsages(const CursorInEditor &data,
|
|||||||
if (const CPlusPlus::Macro *macro = findCanonicalMacro(cursor, info.doc)) {
|
if (const CPlusPlus::Macro *macro = findCanonicalMacro(cursor, info.doc)) {
|
||||||
modelManager->findMacroUsages(*macro);
|
modelManager->findMacroUsages(*macro);
|
||||||
} else {
|
} else {
|
||||||
CanonicalSymbol cs(info.doc, info.snapshot);
|
Internal::CanonicalSymbol cs(info.doc, info.snapshot);
|
||||||
CPlusPlus::Symbol *canonicalSymbol = cs(cursor);
|
CPlusPlus::Symbol *canonicalSymbol = cs(cursor);
|
||||||
if (canonicalSymbol)
|
if (canonicalSymbol)
|
||||||
modelManager->findUsages(canonicalSymbol, cs.context());
|
modelManager->findUsages(canonicalSymbol, cs.context());
|
||||||
@@ -115,4 +115,4 @@ void CppRefactoringEngine::globalFollowSymbol(
|
|||||||
documentFromSemanticInfo, symbolFinder, inNextSplit);
|
documentFromSemanticInfo, symbolFinder, inNextSplit);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace CppEditor
|
} // namespace CppEditor::Internal
|
||||||
|
@@ -27,9 +27,9 @@
|
|||||||
|
|
||||||
#include "refactoringengineinterface.h"
|
#include "refactoringengineinterface.h"
|
||||||
|
|
||||||
namespace CppEditor {
|
namespace CppEditor::Internal {
|
||||||
|
|
||||||
class CPPEDITOR_EXPORT CppRefactoringEngine : public RefactoringEngineInterface
|
class CppRefactoringEngine : public RefactoringEngineInterface
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
void startLocalRenaming(const CursorInEditor &data,
|
void startLocalRenaming(const CursorInEditor &data,
|
||||||
@@ -46,4 +46,4 @@ public:
|
|||||||
bool inNextSplit) const override;
|
bool inNextSplit) const override;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace CppEditor
|
} // namespace CppEditor::Internal
|
||||||
|
@@ -27,7 +27,7 @@
|
|||||||
|
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
|
|
||||||
namespace CppEditor::Tests {
|
namespace CppEditor::Tests::Internal {
|
||||||
|
|
||||||
QString TestIncludePaths::includeBaseDirectory()
|
QString TestIncludePaths::includeBaseDirectory()
|
||||||
{
|
{
|
||||||
@@ -52,7 +52,7 @@ QString TestIncludePaths::directoryOfTestFile()
|
|||||||
|
|
||||||
QString TestIncludePaths::testFilePath(const QString &fileName)
|
QString TestIncludePaths::testFilePath(const QString &fileName)
|
||||||
{
|
{
|
||||||
return Tests::TestIncludePaths::directoryOfTestFile() + QLatin1Char('/') + fileName;
|
return directoryOfTestFile() + QLatin1Char('/') + fileName;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace CppEditor::Tests
|
} // namespace CppEditor::Tests::Internal
|
||||||
|
@@ -25,14 +25,12 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "cppeditor_global.h"
|
|
||||||
|
|
||||||
#include <QtGlobal>
|
#include <QtGlobal>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
|
|
||||||
namespace CppEditor::Tests {
|
namespace CppEditor::Tests::Internal {
|
||||||
|
|
||||||
class CPPEDITOR_EXPORT TestIncludePaths
|
class TestIncludePaths
|
||||||
{
|
{
|
||||||
Q_DISABLE_COPY(TestIncludePaths)
|
Q_DISABLE_COPY(TestIncludePaths)
|
||||||
|
|
||||||
@@ -44,4 +42,4 @@ public:
|
|||||||
static QString testFilePath(const QString &fileName = QLatin1String("file.cpp"));
|
static QString testFilePath(const QString &fileName = QLatin1String("file.cpp"));
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace CppEditor::Tests
|
} // namespace CppEditor::Tests::Internal
|
||||||
|
@@ -47,7 +47,7 @@ using ProjectExplorer::HeaderPathType;
|
|||||||
|
|
||||||
using Include = Document::Include;
|
using Include = Document::Include;
|
||||||
using CppEditor::Tests::TestCase;
|
using CppEditor::Tests::TestCase;
|
||||||
using CppEditor::Tests::TestIncludePaths;
|
using CppEditor::Tests::Internal::TestIncludePaths;
|
||||||
|
|
||||||
namespace CppEditor::Internal {
|
namespace CppEditor::Internal {
|
||||||
|
|
||||||
|
@@ -53,12 +53,10 @@ class ProgressIndicator;
|
|||||||
}
|
}
|
||||||
|
|
||||||
namespace CppEditor {
|
namespace CppEditor {
|
||||||
class CppClass;
|
|
||||||
class CppElement;
|
|
||||||
|
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
class CppClass;
|
||||||
class CppEditorWidget;
|
class CppEditorWidget;
|
||||||
|
class CppElement;
|
||||||
|
|
||||||
class CppTypeHierarchyModel : public QStandardItemModel
|
class CppTypeHierarchyModel : public QStandardItemModel
|
||||||
{
|
{
|
||||||
|
@@ -136,7 +136,7 @@ public:
|
|||||||
if (!functionsClass)
|
if (!functionsClass)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
const QList<Function *> overrides = FunctionUtils::overrides(
|
const QList<Function *> overrides = Internal::FunctionUtils::overrides(
|
||||||
m_params.function, functionsClass, m_params.staticClass, m_params.snapshot);
|
m_params.function, functionsClass, m_params.staticClass, m_params.snapshot);
|
||||||
if (overrides.isEmpty())
|
if (overrides.isEmpty())
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
@@ -42,7 +42,7 @@
|
|||||||
|
|
||||||
using namespace CPlusPlus;
|
using namespace CPlusPlus;
|
||||||
|
|
||||||
namespace CppEditor {
|
namespace CppEditor::Internal {
|
||||||
|
|
||||||
DoxygenGenerator::DoxygenGenerator() = default;
|
DoxygenGenerator::DoxygenGenerator() = default;
|
||||||
|
|
||||||
@@ -337,4 +337,4 @@ QString DoxygenGenerator::offsetString() const
|
|||||||
return m_commentOffset;
|
return m_commentOffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace CppEditor
|
} // namespace CppEditor::Internal
|
||||||
|
@@ -25,8 +25,6 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "cppeditor_global.h"
|
|
||||||
|
|
||||||
#include <cplusplus/Overview.h>
|
#include <cplusplus/Overview.h>
|
||||||
|
|
||||||
QT_FORWARD_DECLARE_CLASS(QTextCursor)
|
QT_FORWARD_DECLARE_CLASS(QTextCursor)
|
||||||
@@ -35,9 +33,9 @@ namespace CPlusPlus { class DeclarationAST; }
|
|||||||
namespace CPlusPlus { class Snapshot; }
|
namespace CPlusPlus { class Snapshot; }
|
||||||
namespace Utils { class FilePath; }
|
namespace Utils { class FilePath; }
|
||||||
|
|
||||||
namespace CppEditor {
|
namespace CppEditor::Internal {
|
||||||
|
|
||||||
class CPPEDITOR_EXPORT DoxygenGenerator
|
class DoxygenGenerator
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
DoxygenGenerator();
|
DoxygenGenerator();
|
||||||
@@ -93,4 +91,4 @@ private:
|
|||||||
QString m_commentOffset;
|
QString m_commentOffset;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace CppEditor
|
} // namespace CppEditor::Internal
|
||||||
|
@@ -45,7 +45,7 @@
|
|||||||
|
|
||||||
using namespace CPlusPlus;
|
using namespace CPlusPlus;
|
||||||
|
|
||||||
namespace CppEditor {
|
namespace CppEditor::Internal {
|
||||||
|
|
||||||
enum VirtualType { Virtual, PureVirtual };
|
enum VirtualType { Virtual, PureVirtual };
|
||||||
|
|
||||||
@@ -219,11 +219,11 @@ QList<Function *> FunctionUtils::overrides(Function *function, Class *functionsC
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespaceCppEditor
|
} // namespace CppEditor::Internal
|
||||||
|
|
||||||
#ifdef WITH_TESTS
|
#ifdef WITH_TESTS
|
||||||
namespace CppEditor::Internal {
|
namespace CppEditor::Internal {
|
||||||
enum Virtuality
|
enum class Virtuality
|
||||||
{
|
{
|
||||||
NotVirtual,
|
NotVirtual,
|
||||||
Virtual,
|
Virtual,
|
||||||
@@ -272,14 +272,14 @@ void FunctionUtilsTest::testVirtualFunctions()
|
|||||||
QCOMPARE(FunctionUtils::isPureVirtualFunction(function, context), isPureVirtual);
|
QCOMPARE(FunctionUtils::isPureVirtualFunction(function, context), isPureVirtual);
|
||||||
if (isVirtual) {
|
if (isVirtual) {
|
||||||
if (isPureVirtual)
|
if (isPureVirtual)
|
||||||
QCOMPARE(virtuality, PureVirtual);
|
QCOMPARE(virtuality, Virtuality::PureVirtual);
|
||||||
else
|
else
|
||||||
QCOMPARE(virtuality, Virtual);
|
QCOMPARE(virtuality, Virtuality::Virtual);
|
||||||
} else {
|
} else {
|
||||||
QEXPECT_FAIL("virtual-dtor-dtor", "Not implemented", Abort);
|
QEXPECT_FAIL("virtual-dtor-dtor", "Not implemented", Abort);
|
||||||
if (allFunctions.size() == 3)
|
if (allFunctions.size() == 3)
|
||||||
QEXPECT_FAIL("dtor-virtual-dtor-dtor", "Not implemented", Abort);
|
QEXPECT_FAIL("dtor-virtual-dtor-dtor", "Not implemented", Abort);
|
||||||
QCOMPARE(virtuality, NotVirtual);
|
QCOMPARE(virtuality, Virtuality::NotVirtual);
|
||||||
}
|
}
|
||||||
if (firstVirtualIndex == -1)
|
if (firstVirtualIndex == -1)
|
||||||
QVERIFY(firstVirtuals.isEmpty());
|
QVERIFY(firstVirtuals.isEmpty());
|
||||||
@@ -300,74 +300,78 @@ void FunctionUtilsTest::testVirtualFunctions_data()
|
|||||||
|
|
||||||
QTest::newRow("none")
|
QTest::newRow("none")
|
||||||
<< _("struct None { void foo() {} };\n")
|
<< _("struct None { void foo() {} };\n")
|
||||||
<< (VirtualityList() << NotVirtual)
|
<< (VirtualityList() << Virtuality::NotVirtual)
|
||||||
<< (QList<int>() << -1);
|
<< (QList<int>() << -1);
|
||||||
|
|
||||||
QTest::newRow("single-virtual")
|
QTest::newRow("single-virtual")
|
||||||
<< _("struct V { virtual void foo() {} };\n")
|
<< _("struct V { virtual void foo() {} };\n")
|
||||||
<< (VirtualityList() << Virtual)
|
<< (VirtualityList() << Virtuality::Virtual)
|
||||||
<< (QList<int>() << 0);
|
<< (QList<int>() << 0);
|
||||||
|
|
||||||
QTest::newRow("single-pure-virtual")
|
QTest::newRow("single-pure-virtual")
|
||||||
<< _("struct PV { virtual void foo() = 0; };\n")
|
<< _("struct PV { virtual void foo() = 0; };\n")
|
||||||
<< (VirtualityList() << PureVirtual)
|
<< (VirtualityList() << Virtuality::PureVirtual)
|
||||||
<< (QList<int>() << 0);
|
<< (QList<int>() << 0);
|
||||||
|
|
||||||
QTest::newRow("virtual-derived-with-specifier")
|
QTest::newRow("virtual-derived-with-specifier")
|
||||||
<< _("struct Base { virtual void foo() {} };\n"
|
<< _("struct Base { virtual void foo() {} };\n"
|
||||||
"struct Derived : Base { virtual void foo() {} };\n")
|
"struct Derived : Base { virtual void foo() {} };\n")
|
||||||
<< (VirtualityList() << Virtual << Virtual)
|
<< (VirtualityList() << Virtuality::Virtual << Virtuality::Virtual)
|
||||||
<< (QList<int>() << 0 << 0);
|
<< (QList<int>() << 0 << 0);
|
||||||
|
|
||||||
QTest::newRow("virtual-derived-implicit")
|
QTest::newRow("virtual-derived-implicit")
|
||||||
<< _("struct Base { virtual void foo() {} };\n"
|
<< _("struct Base { virtual void foo() {} };\n"
|
||||||
"struct Derived : Base { void foo() {} };\n")
|
"struct Derived : Base { void foo() {} };\n")
|
||||||
<< (VirtualityList() << Virtual << Virtual)
|
<< (VirtualityList() << Virtuality::Virtual << Virtuality::Virtual)
|
||||||
<< (QList<int>() << 0 << 0);
|
<< (QList<int>() << 0 << 0);
|
||||||
|
|
||||||
QTest::newRow("not-virtual-then-virtual")
|
QTest::newRow("not-virtual-then-virtual")
|
||||||
<< _("struct Base { void foo() {} };\n"
|
<< _("struct Base { void foo() {} };\n"
|
||||||
"struct Derived : Base { virtual void foo() {} };\n")
|
"struct Derived : Base { virtual void foo() {} };\n")
|
||||||
<< (VirtualityList() << NotVirtual << Virtual)
|
<< (VirtualityList() << Virtuality::NotVirtual << Virtuality::Virtual)
|
||||||
<< (QList<int>() << -1 << 1);
|
<< (QList<int>() << -1 << 1);
|
||||||
|
|
||||||
QTest::newRow("virtual-final-not-virtual")
|
QTest::newRow("virtual-final-not-virtual")
|
||||||
<< _("struct Base { virtual void foo() {} };\n"
|
<< _("struct Base { virtual void foo() {} };\n"
|
||||||
"struct Derived : Base { void foo() final {} };\n"
|
"struct Derived : Base { void foo() final {} };\n"
|
||||||
"struct Derived2 : Derived { void foo() {} };")
|
"struct Derived2 : Derived { void foo() {} };")
|
||||||
<< (VirtualityList() << Virtual << Virtual << NotVirtual)
|
<< (VirtualityList() << Virtuality::Virtual << Virtuality::Virtual
|
||||||
|
<< Virtuality::NotVirtual)
|
||||||
<< (QList<int>() << 0 << 0 << -1);
|
<< (QList<int>() << 0 << 0 << -1);
|
||||||
|
|
||||||
QTest::newRow("virtual-then-pure")
|
QTest::newRow("virtual-then-pure")
|
||||||
<< _("struct Base { virtual void foo() {} };\n"
|
<< _("struct Base { virtual void foo() {} };\n"
|
||||||
"struct Derived : Base { virtual void foo() = 0; };\n"
|
"struct Derived : Base { virtual void foo() = 0; };\n"
|
||||||
"struct Derived2 : Derived { void foo() {} };")
|
"struct Derived2 : Derived { void foo() {} };")
|
||||||
<< (VirtualityList() << Virtual << PureVirtual << Virtual)
|
<< (VirtualityList() << Virtuality::Virtual << Virtuality::PureVirtual
|
||||||
|
<< Virtuality::Virtual)
|
||||||
<< (QList<int>() << 0 << 0 << 0);
|
<< (QList<int>() << 0 << 0 << 0);
|
||||||
|
|
||||||
QTest::newRow("virtual-virtual-final-not-virtual")
|
QTest::newRow("virtual-virtual-final-not-virtual")
|
||||||
<< _("struct Base { virtual void foo() {} };\n"
|
<< _("struct Base { virtual void foo() {} };\n"
|
||||||
"struct Derived : Base { virtual void foo() final {} };\n"
|
"struct Derived : Base { virtual void foo() final {} };\n"
|
||||||
"struct Derived2 : Derived { void foo() {} };")
|
"struct Derived2 : Derived { void foo() {} };")
|
||||||
<< (VirtualityList() << Virtual << Virtual << NotVirtual)
|
<< (VirtualityList() << Virtuality::Virtual << Virtuality::Virtual
|
||||||
|
<< Virtuality::NotVirtual)
|
||||||
<< (QList<int>() << 0 << 0 << -1);
|
<< (QList<int>() << 0 << 0 << -1);
|
||||||
|
|
||||||
QTest::newRow("ctor-virtual-dtor")
|
QTest::newRow("ctor-virtual-dtor")
|
||||||
<< _("struct Base { Base() {} virtual ~Base() {} };\n")
|
<< _("struct Base { Base() {} virtual ~Base() {} };\n")
|
||||||
<< (VirtualityList() << NotVirtual << Virtual)
|
<< (VirtualityList() << Virtuality::NotVirtual << Virtuality::Virtual)
|
||||||
<< (QList<int>() << -1 << 1);
|
<< (QList<int>() << -1 << 1);
|
||||||
|
|
||||||
QTest::newRow("virtual-dtor-dtor")
|
QTest::newRow("virtual-dtor-dtor")
|
||||||
<< _("struct Base { virtual ~Base() {} };\n"
|
<< _("struct Base { virtual ~Base() {} };\n"
|
||||||
"struct Derived : Base { ~Derived() {} };\n")
|
"struct Derived : Base { ~Derived() {} };\n")
|
||||||
<< (VirtualityList() << Virtual << Virtual)
|
<< (VirtualityList() << Virtuality::Virtual << Virtuality::Virtual)
|
||||||
<< (QList<int>() << 0 << 0);
|
<< (QList<int>() << 0 << 0);
|
||||||
|
|
||||||
QTest::newRow("dtor-virtual-dtor-dtor")
|
QTest::newRow("dtor-virtual-dtor-dtor")
|
||||||
<< _("struct Base { ~Base() {} };\n"
|
<< _("struct Base { ~Base() {} };\n"
|
||||||
"struct Derived : Base { virtual ~Derived() {} };\n"
|
"struct Derived : Base { virtual ~Derived() {} };\n"
|
||||||
"struct Derived2 : Derived { ~Derived2() {} };\n")
|
"struct Derived2 : Derived { ~Derived2() {} };\n")
|
||||||
<< (VirtualityList() << NotVirtual << Virtual << Virtual)
|
<< (VirtualityList() << Virtuality::NotVirtual << Virtuality::Virtual
|
||||||
|
<< Virtuality::Virtual)
|
||||||
<< (QList<int>() << -1 << 1 << 1);
|
<< (QList<int>() << -1 << 1 << 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -25,8 +25,6 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "cppeditor_global.h"
|
|
||||||
|
|
||||||
#include <QList>
|
#include <QList>
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
|
|
||||||
@@ -38,9 +36,9 @@ class Snapshot;
|
|||||||
class Symbol;
|
class Symbol;
|
||||||
} // namespace CPlusPlus
|
} // namespace CPlusPlus
|
||||||
|
|
||||||
namespace CppEditor {
|
namespace CppEditor::Internal {
|
||||||
|
|
||||||
class CPPEDITOR_EXPORT FunctionUtils
|
class FunctionUtils
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static bool isVirtualFunction(const CPlusPlus::Function *function,
|
static bool isVirtualFunction(const CPlusPlus::Function *function,
|
||||||
@@ -58,7 +56,6 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
#ifdef WITH_TESTS
|
#ifdef WITH_TESTS
|
||||||
namespace Internal {
|
|
||||||
class FunctionUtilsTest : public QObject
|
class FunctionUtilsTest : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
@@ -67,7 +64,6 @@ private slots:
|
|||||||
void testVirtualFunctions();
|
void testVirtualFunctions();
|
||||||
void testVirtualFunctions_data();
|
void testVirtualFunctions_data();
|
||||||
};
|
};
|
||||||
} // namespace Internal
|
|
||||||
#endif // WITH_TESTS
|
#endif // WITH_TESTS
|
||||||
|
|
||||||
} // namespace CppEditor
|
} // namespace CppEditor::Internal
|
||||||
|
@@ -39,7 +39,7 @@
|
|||||||
using namespace ProjectExplorer;
|
using namespace ProjectExplorer;
|
||||||
using namespace Utils;
|
using namespace Utils;
|
||||||
|
|
||||||
namespace CppEditor {
|
namespace CppEditor::Internal {
|
||||||
|
|
||||||
void HeaderPathFilter::process()
|
void HeaderPathFilter::process()
|
||||||
{
|
{
|
||||||
@@ -181,4 +181,4 @@ QString HeaderPathFilter::ensurePathWithSlashEnding(const QString &path)
|
|||||||
return pathWithSlashEnding;
|
return pathWithSlashEnding;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace CppEditor
|
} // namespace CppEditor::Internal
|
||||||
|
@@ -30,9 +30,9 @@
|
|||||||
|
|
||||||
#include <utils/filepath.h>
|
#include <utils/filepath.h>
|
||||||
|
|
||||||
namespace CppEditor {
|
namespace CppEditor::Internal {
|
||||||
|
|
||||||
class CPPEDITOR_EXPORT HeaderPathFilter
|
class HeaderPathFilter
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
HeaderPathFilter(const ProjectPart &projectPart,
|
HeaderPathFilter(const ProjectPart &projectPart,
|
||||||
@@ -76,4 +76,4 @@ public:
|
|||||||
const UseTweakedHeaderPaths useTweakedHeaderPaths;
|
const UseTweakedHeaderPaths useTweakedHeaderPaths;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace CppEditor
|
} // namespace CppEditor::Internal
|
||||||
|
@@ -528,6 +528,7 @@ bool IncludeGroup::hasCommonIncludeDir() const
|
|||||||
#ifdef WITH_TESTS
|
#ifdef WITH_TESTS
|
||||||
using namespace Tests;
|
using namespace Tests;
|
||||||
using namespace IncludeUtils;
|
using namespace IncludeUtils;
|
||||||
|
using Tests::Internal::TestIncludePaths;
|
||||||
|
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
|
@@ -25,8 +25,6 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "cppeditor_global.h"
|
|
||||||
|
|
||||||
#include <cplusplus/CppDocument.h>
|
#include <cplusplus/CppDocument.h>
|
||||||
#include <cplusplus/PreprocessorClient.h>
|
#include <cplusplus/PreprocessorClient.h>
|
||||||
|
|
||||||
@@ -42,8 +40,7 @@ namespace IncludeUtils {
|
|||||||
using Include = CPlusPlus::Document::Include;
|
using Include = CPlusPlus::Document::Include;
|
||||||
using IncludeType = CPlusPlus::Client::IncludeType;
|
using IncludeType = CPlusPlus::Client::IncludeType;
|
||||||
|
|
||||||
// TODO: Unexport
|
class IncludeGroup
|
||||||
class CPPEDITOR_EXPORT IncludeGroup
|
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static QList<IncludeGroup> detectIncludeGroupsByNewLines(QList<Include> &includes);
|
static QList<IncludeGroup> detectIncludeGroupsByNewLines(QList<Include> &includes);
|
||||||
@@ -78,7 +75,7 @@ private:
|
|||||||
QList<Include> m_includes;
|
QList<Include> m_includes;
|
||||||
};
|
};
|
||||||
|
|
||||||
class CPPEDITOR_EXPORT LineForNewIncludeDirective
|
class LineForNewIncludeDirective
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
enum MocIncludeMode { RespectMocIncludes, IgnoreMocIncludes };
|
enum MocIncludeMode { RespectMocIncludes, IgnoreMocIncludes };
|
||||||
|
@@ -29,7 +29,7 @@
|
|||||||
|
|
||||||
using namespace CPlusPlus;
|
using namespace CPlusPlus;
|
||||||
|
|
||||||
namespace CppEditor {
|
namespace CppEditor::Internal {
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
QString unqualifyName(const QString &qualifiedName)
|
QString unqualifyName(const QString &qualifiedName)
|
||||||
@@ -240,4 +240,4 @@ void TypeHierarchyBuilder::buildDerived(QFutureInterfaceBase &futureInterface,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} // CppEditor
|
} // CppEditor::Internal
|
||||||
|
@@ -25,8 +25,6 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "cppeditor_global.h"
|
|
||||||
|
|
||||||
#include <cplusplus/CppDocument.h>
|
#include <cplusplus/CppDocument.h>
|
||||||
#include <cplusplus/Overview.h>
|
#include <cplusplus/Overview.h>
|
||||||
|
|
||||||
@@ -43,9 +41,9 @@ class Name;
|
|||||||
class Scope;
|
class Scope;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace CppEditor {
|
namespace CppEditor::Internal {
|
||||||
|
|
||||||
class CPPEDITOR_EXPORT TypeHierarchy
|
class TypeHierarchy
|
||||||
{
|
{
|
||||||
friend class TypeHierarchyBuilder;
|
friend class TypeHierarchyBuilder;
|
||||||
|
|
||||||
@@ -64,7 +62,7 @@ private:
|
|||||||
QList<TypeHierarchy> _hierarchy;
|
QList<TypeHierarchy> _hierarchy;
|
||||||
};
|
};
|
||||||
|
|
||||||
class CPPEDITOR_EXPORT TypeHierarchyBuilder
|
class TypeHierarchyBuilder
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static TypeHierarchy buildDerivedTypeHierarchy(CPlusPlus::Symbol *symbol,
|
static TypeHierarchy buildDerivedTypeHierarchy(CPlusPlus::Symbol *symbol,
|
||||||
@@ -87,4 +85,4 @@ private:
|
|||||||
CPlusPlus::Overview _overview;
|
CPlusPlus::Overview _overview;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // CppEditor
|
} // CppEditor::Internal
|
||||||
|
Reference in New Issue
Block a user