File indexing completed on 2024-04-28 04:35:52

0001 /* This file is part of KDevelop
0002  *
0003  * Copyright (C) 2011-2015 Miquel Sabaté Solà <mikisabate@gmail.com>
0004  *
0005  * This program is free software: you can redistribute it and/or modify
0006  * it under the terms of the GNU General Public License as published by
0007  * the Free Software Foundation, either version 3 of the License, or
0008  * (at your option) any later version.
0009  *
0010  * This program is distributed in the hope that it will be useful,
0011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
0012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0013  * GNU General Public License for more details.
0014  *
0015  * You should have received a copy of the GNU General Public License
0016  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
0017  */
0018 
0019 
0020 #ifndef INCLUDENAVIGATIONCONTEXT_H
0021 #define INCLUDENAVIGATIONCONTEXT_H
0022 
0023 
0024 #include <duchain/duchainexport.h>
0025 #include <language/duchain/navigation/abstractincludenavigationcontext.h>
0026 
0027 
0028 namespace ruby {
0029 
0030 /**
0031  * @class IncludeNavigationContext
0032  *
0033  * The include navigation context for Ruby scripts.
0034  */
0035 class KDEVRUBYDUCHAIN_EXPORT IncludeNavigationContext
0036     : public KDevelop::AbstractIncludeNavigationContext
0037 {
0038 public:
0039     /**
0040      * Constructor.
0041      *
0042      * @param item The include item in which we want to retrieve the info.
0043      * @param topContext The top context associated with the given item.
0044      */
0045     explicit IncludeNavigationContext(const KDevelop::IncludeItem &item,
0046                                       KDevelop::TopDUContextPointer topContext);
0047 
0048 protected:
0049     /// Re-implemented from KDevelop::AbstractIncludeNavigationContext
0050     void getFileInfo(KDevelop::TopDUContext *duchain) override;
0051 
0052     /**
0053      * Re-implemented from KDevelop::AbstractIncludeNavigationContext to
0054      * prevent variable declarations to appear on the widget.
0055      */
0056     bool filterDeclaration(KDevelop::Declaration *decl) override;
0057 
0058     /**
0059      * Re-implemented from KDevelop::AbstractNavigationContext so we can also
0060      * show to the user if this declaration has some special meaning for
0061      * the Ruby interpreter.
0062      */
0063     QString declarationKind(const KDevelop::DeclarationPointer& decl) override;
0064 };
0065 
0066 }
0067 
0068 
0069 #endif /* INCLUDENAVIGATIONCONTEXT_H */