Add AbstractDeclarationNavigationContext, and move the html-method from
[kdevelopdvcssupport.git] / language / duchain / persistentsymboltable.h
blob020dbd1844ff99c186efe5ff10026cb95e413135
1 /* This file is part of KDevelop
2 Copyright 2008 David Nolden <david.nolden.kdevelop@art-master.de>
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public
6 License version 2 as published by the Free Software Foundation.
8 This library is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 Library General Public License for more details.
13 You should have received a copy of the GNU Library General Public License
14 along with this library; see the file COPYING.LIB. If not, write to
15 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
16 Boston, MA 02110-1301, USA.
19 #include <util/kdevvarlengtharray.h>
20 #include "../languageexport.h"
22 #ifndef PERSISTENTSYMBOLTABLE_H
23 #define PERSISTENTSYMBOLTABLE_H
25 namespace KDevelop {
27 class Declaration;
28 class IndexedDeclaration;
29 class IndexedDUContext;
30 class DeclarationId;
31 class TopDUContext;
32 class IndexedQualifiedIdentifier;
34 /**
35 * Global symbol-table that is stored to disk, and allows retrieving declarations that currently are not loaded to memory.
36 * */
37 class KDEVPLATFORMLANGUAGE_EXPORT PersistentSymbolTable {
38 public:
39 /// Constructor.
40 PersistentSymbolTable();
41 /// Destructor.
42 ~PersistentSymbolTable();
44 void addDeclaration(const IndexedQualifiedIdentifier& id, const IndexedDeclaration& declaration);
46 void removeDeclaration(const IndexedQualifiedIdentifier& id, const IndexedDeclaration& declaration);
48 ///Retrieves all the declarations for a given IndexedQualifiedIdentifier in an efficient way.
49 ///@param id The IndexedQualifiedIdentifier for which the declarations should be retrieved
50 ///@param count A reference that will be filled with the count of retrieved declarations
51 ///@param declarations A reference to a pointer, that will be filled with a pointer to the retrieved declarations.
52 void declarations(const IndexedQualifiedIdentifier& id, uint& count, const IndexedDeclaration*& declarations) const;
55 void addContext(const IndexedQualifiedIdentifier& id, const IndexedDUContext& context);
57 void removeContext(const IndexedQualifiedIdentifier& id, const IndexedDUContext& context);
59 ///Retrieves all the contexts for a given IndexedQualifiedIdentifier in an efficient way.
60 ///@param id The IndexedQualifiedIdentifier for which the contexts should be retrieved
61 ///@param count A reference that will be filled with the count of retrieved contexts
62 ///@param contexts A reference to a pointer, that will be filled with a pointer to the retrieved contexts.
63 void contexts(const IndexedQualifiedIdentifier& id, uint& count, const IndexedDUContext*& contexts) const;
65 static PersistentSymbolTable& self();
67 //Very expensive: Checks for problems in the symbol table
68 void selfAnalysis();
70 private:
71 class PersistentSymbolTablePrivate* d;
75 #endif