[kgraphviewer-devel] [KGraphViewer/libkgraphviz] 631be71: Move Singleton header file to kgraphviz sources

Kevin Funk krf at electrostorm.net
Mon Dec 20 14:46:42 CET 2010


	A	 src/kgraphviz/support/singleton.h	 [License: UNKNOWN]

commit 631be71e46d5cd4f8c67dcf6708b1b88c136fb44
Author: Kevin Funk <krf at electrostorm.net>
Date:   Mon Dec 20 14:24:08 2010 +0100

    Move Singleton header file to kgraphviz sources

diff --git a/src/Singleton.h b/src/Singleton.h
deleted file mode 100644
index 43dbca1..0000000
--- a/src/Singleton.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/* This file is part of KGraphViewer.
-   Copyright (C) 2005-2007 Gael de Chalendar <kleag at free.fr>
-
-   KGraphViewer is free software; you can redistribute it and/or
-   modify it under the terms of the GNU General Public
-   License as published by the Free Software Foundation, version 2.
-
-   This program 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
-   General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-   02110-1301, USA
-*/
-
-
-#ifndef KGRAPHVIEWER_SINGLETON_H
-#define KGRAPHVIEWER_SINGLETON_H
-
-/**
- * An implementation of the singleton pattern
- *
- * @short Singleton pattern implementation
- * @author Gaël de Chalendar <kleag at free.fr>
- */
-template<typename Object>
-class Singleton
-{
-public:
-
-  /**
-    * @brief const singleton accessor
-    */
-  static const Object& single();
-
-  /**
-    * @brief singleton accessor
-    */
-  static Object& changeable();
-
-
-private:
-  static Object* s_instance;
-
-};
-
-template<typename Object>
-Object* Singleton<Object>::s_instance(0);
-
-template<typename Object>
-const Object& Singleton<Object>::single()
-{
-  if (s_instance==0)
-  {
-    s_instance=new Object();
-  }
-  return *s_instance;
-}
-
-template<typename Object>
-Object& Singleton<Object>::changeable()
-{
-  if (s_instance==0)
-  {
-    s_instance=new Object();
-  }
-  return *s_instance;
-}
-
-#endif
diff --git a/src/kgraphviz/CMakeLists.txt b/src/kgraphviz/CMakeLists.txt
index 85e596c..e06ee76 100644
--- a/src/kgraphviz/CMakeLists.txt
+++ b/src/kgraphviz/CMakeLists.txt
@@ -3,7 +3,6 @@ add_definitions(-DQT_USE_FAST_CONCATENATION)
 add_definitions(-DQT_USE_FAST_OPERATOR_PLUS)
 
 include_directories(
-  ${CMAKE_SOURCE_DIR}/src
   ${CMAKE_CURRENT_SOURCE_DIR}
 
   ${Boost_INCLUDE_DIRS}
diff --git a/src/kgraphviz/support/fontscache.h b/src/kgraphviz/support/fontscache.h
index 41af3b9..3c893e9 100644
--- a/src/kgraphviz/support/fontscache.h
+++ b/src/kgraphviz/support/fontscache.h
@@ -20,11 +20,12 @@
 #ifndef KGRAPHVIEWER_FONTSCACHE_H
 #define KGRAPHVIEWER_FONTSCACHE_H
 
-#include "Singleton.h"
+#include "singleton.h"
 
-#include <qfont.h>
-#include <qmap.h>
-#include <qstring.h>
+#include <QMap>
+#include <QString>
+
+class QFont;
 
 /**
  * This is a map of fonts used in KgraphViewer
diff --git a/src/kgraphviz/support/singleton.h b/src/kgraphviz/support/singleton.h
new file mode 100644
index 0000000..43dbca1
--- /dev/null
+++ b/src/kgraphviz/support/singleton.h
@@ -0,0 +1,73 @@
+/* This file is part of KGraphViewer.
+   Copyright (C) 2005-2007 Gael de Chalendar <kleag at free.fr>
+
+   KGraphViewer is free software; you can redistribute it and/or
+   modify it under the terms of the GNU General Public
+   License as published by the Free Software Foundation, version 2.
+
+   This program 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
+   General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+   02110-1301, USA
+*/
+
+
+#ifndef KGRAPHVIEWER_SINGLETON_H
+#define KGRAPHVIEWER_SINGLETON_H
+
+/**
+ * An implementation of the singleton pattern
+ *
+ * @short Singleton pattern implementation
+ * @author Gaël de Chalendar <kleag at free.fr>
+ */
+template<typename Object>
+class Singleton
+{
+public:
+
+  /**
+    * @brief const singleton accessor
+    */
+  static const Object& single();
+
+  /**
+    * @brief singleton accessor
+    */
+  static Object& changeable();
+
+
+private:
+  static Object* s_instance;
+
+};
+
+template<typename Object>
+Object* Singleton<Object>::s_instance(0);
+
+template<typename Object>
+const Object& Singleton<Object>::single()
+{
+  if (s_instance==0)
+  {
+    s_instance=new Object();
+  }
+  return *s_instance;
+}
+
+template<typename Object>
+Object& Singleton<Object>::changeable()
+{
+  if (s_instance==0)
+  {
+    s_instance=new Object();
+  }
+  return *s_instance;
+}
+
+#endif


More information about the kgraphviewer-devel mailing list