Add AbstractDeclarationNavigationContext, and move the html-method from
[kdevelopdvcssupport.git] / language / duchain / use.h
blob83f73c467aaf815d7cafa0a65e4beee65464424d
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 #ifndef DEFINITIONUSE_H
20 #define DEFINITIONUSE_H
22 #include <limits>
24 #include "../editor/simplerange.h"
26 #include "../languageexport.h"
28 namespace KDevelop
30 /**
31 * Represents a position in a document where a specific declaration is used.
33 * Since we want to build uses for all files, and every single function may contain
34 * tens to hundreds of uses, uses must be extremely light-weight.
36 * For that reason they are built in a way that a use can completely be stored in a simple vector,
37 * and they only contain indices that represent the actual declaration used. Since the same
38 * Declarations are used over and over again, the actual declarations are stored and indexed centrally
39 * in the enclosing top-context. Additionally, because a use may refer to a not globally adressable item,
40 * each top-context contains a local map that maps declaration-indices to local decarations.
42 * Since only a small fraction of all files is loaded as document at any time, only few documents actually
43 * need smart-ranges. For that reason we do not store them here, but instead only map them to the uses
44 * when there actually IS smart-ranges for them.
46 struct KDEVPLATFORMLANGUAGE_EXPORT Use
48 Use(const SimpleRange& range = SimpleRange::invalid(), int declarationIndex = std::numeric_limits<int>::max()) : m_range(range), m_declarationIndex(declarationIndex) {
51 SimpleRange m_range;
52 int m_declarationIndex;
57 #endif // DEFINITIONUSE_H
59 // kate: space-indent on; indent-width 2; tab-width 4; replace-tabs on; auto-insert-doxygen on