1 /* 2 SPDX-FileCopyrightText: 2008 David Nolden <david.nolden.kdevelop@art-master.de> 3 SPDX-FileCopyrightText: 2014 Kevin Funk <kfunk@kde.org> 4 5 SPDX-License-Identifier: LGPL-2.0-only 6 */ 7 8 #ifndef KDEVPLATFORM_DEFINITIONS_H 9 #define KDEVPLATFORM_DEFINITIONS_H 10 11 #include <language/languageexport.h> 12 #include <util/kdevvarlengtharray.h> 13 14 #include <QScopedPointer> 15 16 class QTextStream; 17 18 namespace KDevelop { 19 class Declaration; 20 class IndexedDeclaration; 21 class DeclarationId; 22 class TopDUContext; 23 class DefinitionsPrivate; 24 25 /** 26 * Global mapping of one Declaration-Ids to multiple Definitions, protected through DUChainLock. 27 * */ 28 class KDEVPLATFORMLANGUAGE_EXPORT Definitions 29 { 30 public: 31 /// Constructor. 32 Definitions(); 33 /// Destructor. 34 ~Definitions(); 35 /** 36 * Assigns @param definition to the given @p id 37 * */ 38 void addDefinition(const DeclarationId& id, const IndexedDeclaration& definition); 39 40 void removeDefinition(const DeclarationId& id, const IndexedDeclaration& definition); 41 42 ///Gets all the known definitions assigned to @p id 43 KDevVarLengthArray<IndexedDeclaration> definitions(const DeclarationId& id) const; 44 45 /// Dump contents of the definitions repository to stream @p out 46 void dump(const QTextStream& out); 47 48 private: 49 const QScopedPointer<class DefinitionsPrivate> d_ptr; 50 Q_DECLARE_PRIVATE(Definitions) 51 }; 52 } 53 54 #endif 55