File indexing completed on 2024-05-12 04:37:57

0001 /*
0002     SPDX-FileCopyrightText: 2008 David Nolden <david.nolden.kdevelop@art-master.de>
0003     SPDX-FileCopyrightText: 2014 Kevin Funk <kfunk@kde.org>
0004 
0005     SPDX-License-Identifier: LGPL-2.0-only
0006 */
0007 
0008 #ifndef KDEVPLATFORM_DEFINITIONS_H
0009 #define KDEVPLATFORM_DEFINITIONS_H
0010 
0011 #include <language/languageexport.h>
0012 #include <util/kdevvarlengtharray.h>
0013 
0014 class QTextStream;
0015 
0016 namespace KDevelop {
0017 class Declaration;
0018 class IndexedDeclaration;
0019 class DeclarationId;
0020 class TopDUContext;
0021 
0022 /**
0023  * Global mapping of one Declaration-Ids to multiple Definitions, protected through DUChainLock.
0024  * */
0025 class KDEVPLATFORMLANGUAGE_EXPORT Definitions
0026 {
0027     Q_DISABLE_COPY_MOVE(Definitions)
0028 public:
0029     Definitions();
0030     /**
0031      * Assigns @param definition to the given @p id
0032      * */
0033     void addDefinition(const DeclarationId& id, const IndexedDeclaration& definition);
0034 
0035     void removeDefinition(const DeclarationId& id, const IndexedDeclaration& definition);
0036 
0037     ///Gets all the known definitions assigned to @p id
0038     KDevVarLengthArray<IndexedDeclaration> definitions(const DeclarationId& id) const;
0039 
0040     /// Dump contents of the definitions repository to stream @p out
0041     void dump(const QTextStream& out);
0042 };
0043 }
0044 
0045 #endif