Provide Selectable::identicalAvailable as counterpart to identicalInstalled.
authorMichael Andres <ma@suse.de>
Wed, 2 Dec 2009 17:28:59 +0000 (18:28 +0100)
committerMichael Andres <ma@suse.de>
Wed, 2 Dec 2009 17:28:59 +0000 (18:28 +0100)
zypp/ui/Selectable.cc
zypp/ui/Selectable.h
zypp/ui/SelectableImpl.h

index 6283a17..23e2e19 100644 (file)
@@ -82,6 +82,9 @@ namespace zypp
     PoolItem Selectable::highestAvailableVersionObj() const
     { return _pimpl->highestAvailableVersionObj(); }
 
+    bool Selectable::identicalAvailable( const PoolItem & rhs ) const
+    { return _pimpl->identicalAvailable( rhs ); }
+
     bool Selectable::identicalInstalled( const PoolItem & rhs ) const
     { return _pimpl->identicalInstalled( rhs ); }
 
index 875e086..9be8a75 100644 (file)
@@ -147,8 +147,14 @@ namespace zypp
        */
       PoolItem highestAvailableVersionObj() const;
 
-      /** \c True if \a rhs has the same content as an installed one.
-       *  Basically the same name, edition, arch, vendor and buildtime.
+     /** \c True if \a rhs is installed and one with the same content is available.
+       * Basically the same name, edition, arch, vendor and buildtime.
+       * \see \ref sat::Solvable::identical
+       */
+      bool identicalAvailable( const PoolItem & rhs ) const;
+
+     /** \c True if \a rhs has the same content as an installed one.
+       * Basically the same name, edition, arch, vendor and buildtime.
        * \see \ref sat::Solvable::identical
        */
       bool identicalInstalled( const PoolItem & rhs ) const;
index ef71ef7..85ec1a3 100644 (file)
@@ -168,7 +168,7 @@ namespace zypp
         return _defaultCandidate;
       }
 
-      /** \copydoc Selectable::highestAvailableVersionObj() */
+      /** \copydoc Selectable::highestAvailableVersionObj()const */
       PoolItem highestAvailableVersionObj() const
       {
         PoolItem ret;
@@ -180,9 +180,21 @@ namespace zypp
         return ret;
       }
 
-      /** \c True if \a rhs has the same content as an installed one.
-       * \see \ref sat::Solvable::identical
-       */
+      /** \copydoc Selectable::identicalAvailable( const PoolItem & )const */
+      bool identicalAvailable( const PoolItem & rhs ) const
+      {
+        if ( !availableEmpty() && rhs )
+        {
+          for_( it, _availableItems.begin(), _availableItems.end() )
+          {
+            if ( identical( *it, rhs ) )
+              return true;
+          }
+        }
+        return false;
+      }
+
+      /** \copydoc Selectable::identicalInstalled( const PoolItem & )const */
       bool identicalInstalled( const PoolItem & rhs ) const
       {
         if ( !installedEmpty() && rhs )