File indexing completed on 2024-05-12 04:39:07
0001 /* 0002 SPDX-FileCopyrightText: 2014 David Stevens <dgedstevens@gmail.com> 0003 0004 SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL 0005 */ 0006 0007 #ifndef COMPLETIONHELPER_H 0008 #define COMPLETIONHELPER_H 0009 0010 #include <QStringList> 0011 #include <QVector> 0012 #include <clang-c/Index.h> 0013 0014 #include <language/duchain/duchainpointer.h> 0015 0016 struct FuncParameterInfo 0017 { 0018 QString type; 0019 QString id; 0020 /// Returns true if types are equal, id is ignored 0021 bool operator==(const FuncParameterInfo& rhs) const { return type == rhs.type; } 0022 }; 0023 Q_DECLARE_TYPEINFO(FuncParameterInfo, Q_MOVABLE_TYPE); 0024 using FuncParameterList = QVector<FuncParameterInfo>; 0025 0026 struct FuncOverrideInfo 0027 { 0028 QString returnType; 0029 QString name; 0030 FuncParameterList params; 0031 bool isPureVirtual; 0032 bool isConst; 0033 /// Returns true if equal, isPureVirtual & parameter ids are ignored 0034 bool operator==(const FuncOverrideInfo& rhs) const; 0035 }; 0036 0037 struct FuncImplementInfo 0038 { 0039 bool isConstructor; 0040 bool isDestructor; 0041 QString templatePrefix; 0042 QString returnType; 0043 QString prototype; 0044 KDevelop::DeclarationPointer declaration; 0045 }; 0046 0047 namespace KTextEditor { 0048 class Cursor; 0049 } 0050 0051 class ParseSession; 0052 0053 Q_DECLARE_TYPEINFO(FuncOverrideInfo, Q_MOVABLE_TYPE); 0054 Q_DECLARE_TYPEINFO(FuncImplementInfo, Q_MOVABLE_TYPE); 0055 using FunctionOverrideList = QVector<FuncOverrideInfo>; 0056 using FunctionImplementsList = QVector<FuncImplementInfo>; 0057 0058 class CompletionHelper 0059 { 0060 public: 0061 CompletionHelper(); 0062 0063 void computeCompletions(const ParseSession& session, CXFile file, 0064 const KTextEditor::Cursor& position); 0065 0066 FunctionOverrideList overrides() const; 0067 FunctionImplementsList implements() const; 0068 private: 0069 FunctionOverrideList m_overrides; 0070 FunctionImplementsList m_implements; 0071 }; 0072 0073 #endif //COMPLETIONHELPER_H