[kgraphviewer-devel] [KGraphViewer] c710423: Export core API of kgraphviz for testing purposes

Kevin Funk krf at electrostorm.net
Fri Dec 10 16:26:43 CET 2010


	A	 src/kgraphviz/kgraphviz_export.h	 [License: UNKNOWN]

commit c7104237c5eb693f5211c587187990b360d10a8f
Author: Kevin Funk <krf at electrostorm.net>
Date:   Fri Dec 10 16:13:24 2010 +0100

    Export core API of kgraphviz for testing purposes
    
    Also add kgraphviz_export header file.

diff --git a/src/kgraphviz/dotgraph.h b/src/kgraphviz/dotgraph.h
index 4a52afc..571b22d 100644
--- a/src/kgraphviz/dotgraph.h
+++ b/src/kgraphviz/dotgraph.h
@@ -33,7 +33,7 @@
 #include "graphsubgraph.h"
 #include "graphnode.h"
 #include "graphedge.h"
-#include "shared/kgraphviewer_export.h"
+#include "kgraphviz_export.h"
 #include "support/dotdefaults.h"
 
 class Agraph_t;
@@ -44,7 +44,7 @@ namespace KGraphViewer
 /**
   * A class representing the model of a GraphViz dot graph
   */
-class DotGraph : public GraphElement
+class KGRAPHVIZ_EXPORT DotGraph : public GraphElement
 {
   Q_OBJECT
 public:
@@ -101,32 +101,32 @@ public:
 
   virtual void storeOriginalAttributes();
 
-  void KGRAPHVIEWER_EXPORT saveTo(const QString& fileName);
+  void saveTo(const QString& fileName);
 
   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);
+  void setAttribute(const QString& elementId, const QString& attributeName, const QString& attributeValue);
 
   GraphElement* elementNamed(const QString& id);
 
   inline void setUseLibrary(bool value) {m_useLibrary = value;}
   inline bool useLibrary() {return m_useLibrary;}
 
-  void KGRAPHVIEWER_EXPORT setGraphAttributes(QMap<QString,QString> attribs);
-  void KGRAPHVIEWER_EXPORT addNewNode(QMap<QString,QString> attribs);
-  void KGRAPHVIEWER_EXPORT addNewSubgraph(QMap<QString,QString> attribs);
-  void KGRAPHVIEWER_EXPORT addNewNodeToSubgraph(QMap<QString,QString> attribs, QString subgraph);
-  void KGRAPHVIEWER_EXPORT addExistingNodeToSubgraph(QMap<QString,QString> attribs,QString subgraph);
-  void KGRAPHVIEWER_EXPORT moveExistingNodeToMainGraph(QMap<QString,QString> attribs);
-  void KGRAPHVIEWER_EXPORT addNewEdge(QString src, QString tgt, QMap<QString,QString> attribs);
-  void KGRAPHVIEWER_EXPORT removeAttribute(const QString& nodeName, const QString& attribName);
-  void KGRAPHVIEWER_EXPORT renameNode(const QString& oldNodeName, const QString& newNodeName);
-  void KGRAPHVIEWER_EXPORT removeNodeNamed(const QString& nodeName);
-  void KGRAPHVIEWER_EXPORT removeNodeFromSubgraph(const QString& nodeName, const QString& subgraphName);
-  void KGRAPHVIEWER_EXPORT removeSubgraphNamed(const QString& subgraphName);
-  void KGRAPHVIEWER_EXPORT removeEdge(const QString& id);
-  void KGRAPHVIEWER_EXPORT removeElement(const QString& id);
+  void setGraphAttributes(QMap<QString,QString> attribs);
+  void addNewNode(QMap<QString,QString> attribs);
+  void addNewSubgraph(QMap<QString,QString> attribs);
+  void addNewNodeToSubgraph(QMap<QString,QString> attribs, QString subgraph);
+  void addExistingNodeToSubgraph(QMap<QString,QString> attribs,QString subgraph);
+  void moveExistingNodeToMainGraph(QMap<QString,QString> attribs);
+  void addNewEdge(QString src, QString tgt, QMap<QString,QString> attribs);
+  void removeAttribute(const QString& nodeName, const QString& attribName);
+  void renameNode(const QString& oldNodeName, const QString& newNodeName);
+  void removeNodeNamed(const QString& nodeName);
+  void removeNodeFromSubgraph(const QString& nodeName, const QString& subgraphName);
+  void removeSubgraphNamed(const QString& subgraphName);
+  void removeEdge(const QString& id);
+  void removeElement(const QString& id);
 
 Q_SIGNALS:
   void readyToDisplay();
