Imported Upstream version 17.23.0
[platform/upstream/libzypp.git] / zypp / ResStatus.h
index 0724fe3..652cc39 100644 (file)
@@ -22,7 +22,7 @@ namespace zypp
 
   namespace resstatus
   {
-    class UserLockQueryManip;
+    struct UserLockQueryManip;
     class StatusBackup;
   }
 
@@ -37,7 +37,7 @@ namespace zypp
    *        nonrelevant: it is unimportant for the user
    *       satisfied: it important nothing has to be done
    *       broken: it is incomplete. So e.g. an update is needed
-   * \li \c TransactField Wheter to transact this resolvable
+   * \li \c TransactField Whether to transact this resolvable
    *        (delete if installed install if uninstalled).
    *        In case the resolvable is locked, only USER may modify the
    *        transact bit.
@@ -191,6 +191,9 @@ namespace zypp
     bool isUnneeded() const
     { return _bitfield.test( UNNEEDED ); }
 
+    bool hasWeak() const
+    { return ! fieldValueIs<WeakField>( NO_WEAK ); }
+
     void resetWeak()
     { return fieldValueAssign<WeakField>( NO_WEAK ); }
 
@@ -222,6 +225,15 @@ namespace zypp
     bool isNonRelevant() const
     { return fieldValueIs<ValidateField>( NONRELEVANT ); }
 
+    std::string validateValueAsString() const
+    { return validateValueAsString( validate() ); }
+
+    /** ValidateValue to string used in the history file. */
+    static std::string validateValueAsString( ValidateValue val_r );
+
+    /** ValidateValue from string used in the history file. */
+    static ValidateValue stringToValidateValue( const std::string & str_r );
+
   public:
     // These two are IMMUTABLE!
 
@@ -319,7 +331,7 @@ namespace zypp
 
     /** \name Internal hard lock maintainance */
     //@{
-    friend class resstatus::UserLockQueryManip;
+    friend struct resstatus::UserLockQueryManip;
 
     bool isUserLockQueryMatch() const
     { return fieldValueIs<UserLockQueryField>( USERLOCK_MATCH ); }
@@ -663,25 +675,25 @@ namespace zypp
 
     /** Return whether the corresponding Field has value \a val_r.
     */
-    template<class _Field>
+    template<class TField>
       bool fieldValueIs( FieldType val_r ) const
-    { return _bitfield.isEqual<_Field>( val_r ); }
+    { return _bitfield.isEqual<TField>( val_r ); }
 
     /** Set the corresponding Field to value \a val_r.
     */
-    template<class _Field>
+    template<class TField>
       void fieldValueAssign( FieldType val_r )
-    { _bitfield.assign<_Field>( val_r ); }
+    { _bitfield.assign<TField>( val_r ); }
 
     /** compare two values.
     */
-    template<class _Field>
+    template<class TField>
       bool isGreaterThan( FieldType val_r )
-    { return _bitfield.value<_Field>() > val_r; }
+    { return _bitfield.value<TField>() > val_r; }
 
-    template<class _Field>
+    template<class TField>
       bool isLessThan( FieldType val_r )
-    { return _bitfield.value<_Field>() < val_r; }
+    { return _bitfield.value<TField>() < val_r; }
 
   private:
     friend class resstatus::StatusBackup;