File indexing completed on 2024-04-28 04:34:21
0001 /*************************************************************************** 0002 * Copyright 2009 Sandro Andrade <sandroandrade@kde.org> * 0003 * * 0004 * This program is free software; you can redistribute it and/or modify * 0005 * it under the terms of the GNU Library General Public License as * 0006 * published by the Free Software Foundation; either version 2 of the * 0007 * License, or (at your option) any later version. * 0008 * * 0009 * This program is distributed in the hope that it will be useful, * 0010 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 0011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 0012 * GNU General Public License for more details. * 0013 * * 0014 * You should have received a copy of the GNU Library General Public * 0015 * License along with this program; if not, write to the * 0016 * Free Software Foundation, Inc., * 0017 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * 0018 ***************************************************************************/ 0019 0020 #ifndef DOTCONTROLFLOWGRAPH_H 0021 #define DOTCONTROLFLOWGRAPH_H 0022 0023 #include <QMap> 0024 #include <QHash> 0025 #include <QColor> 0026 #include <QMutex> 0027 #include <QObject> 0028 0029 #include <graphviz/gvc.h> 0030 0031 namespace KDevelop { 0032 class QualifiedIdentifier; 0033 } 0034 using namespace KDevelop; 0035 0036 0037 class DotControlFlowGraph : public QObject 0038 { 0039 Q_OBJECT 0040 public: 0041 DotControlFlowGraph(); 0042 virtual ~DotControlFlowGraph(); 0043 static QMutex mutex; 0044 Q_SIGNALS: 0045 bool loadLibrary(graph_t *rootGraph); 0046 public Q_SLOTS: 0047 void prepareNewGraph(); 0048 void foundRootNode (const QStringList &containers, const QString &label); 0049 void foundFunctionCall (const QStringList &sourceContainers, const QString &source, const QStringList &targetContainers, const QString &target); 0050 void graphDone(); 0051 void clearGraph(); 0052 void exportGraph(const QString &fileName); 0053 private: 0054 GVC_t *m_gvc; 0055 Agraph_t *m_rootGraph; 0056 QMap<QString, QColor> m_colorMap; 0057 QHash<QString, Agraph_t *> m_namedGraphs; 0058 const QColor& colorFromQualifiedIdentifier(const QString &label); 0059 }; 0060 0061 #endif