diff --git a/src/kgraphviz/dotgraphview.h b/src/kgraphviz/dotgraphview.h
index c550f5e..dafd20d 100644
--- a/src/kgraphviz/dotgraphview.h
+++ b/src/kgraphviz/dotgraphview.h
@@ -32,8 +32,9 @@
 #ifndef DOTGRAPHVIEW_H
 #define DOTGRAPHVIEW_H
 
+#include "kgraphviz_export.h"
+
 #include "shared/kgraphviewer_interface.h"
-#include "shared/kgraphviewer_export.h"
 
 #include <kconfig.h>
 #include <kactioncollection.h>
@@ -75,7 +76,7 @@ class DotGraphViewPrivate;
  * and another zoomed out CanvasView in a border acting as
  * a panner to select to visible part (only if needed)
  */
-class KGRAPHVIEWER_EXPORT DotGraphView: public QGraphicsView
+class KGRAPHVIZ_EXPORT DotGraphView: public QGraphicsView
 {
  Q_OBJECT
 
@@ -83,11 +84,11 @@ public:
   enum EditingMode { None, AddNewElement, AddNewEdge, DrawNewEdge, SelectingElements };
   enum ScrollDirection { Here, Left, Right, Top, Bottom };
   
-  explicit KGRAPHVIEWER_EXPORT DotGraphView(KActionCollection* actions, QWidget* parent=0);
+  explicit DotGraphView(KActionCollection* actions, QWidget* parent=0);
   virtual ~DotGraphView();
 
-  bool KGRAPHVIEWER_EXPORT loadDot(const QString& dotFileName);
-  bool KGRAPHVIEWER_EXPORT loadLibrary(const QString& dotFileName);
+  bool loadDot(const QString& dotFileName);
+  bool loadLibrary(const QString& dotFileName);
   bool loadLibrary(Agraph_t* graph, const QString& layoutCommand = "dot");
 
   void readViewConfig();
@@ -145,8 +146,8 @@ public:
 
   EditingMode editingMode() const;
 
-  void KGRAPHVIEWER_EXPORT setReadOnly();
-  void KGRAPHVIEWER_EXPORT setReadWrite();
+  void setReadOnly();
+  void setReadWrite();
   bool isReadWrite() const;
   bool isReadOnly() const;
   
diff --git a/src/kgraphviz/graphedge.h b/src/kgraphviz/graphedge.h
index 48331f1..d439adc 100644
--- a/src/kgraphviz/graphedge.h
+++ b/src/kgraphviz/graphedge.h
@@ -33,6 +33,7 @@
 #define GRAPH_EDGE_H
 
 #include "graphelement.h"
+#include "kgraphviz_export.h"
 #include "support/dotrenderop.h"
 
 #include <QStringList>
@@ -48,7 +49,7 @@ class CanvasEdge;
 class CanvasNode;
 class GraphNode;
 
-class GraphEdge : public GraphElement
+class KGRAPHVIZ_EXPORT GraphEdge : public GraphElement
 {
   Q_OBJECT
 
diff --git a/src/kgraphviz/graphelement.h b/src/kgraphviz/graphelement.h
index 13bdd22..8703325 100644
--- a/src/kgraphviz/graphelement.h
+++ b/src/kgraphviz/graphelement.h
@@ -19,6 +19,7 @@
 #ifndef GRAPH_ELEMENT_H
 #define GRAPH_ELEMENT_H
 
+#include "kgraphviz_export.h"
 #include "support/dotrenderop.h"
 
 #include <QVector>
@@ -35,7 +36,7 @@ class CanvasElement;
  * The base of all GraphViz dot graph elements (nodes, edges, subgraphs,
  * graphs). It is used to store the element attributes
  */
-class GraphElement: public QObject
+class KGRAPHVIZ_EXPORT GraphElement: public QObject
 {
   Q_OBJECT
 public:
diff --git a/src/kgraphviz/graphnode.h b/src/kgraphviz/graphnode.h
index ce6c2e9..532d55a 100644
--- a/src/kgraphviz/graphnode.h
+++ b/src/kgraphviz/graphnode.h
@@ -32,14 +32,15 @@
 #ifndef GRAPH_NODE_H
 #define GRAPH_NODE_H
 
+#include "graphelement.h"
+#include "kgraphviz_export.h"
+#include "support/dotrenderop.h"
+
 #include <QVector>
 #include <QList>
 #include <QMap>
 #include <QtCore/QTextStream>
 
-#include "support/dotrenderop.h"
-#include "graphelement.h"
-
 class Agnode_t;
 
 namespace KGraphViewer
@@ -51,7 +52,7 @@ class CanvasNode;
 /**
  * Colors and styles are dot names
  */
-class GraphNode : public GraphElement
+class KGRAPHVIZ_EXPORT GraphNode : public GraphElement
 {
   Q_OBJECT
 
diff --git a/src/kgraphviz/graphsubgraph.h b/src/kgraphviz/graphsubgraph.h
index 4b3477d..2606579 100644
--- a/src/kgraphviz/graphsubgraph.h
+++ b/src/kgraphviz/graphsubgraph.h
@@ -23,11 +23,12 @@
 #ifndef GRAPH_SUBGRAPH_H
 #define GRAPH_SUBGRAPH_H
 
+#include "graphelement.h"
+#include "kgraphviz_export.h"
+
 #include <QMap>
 #include <QTextStream>
 
-#include "graphelement.h"
-
 class Agraph_t;
 
 namespace KGraphViewer
@@ -42,7 +43,7 @@ typedef QMap<QString, GraphSubgraph*> GraphSubgraphMap;
 /**
  * Colors and styles are dot names
  */
-class GraphSubgraph : public GraphElement
+class KGRAPHVIZ_EXPORT GraphSubgraph : public GraphElement
 {
   Q_OBJECT
 
diff --git a/src/kgraphviz/kgraphviz_export.h b/src/kgraphviz/kgraphviz_export.h
new file mode 100644
index 0000000..0ffb193
--- /dev/null
+++ b/src/kgraphviz/kgraphviz_export.h
@@ -0,0 +1,40 @@
+/*
+    Copyright (C) 2010 Kevin Funk <krf at electrostorm.net>
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Library General Public
+    License as published by the Free Software Foundation; either
+    version 2 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Library General Public License for more details.
+
+    You should have received a copy of the GNU Library General Public License
+    along with this library; see the file COPYING.LIB.  If not, write to
+    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+    Boston, MA 02110-1301, USA.
+*/
+
+#ifndef KGRAPHVIZ_EXPORT_H
+#define KGRAPHVIZ_EXPORT_H
+
+/* needed for KDE_EXPORT and KDE_IMPORT macros */
+#include <kdemacros.h>
+
+#ifndef KGRAPHVIZ_EXPORT
+# if defined(MAKE_KGRAPHVIZ_LIB)
+   /* We are building this library */
+#  define KGRAPHVIZ_EXPORT KDE_EXPORT
+# else
+   /* We are using this library */
+#  define KGRAPHVIZ_EXPORT KDE_IMPORT
+# endif
+#endif
+
+# ifndef KGRAPHVIZ_EXPORT_DEPRECATED
+#  define KGRAPHVIZ_EXPORT_DEPRECATED KDE_DEPRECATED KGRAPHVIZ_EXPORT
+# endif
+
+#endif
\ No newline at end of file


More information about the kgraphviewer-devel mailing list