You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by br...@apache.org on 2018/12/21 12:37:37 UTC

svn commit: r1849463 - in /subversion/trunk/subversion/bindings/cxx: include/svnxx/_compat.hpp include/svnxx/exception.hpp include/svnxx/noncopyable.hpp src/aprwrap/pool.hpp src/exception.cpp

Author: brane
Date: Fri Dec 21 12:37:37 2018
New Revision: 1849463

URL: http://svn.apache.org/viewvc?rev=1849463&view=rev
Log:
Remove compatibility shared pointer wrappers from SVN++.

* subversion/bindings/cxx/include/svnxx/_compat.hpp: Removed.
* subversion/bindings/cxx/include/svnxx/noncopyable.hpp: New.
  (class noncopyable): Moved definitoin here from _compat.hpp and into
   the 'detail' namespace.

* subversion/bindings/cxx/include/svnxx/exception.hpp,
* subversion/bindings/cxx/src/exception.cpp:
   Use 'std::shared_ptr' instead of the wrapper in the 'compat' namespace.

* subversion/bindings/cxx/src/aprwrap/pool.hpp:
   Use 'detail::noncopyable' instead of 'compat::noncopyable'.

Added:
    subversion/trunk/subversion/bindings/cxx/include/svnxx/noncopyable.hpp   (with props)
Removed:
    subversion/trunk/subversion/bindings/cxx/include/svnxx/_compat.hpp
Modified:
    subversion/trunk/subversion/bindings/cxx/include/svnxx/exception.hpp
    subversion/trunk/subversion/bindings/cxx/src/aprwrap/pool.hpp
    subversion/trunk/subversion/bindings/cxx/src/exception.cpp

Modified: subversion/trunk/subversion/bindings/cxx/include/svnxx/exception.hpp
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/cxx/include/svnxx/exception.hpp?rev=1849463&r1=1849462&r2=1849463&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/cxx/include/svnxx/exception.hpp (original)
+++ subversion/trunk/subversion/bindings/cxx/include/svnxx/exception.hpp Fri Dec 21 12:37:37 2018
@@ -33,14 +33,10 @@
 #include <utility>
 #include <vector>
 
-#include "svnxx/_compat.hpp"
-
 namespace apache {
 namespace subversion {
 namespace svnxx {
 
-namespace compat {} // Announce the compat namespace for shared_ptr lookup
-
 namespace detail {
 // Forward declaration of implementation-specific structure
 class ErrorDescription;
@@ -64,7 +60,7 @@ public:
   virtual const char* what() const throw();
 
 protected:
-  typedef compat::shared_ptr<detail::ErrorDescription> description_ptr;
+  typedef std::shared_ptr<detail::ErrorDescription> description_ptr;
   explicit InternalError(description_ptr description) throw();
   description_ptr m_description;
 };

Added: subversion/trunk/subversion/bindings/cxx/include/svnxx/noncopyable.hpp
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/cxx/include/svnxx/noncopyable.hpp?rev=1849463&view=auto
==============================================================================
--- subversion/trunk/subversion/bindings/cxx/include/svnxx/noncopyable.hpp (added)
+++ subversion/trunk/subversion/bindings/cxx/include/svnxx/noncopyable.hpp Fri Dec 21 12:37:37 2018
@@ -0,0 +1,72 @@
+/**
+ * @copyright
+ * ====================================================================
+ *    Licensed to the Apache Software Foundation (ASF) under one
+ *    or more contributor license agreements.  See the NOTICE file
+ *    distributed with this work for additional information
+ *    regarding copyright ownership.  The ASF licenses this file
+ *    to you under the Apache License, Version 2.0 (the
+ *    "License"); you may not use this file except in compliance
+ *    with the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *    Unless required by applicable law or agreed to in writing,
+ *    software distributed under the License is distributed on an
+ *    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *    KIND, either express or implied.  See the License for the
+ *    specific language governing permissions and limitations
+ *    under the License.
+ * ====================================================================
+ * @endcopyright
+ */
+
+#ifndef __cplusplus
+#error "This is a C++ header file."
+#endif
+
+#ifndef SVNXX_NONCOPYABLE_HPP
+#define SVNXX_NONCOPYABLE_HPP
+
+#if defined(SVNXX_USE_BOOST) && !defined(DOXYGEN)
+#include <boost/noncopyable.hpp>
+#endif
+
+namespace apache {
+namespace subversion {
+namespace svnxx {
+namespace detail {
+
+#if defined(SVNXX_USE_BOOST) && !defined(DOXYGEN)
+using boost::noncopyable;
+#else
+namespace noncopyable_ {
+
+/**
+ * @brief Base class for non-copyable objects.
+ *
+ * Objects of classes derived from @c noncopyable cannot be copyed,
+ * but can used as rvalue references and with <tt>std::move</tt>.
+ *
+ * @note Use @e private inheritance to avoid polymorphism traps!
+ */
+class noncopyable
+{
+protected:
+  constexpr noncopyable() = default;
+  ~noncopyable() = default;
+private:
+  noncopyable(const noncopyable&) = delete;
+  noncopyable& operator=(const noncopyable&) = delete;
+};
+} // namespace noncopyable_
+
+using noncopyable = noncopyable_::noncopyable;
+#endif // SVNXX_USE_BOOST
+
+} // namespace detail
+} // namespace svnxx
+} // namespace subversion
+} // namespace apache
+
+#endif  // SVNXX_NONCOPYABLE_HPP

Propchange: subversion/trunk/subversion/bindings/cxx/include/svnxx/noncopyable.hpp
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: subversion/trunk/subversion/bindings/cxx/src/aprwrap/pool.hpp
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/cxx/src/aprwrap/pool.hpp?rev=1849463&r1=1849462&r2=1849463&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/cxx/src/aprwrap/pool.hpp (original)
+++ subversion/trunk/subversion/bindings/cxx/src/aprwrap/pool.hpp Fri Dec 21 12:37:37 2018
@@ -27,7 +27,7 @@
 #include <cstdlib>
 
 #include "svnxx/exception.hpp"
-#include "svnxx/_compat.hpp"
+#include "svnxx/noncopyable.hpp"
 
 #include "svn_pools.h"
 #undef TRUE
@@ -44,7 +44,7 @@ class IterationPool;
 /**
  * Encapsulates an APR pool.
  */
-class Pool : compat::noncopyable
+class Pool : detail::noncopyable
 {
 public:
   /**
@@ -116,7 +116,7 @@ public:
    * Construct this object inside a loop body in order to clear the
    * proxied pool on every iteration.
    */
-  class Iteration : compat::noncopyable
+  class Iteration : detail::noncopyable
   {
   public:
     /**
@@ -169,7 +169,7 @@ public:
  * Construct this object outside a loop body, then within the body,
  * use Pool::Iteration to access the wrapped pool.
  */
-class IterationPool : compat::noncopyable
+class IterationPool : detail::noncopyable
 {
 public:
   IterationPool() {}

Modified: subversion/trunk/subversion/bindings/cxx/src/exception.cpp
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/cxx/src/exception.cpp?rev=1849463&r1=1849462&r2=1849463&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/cxx/src/exception.cpp (original)
+++ subversion/trunk/subversion/bindings/cxx/src/exception.cpp Fri Dec 21 12:37:37 2018
@@ -48,7 +48,7 @@ namespace detail {
 class ErrorDescription
 {
 public:
-  typedef compat::shared_ptr<ErrorDescription> shared_ptr;
+  typedef std::shared_ptr<ErrorDescription> shared_ptr;
 
   static shared_ptr create(const char* message, int error_code,
                            const char *loc_file, long loc_line,