File indexing completed on 2024-05-12 04:37:45
0001 /* 0002 SPDX-FileCopyrightText: 2007-2008 David Nolden <david.nolden.kdevelop@art-master.de> 0003 0004 SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 0007 #ifndef KDEVPLATFORM_NORMALDECLARATIONCOMPLETIONITEM_H 0008 #define KDEVPLATFORM_NORMALDECLARATIONCOMPLETIONITEM_H 0009 0010 #include "codecompletionitem.h" 0011 #include "codecompletioncontext.h" 0012 #include <language/languageexport.h> 0013 0014 namespace KDevelop { 0015 class KDEVPLATFORMLANGUAGE_EXPORT NormalDeclarationCompletionItem 0016 : public CompletionTreeItem 0017 { 0018 public: 0019 explicit NormalDeclarationCompletionItem( 0020 const KDevelop::DeclarationPointer& decl = KDevelop::DeclarationPointer(), 0021 const QExplicitlySharedDataPointer<CodeCompletionContext>& context = QExplicitlySharedDataPointer<CodeCompletionContext>(), 0022 int inheritanceDepth = 0); 0023 KDevelop::DeclarationPointer declaration() const override; 0024 QExplicitlySharedDataPointer<CodeCompletionContext> completionContext() const; 0025 int inheritanceDepth() const override; 0026 int argumentHintDepth() const override; 0027 QVariant data(const QModelIndex& index, int role, const KDevelop::CodeCompletionModel* model) const override; 0028 0029 void execute(KTextEditor::View* document, const KTextEditor::Range& word) override; 0030 0031 protected: 0032 virtual QString declarationName() const; 0033 virtual QWidget* createExpandingWidget(const KDevelop::CodeCompletionModel* model) const; 0034 virtual bool createsExpandingWidget() const; 0035 virtual QString shortenedTypeString(const KDevelop::DeclarationPointer& decl, int desiredTypeLength) const; 0036 0037 /** 0038 * Called after execute, you may insert additional chars for this declaration (eg. parens) 0039 * Default implementation does nothing 0040 */ 0041 virtual void executed(KTextEditor::View* view, const KTextEditor::Range& word); 0042 0043 QExplicitlySharedDataPointer<CodeCompletionContext> m_completionContext; 0044 KDevelop::DeclarationPointer m_declaration; 0045 int m_inheritanceDepth; //Inheritance-depth: 0 for local functions(within no class), 1 for within local class, 1000+ for global items. 0046 0047 static const int normalBestMatchesCount; 0048 static const bool shortenArgumentHintReturnValues; 0049 static const int maximumArgumentHintReturnValueLength; 0050 static const int desiredTypeLength; 0051 }; 0052 } 0053 #endif