[kgraphviewer-devel] [KGraphViewer] 0573816: Forward declare graphviz types in header files
Kevin Funk
krf at electrostorm.net
Thu Dec 9 17:39:41 CET 2010
commit 057381669e39ddd16621e59b527fee89603909d8
branch libkgraphviz
Author: Kevin Funk <krf at electrostorm.net>
Date: Wed Dec 8 10:32:27 2010 +0100
Forward declare graphviz types in header files
diff --git a/src/kgrapheditor.h b/src/kgrapheditor.h
index 3378c7b..9a745d8 100644
--- a/src/kgrapheditor.h
+++ b/src/kgrapheditor.h
@@ -26,8 +26,6 @@
#include <kaction.h>
#include <krecentfilesaction.h>
-#include <graphviz/gvc.h>
-
class QTreeWidget;
class QTreeWidgetItem;
diff --git a/src/kgraphviewer.h b/src/kgraphviewer.h
index ad2710f..76a2381 100644
--- a/src/kgraphviewer.h
+++ b/src/kgraphviewer.h
@@ -28,8 +28,6 @@
#include <kaction.h>
#include <krecentfilesaction.h>
-#include <graphviz/gvc.h>
-
class KToggleAction;
/**
diff --git a/src/part/dotgraph.cpp b/src/part/dotgraph.cpp
index fdb53ad..2f6fd5e 100644
--- a/src/part/dotgraph.cpp
+++ b/src/part/dotgraph.cpp
@@ -23,12 +23,13 @@
#include "canvasedge.h"
#include "canvassubgraph.h"
-
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
+
#include "fdstream.hpp"
#include <boost/spirit/include/classic_confix.hpp>
+
#include <graphviz/gvc.h>
#include <kdebug.h>
@@ -49,8 +50,7 @@ extern KGraphViewer::DotGraphParsingHelper* phelper;
namespace KGraphViewer
{
-
-
+
const distinct_parser<> keyword_p("0-9a-zA-Z_");
DotGraph::DotGraph() :
diff --git a/src/part/dotgraph.h b/src/part/dotgraph.h
index 8e8ebf6..9de9855 100644
--- a/src/part/dotgraph.h
+++ b/src/part/dotgraph.h
@@ -29,8 +29,6 @@
#include <QProcess>
#include <QMutex>
-#include <graphviz/gvc.h>
-
#include "kgraphviewer_export.h"
#include "graphelement.h"
#include "graphsubgraph.h"
@@ -38,6 +36,8 @@
#include "graphedge.h"
#include "dotdefaults.h"
+class Agraph_t;
+
namespace KGraphViewer
{
@@ -103,7 +103,7 @@ public:
void KGRAPHVIEWER_EXPORT saveTo(const QString& fileName);
- virtual void updateWithGraph(graph_t* newGraph);
+ virtual void updateWithGraph(Agraph_t* newGraph);
virtual void updateWithGraph(const DotGraph& graph);
void KGRAPHVIEWER_EXPORT setAttribute(const QString& elementId, const QString& attributeName, const QString& attributeValue);
diff --git a/src/part/dotgraphview.cpp b/src/part/dotgraphview.cpp
index 68a23a9..4a25a72 100644
--- a/src/part/dotgraphview.cpp
+++ b/src/part/dotgraphview.cpp
@@ -51,6 +51,8 @@
#include <math.h>
#include <iostream>
+#include <graphviz/types.h>
+
#include <QMatrix>
#include <QPainter>
#include <QStyle>
diff --git a/src/part/dotgraphview.h b/src/part/dotgraphview.h
index 3fb6c3b..a9e5454 100644
--- a/src/part/dotgraphview.h
+++ b/src/part/dotgraphview.h
@@ -32,6 +32,9 @@
#ifndef DOTGRAPHVIEW_H
#define DOTGRAPHVIEW_H
+#include "kgraphviewer_export.h"
+#include "kgraphviewer_interface.h"
+
#include <kconfig.h>
#include <kactioncollection.h>
#include <kconfiggroup.h>
@@ -39,10 +42,7 @@
#include <QGraphicsView>
#include <QSet>
-#include <graphviz/types.h>
-
-#include "kgraphviewer_export.h"
-#include "kgraphviewer_interface.h"
+class Agraph_t;
class KSelectAction;
class KToggleAction;
@@ -88,7 +88,7 @@ public:
bool KGRAPHVIEWER_EXPORT loadDot(const QString& dotFileName);
bool KGRAPHVIEWER_EXPORT loadLibrary(const QString& dotFileName);
- bool loadLibrary(graph_t* graph, const QString& layoutCommand = "dot");
+ bool loadLibrary(Agraph_t* graph, const QString& layoutCommand = "dot");
void readViewConfig();
void saveViewConfig();
@@ -191,7 +191,7 @@ public Q_SLOTS:
void zoomRectMovedTo(QPointF newZoomPos);
void zoomRectMoveFinished();
bool initEmpty();
- bool slotLoadLibrary(graph_t* graph);
+ bool slotLoadLibrary(Agraph_t* graph);
bool reload();
void dirty(const QString& dotFileName);
void pageSetup();
diff --git a/src/part/graphedge.cpp b/src/part/graphedge.cpp
index bfe5665..1f99c18 100644
--- a/src/part/graphedge.cpp
+++ b/src/part/graphedge.cpp
@@ -30,6 +30,8 @@
#include "canvasedge.h"
#include "dotdefaults.h"
+#include <graphviz/gvc.h>
+
namespace KGraphViewer
{
diff --git a/src/part/graphedge.h b/src/part/graphedge.h
index df2121e..7206fa8 100644
--- a/src/part/graphedge.h
+++ b/src/part/graphedge.h
@@ -37,12 +37,12 @@
#include "dotgrammar.h"
#include "dotrenderop.h"
-#include <graphviz/gvc.h>
-
#include <QStringList>
#include <QMap>
#include <QTextStream>
+class Agedge_t;
+
namespace KGraphViewer
{
@@ -57,7 +57,7 @@ public:
virtual ~GraphEdge();
GraphEdge(const GraphEdge& edge);
- GraphEdge(edge_t* edge);
+ GraphEdge(Agedge_t* edge);
CanvasEdge* canvasEdge() { return (CanvasEdge*)canvasElement(); }
const CanvasEdge* canvasEdge() const { return (CanvasEdge*)canvasElement(); }
@@ -94,7 +94,7 @@ public:
inline const QList< DotRenderOp >& arrowheads() const {return m_arrowheads;}
virtual void updateWithEdge(const GraphEdge& edge);
- virtual void updateWithEdge(edge_t* edge);
+ virtual void updateWithEdge(Agedge_t* edge);
private:
// we have a _ce *and* _from/_to because for collapsed edges,
diff --git a/src/part/graphexporter.cpp b/src/part/graphexporter.cpp
index 31ae678..4192bf1 100644
--- a/src/part/graphexporter.cpp
+++ b/src/part/graphexporter.cpp
@@ -28,6 +28,8 @@
#include "graphexporter.h"
#include "dotgraph.h"
+#include <graphviz/gvc.h>
+
#include <QFile>
#include <QTextStream>
diff --git a/src/part/graphexporter.h b/src/part/graphexporter.h
index 6c1e55c..f6b223e 100644
--- a/src/part/graphexporter.h
+++ b/src/part/graphexporter.h
@@ -33,7 +33,7 @@
#include <QString>
-#include <graphviz/gvc.h>
+class Agraph_t;
class KTemporaryFile;
@@ -53,7 +53,7 @@ public:
virtual ~GraphExporter();
QString writeDot(const DotGraph* graph, const QString& fileName = QString());
- graph_t* exportToGraphviz(const DotGraph* graph);
+ Agraph_t* exportToGraphviz(const DotGraph* graph);
};
}
diff --git a/src/part/graphnode.cpp b/src/part/graphnode.cpp
index 60d7ed1..f713c87 100644
--- a/src/part/graphnode.cpp
+++ b/src/part/graphnode.cpp
@@ -37,6 +37,8 @@
#include <math.h>
+#include <graphviz/gvc.h>
+
#include <kdebug.h>
namespace KGraphViewer
diff --git a/src/part/graphnode.h b/src/part/graphnode.h
index 8208cbf..5072286 100644
--- a/src/part/graphnode.h
+++ b/src/part/graphnode.h
@@ -37,14 +37,14 @@
#include <QMap>
#include <QtCore/QTextStream>
-#include <graphviz/gvc.h>
-
#include "dotrenderop.h"
#include "dotgrammar.h"
#include "graphelement.h"
#include "canvaselement.h"
#include "canvasnode.h"
+class Agnode_t;
+
namespace KGraphViewer
{
@@ -59,7 +59,7 @@ class GraphNode : public GraphElement
public:
GraphNode();
GraphNode(const GraphNode& gn);
- GraphNode(node_t* gn);
+ GraphNode(Agnode_t* gn);
virtual ~GraphNode() {}
@@ -68,7 +68,7 @@ public:
inline void setCanvasNode(CanvasNode* cn) { setCanvasElement((CanvasElement*)cn); }
virtual void updateWithNode(const GraphNode& node);
- virtual void updateWithNode(node_t* node);
+ virtual void updateWithNode(Agnode_t* node);
private:
diff --git a/src/part/graphsubgraph.cpp b/src/part/graphsubgraph.cpp
index d664dec..aa9f3cb 100644
--- a/src/part/graphsubgraph.cpp
+++ b/src/part/graphsubgraph.cpp
@@ -25,6 +25,8 @@
#include "canvassubgraph.h"
#include "dotdefaults.h"
+#include "graphviz/gvc.h"
+
#include <kdebug.h>
namespace KGraphViewer
diff --git a/src/part/graphsubgraph.h b/src/part/graphsubgraph.h
index d6a2119..4997375 100644
--- a/src/part/graphsubgraph.h
+++ b/src/part/graphsubgraph.h
@@ -30,12 +30,11 @@
#include "graphelement.h"
#include "dotrenderop.h"
-#include <graphviz/gvc.h>
+class Agraph_t;
namespace KGraphViewer
{
-
-
+
class CanvasSubgraph;
class GraphSubgraph;
@@ -50,7 +49,7 @@ class GraphSubgraph : public GraphElement
// Q_OBJECT
public:
GraphSubgraph();
- explicit GraphSubgraph(graph_t* sg);
+ explicit GraphSubgraph(Agraph_t* sg);
virtual ~GraphSubgraph() {}
@@ -58,7 +57,7 @@ public:
inline GraphSubgraphMap& subgraphs() {return m_subgraphsMap;}
void updateWithSubgraph(const GraphSubgraph& subgraph);
- void updateWithSubgraph(graph_t* subgraph);
+ void updateWithSubgraph(Agraph_t* subgraph);
CanvasSubgraph* canvasSubgraph() { return (CanvasSubgraph*)canvasElement(); }
void setCanvasSubgraph(CanvasSubgraph* cs) { setCanvasElement((CanvasElement*)cs); }
diff --git a/src/part/loadagraphthread.h b/src/part/loadagraphthread.h
index f2c2474..08eb78a 100644
--- a/src/part/loadagraphthread.h
+++ b/src/part/loadagraphthread.h
@@ -24,7 +24,6 @@
#include <graphviz/gvc.h>
-
class LoadAGraphThread : public QThread
{
public:
More information about the kgraphviewer-devel
mailing list