File indexing completed on 2024-03-24 16:04:27
0001 /* 0002 SPDX-FileCopyrightText: 2008 Niko Sams <niko.sams@gmail.com> 0003 0004 SPDX-License-Identifier: LGPL-2.0-only 0005 */ 0006 0007 #ifndef PHPDUCONTEXT_H 0008 #define PHPDUCONTEXT_H 0009 0010 #include <QString> 0011 #include <language/duchain/ducontext.h> 0012 class QWidget; 0013 0014 namespace KDevelop 0015 { 0016 class Declaration; 0017 class TopDUContext; 0018 } 0019 namespace Php 0020 { 0021 0022 /** 0023 * This is a du-context template that wraps the Php-specific logic around existing DUContext-derived classes. 0024 * In practice this means DUContext and TopDUContext. 0025 * */ 0026 template<class BaseContext> 0027 class PhpDUContext : public BaseContext 0028 { 0029 public: 0030 template<class Data> 0031 PhpDUContext(Data& data) : BaseContext(data) { 0032 } 0033 0034 ///Parameters will be reached to the base-class 0035 template<class Param1, class Param2> 0036 PhpDUContext(const Param1& p1, const Param2& p2, bool isInstantiationContext) : BaseContext(p1, p2, isInstantiationContext) { 0037 static_cast<KDevelop::DUChainBase*>(this)->d_func_dynamic()->setClassId(this); 0038 } 0039 0040 ///Both parameters will be reached to the base-class. This fits TopDUContext. 0041 template<class Param1, class Param2, class Param3> 0042 PhpDUContext(const Param1& p1, const Param2& p2, const Param3& p3) : BaseContext(p1, p2, p3) { 0043 static_cast<KDevelop::DUChainBase*>(this)->d_func_dynamic()->setClassId(this); 0044 } 0045 template<class Param1, class Param2> 0046 PhpDUContext(const Param1& p1, const Param2& p2) : BaseContext(p1, p2) { 0047 static_cast<KDevelop::DUChainBase*>(this)->d_func_dynamic()->setClassId(this); 0048 } 0049 0050 KDevelop::AbstractNavigationWidget* createNavigationWidget(KDevelop::Declaration* decl, KDevelop::TopDUContext* topContext, 0051 KDevelop::AbstractNavigationWidget::DisplayHints hints) const override; 0052 0053 enum { 0054 Identity = BaseContext::Identity + 51 0055 }; 0056 }; 0057 0058 } 0059 #endif