Revert "Quick fix to allow PK and libzypp-bindings build with gcc-4.7"
[platform/upstream/libzypp.git] / zypp / base / PtrTypes.h
index deb3cfb..452c483 100644 (file)
@@ -122,6 +122,14 @@ namespace std
       return str << *obj;
     return str << std::string("NULL");
   }
+  /** \relates zypp::shared_ptr Stream output. */
+  template<class _D>
+  inline std::ostream & dumpOn( std::ostream & str, const zypp::shared_ptr<_D> & obj )
+  {
+    if ( obj )
+      return dumpOn( str, *obj );
+    return str << std::string("NULL");
+  }
 
   /** \relates zypp::intrusive_ptr Stream output. */
   template<class _D>
@@ -131,6 +139,14 @@ namespace std
       return str << *obj;
     return str << std::string("NULL");
   }
+  /** \relates zypp::intrusive_ptr Stream output. */
+  template<class _D>
+  inline std::ostream & dumpOn( std::ostream & str, const zypp::intrusive_ptr<_D> & obj )
+  {
+    if ( obj )
+      return dumpOn( str, *obj );
+    return str << std::string("NULL");
+  }
   /////////////////////////////////////////////////////////////////
 } // namespace std
 ///////////////////////////////////////////////////////////////////
@@ -308,6 +324,9 @@ namespace zypp
         _Ptr getPtr()
         { return _dptr; }
 
+        _constPtr cgetPtr()
+        { return _dptr; }
+
       private:
         _Ptr _dptr;
       };
@@ -319,8 +338,7 @@ namespace zypp
      * if the pointer is \c NULL.
     */
     template<class _D, class _Ptr>
