[niepce] Remove boost::noncopyable.



commit e5d3ab0e95458e07fd9ad63302d253a82f0ca432
Author: Hubert Figuière <hub figuiere net>
Date:   Sat Aug 31 23:19:41 2013 -0400

    Remove boost::noncopyable.

 src/fwk/base/Makefile.am     |    1 +
 src/fwk/base/util.hpp        |   24 ++++++++++++++++++++++++
 src/fwk/toolkit/undo.hpp     |   15 ++++++++++-----
 src/fwk/utils/databinder.hpp |    9 +++++++--
 src/fwk/utils/exempi.hpp     |    9 +++++----
 src/fwk/utils/gphoto.hpp     |    8 ++++----
 6 files changed, 51 insertions(+), 15 deletions(-)
---
diff --git a/src/fwk/base/Makefile.am b/src/fwk/base/Makefile.am
index 0d9ba62..2e33b87 100644
--- a/src/fwk/base/Makefile.am
+++ b/src/fwk/base/Makefile.am
@@ -45,6 +45,7 @@ libfwkbase_a_SOURCES = colour.hpp colour.cpp \
        moniker.hpp moniker.cpp \
        geometry.hpp geometry.cpp \
        singleton.hpp \
+       util.hpp \
        map.hpp \
        propertybag.hpp propertybag.cpp \
        $(NULL)
diff --git a/src/fwk/base/util.hpp b/src/fwk/base/util.hpp
new file mode 100644
index 0000000..62f45ac
--- /dev/null
+++ b/src/fwk/base/util.hpp
@@ -0,0 +1,24 @@
+/*
+ * niepce - fwk/utils/util.hpp
+ *
+ * Copyright (C) 2013 Hubert Figuiere
+ *
+ * This program 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, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * 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, see <http://www.gnu.org/licenses/>.
+ */
+
+#pragma once
+
+#define NON_COPYABLE(x) \
+       x(const x&) = delete;\
+       x& operator=(const x&) = delete
diff --git a/src/fwk/toolkit/undo.hpp b/src/fwk/toolkit/undo.hpp
index e6a0acb..3f96dd3 100644
--- a/src/fwk/toolkit/undo.hpp
+++ b/src/fwk/toolkit/undo.hpp
@@ -1,7 +1,7 @@
 /*
  * niepce - fwk/toolkit/undo.hpp
  *
- * Copyright (C) 2008-2009 Hubert Figuiere
+ * Copyright (C) 2008-2013 Hubert Figuiere
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -24,12 +24,12 @@
 #include <list>
 #include <stack>
 #include <string>
-#include <boost/noncopyable.hpp>
 
 #include <sigc++/signal.h>
 #include <sigc++/trackable.h>
 
 #include "fwk/toolkit/command.hpp"
+#include "fwk/base/util.hpp"
 
 namespace fwk {
 
@@ -37,8 +37,11 @@ namespace fwk {
 class UndoTransaction
 {
 public:
+    NON_COPYABLE(UndoTransaction);
+
     UndoTransaction(const std::string & n);
     ~UndoTransaction();
+
     template <typename _RetType>
     Command *new_command(const typename CommandWithArg<_RetType>::RedoFunction &,
                          const typename CommandWithArg<_RetType>::UndoFunction &);
@@ -68,12 +71,14 @@ Command *UndoTransaction::new_command(const typename CommandWithArg<_ArgType>::R
 
 
 class UndoHistory
-    : public boost::noncopyable
-    , public sigc::trackable
+    : public sigc::trackable
 {
 public:
+    NON_COPYABLE(UndoHistory);
+
+    UndoHistory() {}
     ~UndoHistory();
-               
+
     /** the history becomes owner */
     void add(UndoTransaction*);
     void undo();
diff --git a/src/fwk/utils/databinder.hpp b/src/fwk/utils/databinder.hpp
index 1df093a..a783292 100644
--- a/src/fwk/utils/databinder.hpp
+++ b/src/fwk/utils/databinder.hpp
@@ -27,14 +27,19 @@
 
 #include <boost/utility.hpp>
 
+#include "fwk/base/util.hpp"
+
 namespace fwk {
 
 /** @brief the base class for all the data binders */
 class DataBinderBase
-       : public boost::noncopyable
 {
 public:
-       virtual ~DataBinderBase() 
+       NON_COPYABLE(DataBinderBase);
+
+       DataBinderBase()
+               {}
+       virtual ~DataBinderBase()
                {}
 };
 
diff --git a/src/fwk/utils/exempi.hpp b/src/fwk/utils/exempi.hpp
index a1061fa..47ff38e 100644
--- a/src/fwk/utils/exempi.hpp
+++ b/src/fwk/utils/exempi.hpp
@@ -24,10 +24,9 @@
 #include <vector>
 #include <string>
 
-#include <boost/noncopyable.hpp>
-
 #include <exempi/xmp.h>
 
+#include "fwk/base/util.hpp"
 
 namespace xmp {
 
@@ -61,9 +60,10 @@ void release(XmpPtr ptr)
  */
 template <class T>
 class ScopedPtr 
-    : boost::noncopyable
 {
 public:
+    NON_COPYABLE(ScopedPtr);
+
     ScopedPtr(T p)
         : _p(p)
         {}
@@ -88,9 +88,10 @@ namespace fwk {
 class Date;
 
 class ExempiManager
-    : public boost::noncopyable
 {
 public:
+    NON_COPYABLE(ExempiManager);
+
     struct ns_defs_t {
         const char *ns;
         const char *prefix;
diff --git a/src/fwk/utils/gphoto.hpp b/src/fwk/utils/gphoto.hpp
index d9bb1ad..8a069d1 100644
--- a/src/fwk/utils/gphoto.hpp
+++ b/src/fwk/utils/gphoto.hpp
@@ -1,5 +1,5 @@
 /*
- * niepce - fwk/utils/gphoto.cpp
+ * niepce - fwk/utils/gphoto.hpp
  *
  * Copyright (C) 2009-2013 Hubert Figuiere
  *
@@ -25,21 +25,21 @@
 #include <string>
 #include <memory>
 
-#include <boost/noncopyable.hpp>
-
 extern "C" {
 #include <gphoto2-port-info-list.h>
 #include <gphoto2-abilities-list.h>
 }
 
+#include "fwk/base/util.hpp"
 #include "fwk/base/singleton.hpp"
 
 namespace fwk {
 
 class GpDevice
-  : public boost::noncopyable
 {
 public:
+  NON_COPYABLE(GpDevice);
+
   typedef std::shared_ptr<GpDevice> Ptr;
 
   GpDevice(const std::string & model, const std::string & path);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]