Enhance PoolItem interface to assist patch classification. (bnc#627316)
authorMichael Andres <ma@suse.de>
Mon, 2 Aug 2010 10:00:33 +0000 (12:00 +0200)
committerMichael Andres <ma@suse.de>
Mon, 2 Aug 2010 10:00:33 +0000 (12:00 +0200)
zypp/PoolItem.cc
zypp/PoolItem.h

index 710255a..3f9e633 100644 (file)
@@ -90,6 +90,16 @@ namespace zypp
          return status().isBroken();
       }
 
+      bool isNeeded() const
+      {
+       return status().isToBeInstalled() || ( isBroken() && ! status().isLocked() );
+      }
+
+      bool isUnwanted() const
+      {
+       return isBroken() && status().isLocked();
+      }
+
     private:
       mutable ResStatus     _status;
       ResObject::constPtr   _resolvable;
@@ -252,6 +262,12 @@ namespace zypp
   bool PoolItem::isBroken() const
   { return _pimpl->isBroken(); }
 
+  bool PoolItem::isNeeded() const
+  { return _pimpl->isNeeded(); }
+
+  bool PoolItem::isUnwanted() const
+  { return _pimpl->isUnwanted(); }
+
   void PoolItem::saveState() const
   { _pimpl->saveState(); }
 
index ff5d923..363cb44 100644 (file)
@@ -95,6 +95,14 @@ namespace zypp
 
       /** Whether a relevant items requirements are broken. */
       bool isBroken() const;
+
+      /** This includes \c unlocked broken patches, as well as those already
+       * selected to be installed (otherwise classified as \c satisfied).
+       */
+      bool isNeeded() const;
+
+      /** Broken (needed) but locked patches. */
+      bool isUnwanted() const;
       //@}
 
       //@}