File indexing completed on 2024-05-12 04:37:59
0001 /* 0002 SPDX-FileCopyrightText: 2002-2005 Roberto Raggi <roberto@kdevelop.org> 0003 SPDX-FileCopyrightText: 2006 Hamish Rodda <rodda@kde.org> 0004 SPDX-FileCopyrightText: 2007 David Nolden <david.nolden.kdevelop@art-master.de> 0005 SPDX-FileCopyrightText: 2010 Milian Wolff <mail@milianw.de> 0006 SPDX-FileCopyrightText: 2014 Kevin Funk <kfunk@kde.org> 0007 0008 SPDX-License-Identifier: LGPL-2.0-only 0009 */ 0010 0011 #ifndef KDEVPLATFORM_DUCHAINDUMPER_H 0012 #define KDEVPLATFORM_DUCHAINDUMPER_H 0013 0014 #include <language/languageexport.h> 0015 0016 #include <QFlags> 0017 #include <QScopedPointer> 0018 0019 class QTextStream; 0020 0021 namespace KDevelop { 0022 class DUContext; 0023 class DUChainDumperPrivate; 0024 0025 /** 0026 * @brief Debugging utility function to dump a DUContext including contained declarations. 0027 */ 0028 class KDEVPLATFORMLANGUAGE_EXPORT DUChainDumper 0029 { 0030 public: 0031 enum Feature { 0032 NoFeatures = 0, 0033 DumpContext = 1 << 0, 0034 DumpProblems = 1 << 1 0035 }; 0036 Q_DECLARE_FLAGS(Features, Feature) 0037 0038 explicit DUChainDumper(Features features = DumpContext); 0039 ~DUChainDumper(); 0040 0041 /** 0042 * Dump DUChain context to stdout 0043 * 0044 * NOTE: The DUChain must be readlocked when this is called. 0045 * 0046 * @param context The context to dump 0047 * @param allowedDepth How deep the dump will go into imported contexts, printing all the contents. 0048 */ 0049 void dump(DUContext* context, int allowedDepth = 0); 0050 0051 void dump(DUContext* context, int allowedDepth, QTextStream& out); 0052 0053 private: 0054 const QScopedPointer<class DUChainDumperPrivate> d_ptr; 0055 Q_DECLARE_PRIVATE(DUChainDumper) 0056 }; 0057 } 0058 #endif // KDEVPLATFORM_DUCHAINDUMPER_H