From: Klaus Kaempf Date: Thu, 26 Jan 2006 16:12:20 +0000 (+0000) Subject: more set/get status functions X-Git-Tag: 6.6.0~5739 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=0d0a220b385d6fa18767a8d9c3d016e938bc3f87;p=platform%2Fupstream%2Flibzypp.git more set/get status functions --- diff --git a/zypp/ResStatus.h b/zypp/ResStatus.h index 4589e5452..0714e6d9d 100644 --- a/zypp/ResStatus.h +++ b/zypp/ResStatus.h @@ -26,9 +26,14 @@ namespace zypp // /** Status bitfield. * - * \li \c StateField Whether the resolvable is installed + * \li \c StateField Whether the resolvable is currently installed * or uninstalled (available). - * \li \c FreshenField Freshen status computed by the solver. + * \li \c EstablishField Established status computed by the solver as + * unneeded (have freshens but none of them trigger) + * satisfied (no freshen or at least one triggered freshen and + * all requires fulfilled) + * or incomplete (no freshen or at least one triggered freshen and + * NOT all requires fulfilled) * \li \c TransactField Wheter to transact this resolvable * (delete if installed install if uninstalled). * \li \c TransactByField Who triggered the transaction. Transaction @@ -44,8 +49,8 @@ namespace zypp typedef char FieldType; // Bit Ranges within FieldType defined by 1st bit and size: typedef bit::Range StateField; - typedef bit::Range FreshenField; - typedef bit::Range TransactField; + typedef bit::Range EstablishField; + typedef bit::Range TransactField; typedef bit::Range TransactByField; typedef bit::Range TransactDetailField; // enlarge FieldType if more bit's needed. It's not yet @@ -59,17 +64,17 @@ namespace zypp UNINSTALLED = 0, INSTALLED = StateField::minval }; - enum FreshenValue + enum EstablishValue { UNDETERMINED = 0, - NO_TRIGGER = FreshenField::minval, - TRIGGER_OK, - TRIGGER_FAILED + UNNEEDED = EstablishField::minval, + SATISFIED, + INCOMPLETE }; enum TransactValue { KEEP_STATE = 0, - TRANSACT = TransactField::minval + TRANSACT = TransactField::minval // change state installed <-> uninstalled }; enum TransactByValue { @@ -96,7 +101,7 @@ namespace zypp /** Default ctor. */ ResStatus(); - /** Ctor seting the initail . */ + /** Ctor setting the initial . */ ResStatus( bool isInstalled_r ); /** Dtor. */ @@ -107,9 +112,36 @@ namespace zypp bool isInstalled() const { return fieldValueIs( INSTALLED ); } - bool transacts() const + bool isToBeInstalled() const + { return isUninstalled() && transacts(); } + + bool isUninstalled() const + { return fieldValueIs( UNINSTALLED ); } + + bool isToBeUninstalled() const + { return isInstalled() && transacts(); } + + bool isUnneeded() const + { return fieldValueIs( UNNEEDED ); } + + bool isSatisfied() const + { return fieldValueIs( SATISFIED ); } + + bool isIncomplete() const + { return fieldValueIs( INCOMPLETE ); } + + bool transacts() const { return fieldValueIs( TRANSACT ); } + bool isToBeUninstalledDueToObsolete () const + { return isToBeUninstalled() && fieldValueIs( DUE_TO_OBSOLETE ); } + + bool isToBeUninstalledDueToUnlink() const + { return isToBeUninstalled() && fieldValueIs( DUE_TO_UNLINK); } + + bool isToBeInstalledSoft () const + { return isToBeInstalled() && fieldValueIs (SOFT_REQUIRES); } + public: bool setTransacts( bool val_r ) @@ -118,6 +150,58 @@ namespace zypp return true; } + bool setToBeInstalled ( ) + { + if (isInstalled()) return false; + return setTransacts (true); + } + + bool setToBeInstalledSoft ( ) + { + if (!setToBeInstalled()) return false; + fieldValueAssign(SOFT_REQUIRES); + return true; + } + + bool setToBeUninstalled ( ) + { + if (isUninstalled()) return false; + return setTransacts (true); + } + + bool setToBeUninstalledDueToUnlink ( ) + { + if (!setToBeUninstalled()) return false; + fieldValueAssign(DUE_TO_UNLINK); + return true; + } + + bool setToBeUninstalledDueToObsolete ( ) + { + if (!setToBeUninstalled()) return false; + fieldValueAssign(DUE_TO_OBSOLETE); + return true; + } + + // *** These are only for the Resolver *** + + bool setUnneeded () + { + fieldValueAssign(UNNEEDED); + return true; + } + + bool setSatisfied () + { + fieldValueAssign(SATISFIED); + return true; + } + + bool setIncomplete () + { + fieldValueAssign(INCOMPLETE); + return true; + } // get/set functions, returnig \c true if requested status change // was successfull (i.e. leading to the desired transaction).