From d07450bbd897f25e99ec996bada7a1b8e286c92a Mon Sep 17 00:00:00 2001 From: Stefan Schubert Date: Mon, 7 Apr 2008 11:10:47 +0000 Subject: [PATCH] added isSatisfied to solvables --- zypp/PoolItem.cc | 3 +-- zypp/Resolvable.h | 6 ++++++ zypp/sat/Solvable.cc | 12 ++++++++++++ zypp/sat/Solvable.h | 6 ++++++ 4 files changed, 25 insertions(+), 2 deletions(-) diff --git a/zypp/PoolItem.cc b/zypp/PoolItem.cc index 00f3db1..958b451 100644 --- a/zypp/PoolItem.cc +++ b/zypp/PoolItem.cc @@ -56,8 +56,7 @@ namespace zypp bool isSatisfied() const { -#warning TBD determine isSatisfied - return true; + return _resolvable->isSatisfied(); } private: diff --git a/zypp/Resolvable.h b/zypp/Resolvable.h index 8363f17..dbe498a 100644 --- a/zypp/Resolvable.h +++ b/zypp/Resolvable.h @@ -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: diff --git a/zypp/sat/Solvable.cc b/zypp/sat/Solvable.cc index 4b341b8..35ea1e4 100644 --- a/zypp/sat/Solvable.cc +++ b/zypp/sat/Solvable.cc @@ -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 diff --git a/zypp/sat/Solvable.h b/zypp/sat/Solvable.h index 27c6a64..e3fc92e 100644 --- a/zypp/sat/Solvable.h +++ b/zypp/sat/Solvable.h @@ -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. */ -- 2.7.4