- Add required copy-ctor and assignment operator to WhatProvides.
authorMichael Andres <ma@suse.de>
Wed, 8 Oct 2008 23:03:40 +0000 (23:03 +0000)
committerMichael Andres <ma@suse.de>
Wed, 8 Oct 2008 23:03:40 +0000 (23:03 +0000)
  (bnc #433087)

VERSION.cmake
devel/devel.ma/NewPool.cc
package/libzypp.changes
zypp/sat/WhatProvides.h

index e48cfab..7080c08 100644 (file)
@@ -59,9 +59,9 @@
 #   changes file. See './mkChangelog -h' for help.
 #
 SET(LIBZYPP_MAJOR "5")
-SET(LIBZYPP_COMPATMINOR "13")
-SET(LIBZYPP_MINOR "15")
-SET(LIBZYPP_PATCH "1")
+SET(LIBZYPP_COMPATMINOR "16")
+SET(LIBZYPP_MINOR "16")
+SET(LIBZYPP_PATCH "0")
 #
 # LAST RELEASED: 5.15.1 (13)
 # (The number in parenthesis is LIBZYPP_COMPATMINOR)
index 46c6cb4..fb14532 100644 (file)
@@ -602,6 +602,70 @@ try {
 
   if ( 0 )
   {
+    CapabilitySet caps;
+    caps.insert( Capability("pattern:multimedia") );
+    caps.insert( Capability("pattern:gnome_basis") );
+    caps.insert( Capability("pattern:imaging") );
+    caps.insert( Capability("pattern:office") );
+    caps.insert( Capability("pattern:non_oss") );
+    caps.insert( Capability("pattern:non_oss_java") );
+    caps.insert( Capability("pattern:gnome_admin") );
+    caps.insert( Capability("pattern:gnome_internet") );
+    caps.insert( Capability("xsane") );
+    caps.insert( Capability("pattern:gnome_utilities") );
+    caps.insert( Capability("pattern:games") );
+    caps.insert( Capability("pattern:xgl") );
+    INT << caps << endl;
+
+    sat::WhatProvides prv1( Capability("pattern:multimedia") );
+    DBG << (prv1.begin()==prv1.begin()) << endl;
+
+    sat::WhatProvides prv( caps );
+    DBG << (prv.begin()==prv.begin()) << endl;
+//     MIL << prv.empty() << endl;
+//     MIL << prv.size() << endl;
+//     for_( it, prv.begin(), prv.end() )
+//     {
+//       INT << *it << endl;
+//     }
+//     MIL << ( prv.begin() == prv.end() ) << endl;
+// //     MIL << ( prv.begin() == prv.begin() ) << endl;
+//     MIL << ( prv.end() == prv.end() ) << endl;
+
+    sat::WhatProvides::const_iterator i1( prv.begin() );
+    sat::WhatProvides::const_iterator i2( prv.begin() );
+    sat::WhatProvides::const_iterator i3( i2 );
+    DBG << (i1==i1) << endl;
+    DBG << (i1==i2) << endl;
+    DBG << (i1==i3) << endl;
+    DBG << (i2==i2) << endl;
+    DBG << (i1==i3) << endl;
+    DBG << (i3==i3) << endl;
+
+     dumpRange( SEC, make_filter_begin( filter::byKind<Package>(), prv ),
+                     make_filter_end( filter::byKind<Package>(), prv ) ) << endl;
+
+  }
+
+  if ( 1 )
+  {
+    PoolItem pi ( getPi<Pattern>("gnome") );
+    MIL << pi << endl;
+    Pattern::constPtr p( pi->asKind<Pattern>() );
+    if ( p )
+    {
+      p->depends();
+      MIL << p->depends() << endl;
+    }
+  }
+
+  //////////////////////////////////////////////////////////////////
+  INT << "===[END]============================================" << endl << endl;
+  zypp::base::LogControl::instance().logNothing();
+  return 0;
+
+  if ( 0 )
+  {
     PoolItem pi ( getPi<Package>("amarok") );
     MIL << pi << endl;
     if ( pi )
@@ -620,72 +684,10 @@ try {
                   make_filter_begin<resfilter::ByTransact>(pool),
                   make_filter_end<resfilter::ByTransact>(pool) ) << endl;
 
- //////////////////////////////////////////////////////////////////
-  INT << "===[END]============================================" << endl << endl;
-  zypp::base::LogControl::instance().logNothing();
-  return 0;
-  for_( it, pool.byKindBegin<Product>(), pool.byKindEnd<Product>() )
-  {
-    MIL << *it << endl;
-    DBG << (*it)->provides() << endl;
-  }
-
-  sat::WhatProvides prv( Capability("product()") );
-  SEC << prv << endl;
-  for_( it, prv.begin(), prv.end() )
-  {
-
-    MIL << *it << endl;
-    MIL << it->provides() << endl;
-  }
-
-  Capability cap;
-
-  cap = Capability( "sles-release" );
-  prv = sat::WhatProvides( cap );
-  MIL << cap << ": " << prv << endl;
-
-  cap = Capability( "sles-release == 11" );
-  prv = sat::WhatProvides( cap );
-  MIL << cap << ": " << prv << endl;
-
-
-//   PoolItem pi ( getPi<Package>("sles-release", Edition("11.0") ) );
-
   //////////////////////////////////////////////////////////////////
   INT << "===[END]============================================" << endl << endl;
   zypp::base::LogControl::instance().logNothing();
   return 0;
-
-
-  //SEC << zypp::getZYpp()->diskUsage() << endl;
-
-  //vdumpPoolStats( USR << "Pool:"<< endl, pool.begin(), pool.end() ) << endl;
-
-  sat::WhatProvides prodcap( Capability("product()") );
-  dumpRange( WAR << "Product ", pool.byKindBegin<Product>(), pool.byKindEnd<Product>() ) << endl;
-  dumpRange( WAR << "ProdPac " , prodcap.poolItemBegin(), prodcap.poolItemEnd() ) << endl;
-
-  prodcap.poolItemBegin()->status().setTransact( true, ResStatus::APPL_LOW );
-  dumpRange( WAR << "Product ", pool.byKindBegin<Product>(), pool.byKindEnd<Product>() ) << endl;
-  dumpRange( WAR << "ProdPac " , prodcap.poolItemBegin(), prodcap.poolItemEnd() ) << endl;
-
-  pool.byKindBegin<Product>()->status().setTransact( true, ResStatus::USER );
-  dumpRange( WAR << "Product ", pool.byKindBegin<Product>(), pool.byKindEnd<Product>() ) << endl;
-  dumpRange( WAR << "ProdPac " , prodcap.poolItemBegin(), prodcap.poolItemEnd() ) << endl;
-
-  prodcap.poolItemBegin()->status().setLock( true, ResStatus::USER );
-  dumpRange( WAR << "Product ", pool.byKindBegin<Product>(), pool.byKindEnd<Product>() ) << endl;
-  dumpRange( WAR << "ProdPac " , prodcap.poolItemBegin(), prodcap.poolItemEnd() ) << endl;
-
-
-
-  //std::for_each( pool.begin(), pool.end(), Xprint() );
-
-  ///////////////////////////////////////////////////////////////////
-  INT << "===[END]============================================" << endl << endl;
-  zypp::base::LogControl::instance().logNothing();
-  return 0;
 }
 catch ( const Exception & exp )
 {
index 4ea14e9..3ec2faa 100644 (file)
@@ -1,4 +1,11 @@
 -------------------------------------------------------------------
+Thu Oct  9 00:58:37 CEST 2008 - ma@suse.de
+
+- Add required copy-ctor and assignment operator to WhatProvides.
+  (bnc #433087)
+- revision 11270
+
+-------------------------------------------------------------------
 Wed Oct  8 16:24:25 CEST 2008 - jkupec@suse.cz
 
 - detect and use unused loop device for mounting ISO images
index 9c6ebdf..c03b075 100644 (file)
@@ -157,18 +157,38 @@ namespace zypp
         {}
 
         /** Ctor with pointer to 1st elemment of an array.
-         * Use otherwise unused base as pointer for _baseRef. */
+         * Use otherwise unused base as pointer for _baseRef.
+         */
         explicit WhatProvidesIterator( const detail::IdType *const base_r, unsigned offset_r = 0 )
         : iterator_adaptor_( base_r ), _baseRef( base_r ? &base_reference() : 0 ), _offset( offset_r )
         {}
 
         /** Ctor with pointer to pointer to 1st elemment of an array.
-         * Required for arrays that might be relocated whlite iterating (
-        */
+         * Required for arrays that might be relocated while iterating.
+         */
         explicit WhatProvidesIterator( const detail::IdType *const* baseRef_r, unsigned offset_r )
         : iterator_adaptor_( 0 ), _baseRef( baseRef_r ), _offset( offset_r )
         {}
 
+        /** Copy-ctor required to keep _baseRef adjusted. */
+        WhatProvidesIterator( const WhatProvidesIterator & rhs )
+        : iterator_adaptor_( rhs.base_reference() )
+        , _baseRef( base_reference() ? &base_reference() : 0 )
+        , _offset( rhs._offset )
+        {}
+
+        /** Assignment operator required to keep _baseRef adjusted. */
+        WhatProvidesIterator & operator=( const WhatProvidesIterator & rhs )
+        {
+          if ( this != &rhs ) // no self assign
+          {
+            base_reference() = rhs.base_reference();
+            _baseRef = ( base_reference() ? &base_reference() : 0 );
+            _offset = rhs._offset;
+          }
+          return *this;
+        }
+
       private:
         friend class boost::iterator_core_access;
 
@@ -179,9 +199,14 @@ namespace zypp
         bool equal( const boost::iterator_adaptor<OtherDerived, OtherIterator, V, C, R, D> & rhs ) const
 #endif
         bool equal( const WhatProvidesIterator & rhs ) const
-        { // NULL pointer is eqal Id 0
-          return ( ! ( getId() || rhs.getId() ) // both @end
-                   || ( _baseRef == rhs._baseRef && _offset == rhs._offset ) );
+        {
+          if ( ! ( getId() || rhs.getId() ) )
+            return true; // both @end
+          if ( _offset != rhs._offset )
+            return false;
+          if ( base_reference() )
+            return( base_reference() == rhs.base_reference() );
+          return( _baseRef == rhs._baseRef );
         }
 
         void increment()
@@ -191,8 +216,8 @@ namespace zypp
         { return _baseRef ? (*_baseRef)[_offset] : detail::noId; }
 
       private:
-        const detail::IdType *const*const _baseRef;
-        unsigned                          _offset;
+        const detail::IdType *const* _baseRef;
+        unsigned                     _offset;
     };
     ///////////////////////////////////////////////////////////////////
     }