added isSatisfied to solvables
authorStefan Schubert <schubi@suse.de>
Mon, 7 Apr 2008 11:10:47 +0000 (11:10 +0000)
committerStefan Schubert <schubi@suse.de>
Mon, 7 Apr 2008 11:10:47 +0000 (11:10 +0000)
zypp/PoolItem.cc
zypp/Resolvable.h
zypp/sat/Solvable.cc
zypp/sat/Solvable.h

index 00f3db1..958b451 100644 (file)
@@ -56,8 +56,7 @@ namespace zypp
 
       bool isSatisfied() const
       {
-#warning TBD determine isSatisfied
-        return true;
+        return _resolvable->isSatisfied();
       }
 
     private:
index 8363f17..dbe498a 100644 (file)
@@ -82,6 +82,12 @@ namespace zypp
     //@}
 
   public:
+    /** Returns true if the solvable is satisfied */
+    using sat::Solvable::isSatisfied;
+    /** Returns true if the solvable is satisfied */
+    using sat::Solvable::isBroken;      
+
+  public:
     const sat::Solvable & satSolvable() const { return *this; }
 
   protected:
index 4b341b8..35ea1e4 100644 (file)
@@ -19,6 +19,7 @@
 
 #include "zypp/sat/detail/PoolImpl.h"
 #include "zypp/sat/Solvable.h"
+#include "zypp/sat/Pool.h"
 #include "zypp/Repository.h"
 #include "zypp/OnMediaLocation.h"
 
@@ -339,6 +340,17 @@ namespace zypp
     }
 
     ///////////////////////////////////////////////////////////////////
+
+    bool Solvable::isSatisfied() const
+    {
+       NO_SOLVABLE_RETURN( false );    
+       if (solvable_trivial_installable (_solvable, Pool::instance().systemRepo().get()) == 1)
+           return true;
+       else
+           return false;
+    }
+
+    ///////////////////////////////////////////////////////////////////
     namespace
     { /////////////////////////////////////////////////////////////////
       /** Expand \ref Capability and call \c fnc_r for each namescpace:language
index 27c6a64..e3fc92e 100644 (file)
@@ -174,6 +174,12 @@ namespace zypp
         //@}
 
       public:
+        /** Returns true if the solvable is satisfied */
+        bool isSatisfied() const;
+        /** Returns true if the solvable is satisfied */
+        bool isBroken() const { return !isSatisfied(); }       
+
+      public:
         /** \name Locale support. */
         //@{
         /** Whether this \c Solvable claims to support locales. */