File indexing completed on 2024-05-12 04:39:11

0001 /*
0002     SPDX-FileCopyrightText: 2014 Kevin Funk <kfunk@kde.org>
0003 
0004     SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
0005 */
0006 
0007 #ifndef CLANGDUCONTEXT_H
0008 #define CLANGDUCONTEXT_H
0009 
0010 #include <language/duchain/duchainregister.h>
0011 #include <language/duchain/ducontext.h>
0012 #include <language/duchain/topducontext.h>
0013 
0014 template<class BaseContext, int IdentityT>
0015 class ClangDUContext : public BaseContext
0016 {
0017 public:
0018     template<class Data>
0019     explicit ClangDUContext(Data& data) : BaseContext(data) {
0020     }
0021 
0022     ///Parameters will be reached to the base-class
0023     template<typename... Params>
0024     explicit ClangDUContext(Params... params) : BaseContext(params...) {
0025         static_cast<KDevelop::DUChainBase*>(this)->d_func_dynamic()->setClassId(this);
0026     }
0027 
0028     KDevelop::AbstractNavigationWidget*
0029     createNavigationWidget(KDevelop::Declaration* decl = nullptr, KDevelop::TopDUContext* topContext = nullptr,
0030                            KDevelop::AbstractNavigationWidget::DisplayHints hints
0031                            = KDevelop::AbstractNavigationWidget::NoHints) const override;
0032 
0033     enum {
0034         Identity = IdentityT
0035     };
0036 };
0037 
0038 using ClangTopDUContext = ClangDUContext<KDevelop::TopDUContext, 140>;
0039 using ClangNormalDUContext = ClangDUContext<KDevelop::DUContext, 141>;
0040 
0041 DUCHAIN_DECLARE_TYPE(ClangTopDUContext)
0042 DUCHAIN_DECLARE_TYPE(ClangNormalDUContext)
0043 
0044 #endif // CLANGDUCONTEXT_H