-      inline std::ostream &
-      operator<<( std::ostream & str, const RW_pointer<_D, _Ptr> & obj )
+      inline std::ostream & operator<<( std::ostream & str, const RW_pointer<_D, _Ptr> & obj )
       {
         if ( obj.get() )
           return str << *obj.get();
@@ -329,19 +347,46 @@ namespace zypp
 
     /** \relates RW_pointer */
     template<class _D, class _Ptr>
-      inline bool
-      operator==( const RW_pointer<_D, _Ptr> & lhs, const RW_pointer<_D, _Ptr> & rhs )
-      {
-        return( lhs.get() == rhs.get() );
-      }
+      inline bool operator==( const RW_pointer<_D, _Ptr> & lhs, const RW_pointer<_D, _Ptr> & rhs )
+      { return( lhs.get() == rhs.get() ); }
+    /** \relates RW_pointer */
+     template<class _D, class _Ptr>
+       inline bool operator==( const RW_pointer<_D, _Ptr> & lhs, const typename _Ptr::_Ptr & rhs )
+       { return( lhs.get() == rhs.get() ); }
+    /** \relates RW_pointer */
+     template<class _D, class _Ptr>
+       inline bool operator==( const typename _Ptr::_Ptr & lhs, const RW_pointer<_D, _Ptr> & rhs )
+       { return( lhs.get() == rhs.get() ); }
+    /** \relates RW_pointer */
+     template<class _D, class _Ptr>
+       inline bool operator==( const RW_pointer<_D, _Ptr> & lhs, const typename _Ptr::_constPtr & rhs )
+       { return( lhs.get() == rhs.get() ); }
+    /** \relates RW_pointer */
+     template<class _D, class _Ptr>
+       inline bool operator==( const typename _Ptr::_constPtr & lhs, const RW_pointer<_D, _Ptr> & rhs )
+       { return( lhs.get() == rhs.get() ); }
+
 
     /** \relates RW_pointer */
     template<class _D, class _Ptr>
-      inline bool
-      operator!=( const RW_pointer<_D, _Ptr> & lhs, const RW_pointer<_D, _Ptr> & rhs )
-      {
-        return ! ( lhs == rhs );
-      }
+      inline bool operator!=( const RW_pointer<_D, _Ptr> & lhs, const RW_pointer<_D, _Ptr> & rhs )
+      { return ! ( lhs == rhs ); }
+    /** \relates RW_pointer */
+     template<class _D, class _Ptr>
+       inline bool operator!=( const RW_pointer<_D, _Ptr> & lhs, const typename _Ptr::_Ptr & rhs )
+       { return ! ( lhs == rhs ); }
+    /** \relates RW_pointer */
+     template<class _D, class _Ptr>
+       inline bool operator!=( const typename _Ptr::_Ptr & lhs, const RW_pointer<_D, _Ptr> & rhs )
+       { return ! ( lhs == rhs ); }
+    /** \relates RW_pointer */
+     template<class _D, class _Ptr>
+       inline bool operator!=( const RW_pointer<_D, _Ptr> & lhs, const typename _Ptr::_constPtr & rhs )
+       { return ! ( lhs == rhs ); }
+    /** \relates RW_pointer */
+     template<class _D, class _Ptr>
+       inline bool operator!=( const typename _Ptr::_constPtr & lhs, const RW_pointer<_D, _Ptr> & rhs )
+       { return ! ( lhs == rhs ); }
 
     ///////////////////////////////////////////////////////////////////
 
@@ -419,6 +464,9 @@ namespace zypp
         _Ptr getPtr()
         { assertUnshared(); return _dptr; }
 
+        _constPtr cgetPtr()
+        { return _dptr; }
+
       private:
 
         void assertUnshared()
@@ -449,8 +497,7 @@ namespace zypp
      * if the pointer is \c NULL.
     */
     template<class _D, class _Ptr>
-      inline std::ostream &
-      operator<<( std::ostream & str, const RWCOW_pointer<_D, _Ptr> & obj )
+      inline std::ostream & operator<<( std::ostream & str, const RWCOW_pointer<_D, _Ptr> & obj )
       {
         if ( obj.get() )
           return str << *obj.get();
@@ -459,19 +506,45 @@ namespace zypp
 
     /** \relates RWCOW_pointer */
     template<class _D, class _Ptr>
-      inline bool
-      operator==( const RWCOW_pointer<_D, _Ptr> & lhs, const RWCOW_pointer<_D, _Ptr> & rhs )
-      {
-        return( lhs.get() == rhs.get() );
-      }
+      inline bool operator==( const RWCOW_pointer<_D, _Ptr> & lhs, const RWCOW_pointer<_D, _Ptr> & rhs )
+      { return( lhs.get() == rhs.get() ); }
+    /** \relates RWCOW_pointer */
+    template<class _D, class _Ptr>
+      inline bool operator==( const RWCOW_pointer<_D, _Ptr> & lhs, const typename _Ptr::_Ptr & rhs )
+      { return( lhs.get() == rhs.get() ); }
+    /** \relates RWCOW_pointer */
+    template<class _D, class _Ptr>
+      inline bool operator==( const typename _Ptr::_Ptr & lhs, const RWCOW_pointer<_D, _Ptr> & rhs )
+      { return( lhs.get() == rhs.get() ); }
+    /** \relates RWCOW_pointer */
+    template<class _D, class _Ptr>
+      inline bool operator==( const RWCOW_pointer<_D, _Ptr> & lhs, const typename _Ptr::_constPtr & rhs )
+      { return( lhs.get() == rhs.get() ); }
+    /** \relates RWCOW_pointer */
+    template<class _D, class _Ptr>
+      inline bool operator==( const typename _Ptr::_constPtr & lhs, const RWCOW_pointer<_D, _Ptr> & rhs )
+      { return( lhs.get() == rhs.get() ); }
 
     /** \relates RWCOW_pointer */
     template<class _D, class _Ptr>
-      inline bool
-      operator!=( const RWCOW_pointer<_D, _Ptr> & lhs, const RWCOW_pointer<_D, _Ptr> & rhs )
-      {
-        return ! ( lhs == rhs );
-      }
+      inline bool operator!=( const RWCOW_pointer<_D, _Ptr> & lhs, const RWCOW_pointer<_D, _Ptr> & rhs )
+      { return ! ( lhs == rhs ); }
+    /** \relates RWCOW_pointer */
+    template<class _D, class _Ptr>
+      inline bool operator!=( const RWCOW_pointer<_D, _Ptr> & lhs, const typename _Ptr::_Ptr & rhs )
+      { return ! ( lhs == rhs ); }
+    /** \relates RWCOW_pointer */
+    template<class _D, class _Ptr>
+      inline bool operator!=( const typename _Ptr::_Ptr & lhs, const RWCOW_pointer<_D, _Ptr> & rhs )
+      { return ! ( lhs == rhs ); }
+    /** \relates RWCOW_pointer */
+    template<class _D, class _Ptr>
+      inline bool operator!=( const RWCOW_pointer<_D, _Ptr> & lhs, const typename _Ptr::_constPtr & rhs )
+      { return ! ( lhs == rhs ); }
+    /** \relates RWCOW_pointer */
+    template<class _D, class _Ptr>
+      inline bool operator!=( const typename _Ptr::_constPtr & lhs, const RWCOW_pointer<_D, _Ptr> & rhs )
+      { return ! ( lhs == rhs ); }
 
     ///////////////////////////////////////////////////////////////////