namespace zypp
{ /////////////////////////////////////////////////////////////////
+ const ResStatus ResStatus::toBeInstalled (UNINSTALLED, UNDETERMINED, TRANSACT);
+ const ResStatus ResStatus::toBeInstalledSoft (UNINSTALLED, UNDETERMINED, TRANSACT, SOFT_REQUIRES);
+ const ResStatus ResStatus::toBeUninstalled (INSTALLED, UNDETERMINED, TRANSACT);
+ const ResStatus ResStatus::toBeUninstalledDueToUnlink (INSTALLED, UNDETERMINED, TRANSACT, EXPLICIT_INSTALL, DUE_TO_UNLINK);
+ const ResStatus ResStatus::toBeUninstalledDueToObsolete(INSTALLED, UNDETERMINED, TRANSACT, EXPLICIT_INSTALL, DUE_TO_OBSOLETE);
+ const ResStatus ResStatus::incomplete (INSTALLED, INCOMPLETE);
+ const ResStatus ResStatus::complete (INSTALLED, SATISFIED);
+ const ResStatus ResStatus::satisfied (UNINSTALLED, SATISFIED);
+ const ResStatus ResStatus::unneeded (UNINSTALLED, UNNEEDED);
+ const ResStatus ResStatus::needed (UNINSTALLED, INCOMPLETE);
+
///////////////////////////////////////////////////////////////////
//
// METHOD NAME : ResStatus::ResStatus
{}
-ResStatus ResStatus::toBeInstalled = ResStatus (UNINSTALLED, UNDETERMINED, TRANSACT);
-ResStatus ResStatus::toBeInstalledSoft = ResStatus (UNINSTALLED, UNDETERMINED, TRANSACT, SOFT_REQUIRES);
-ResStatus ResStatus::toBeUninstalled = ResStatus (INSTALLED, UNDETERMINED, TRANSACT);
-ResStatus ResStatus::toBeUninstalledDueToUnlink = ResStatus (INSTALLED, UNDETERMINED, TRANSACT, EXPLICIT_INSTALL, DUE_TO_UNLINK);
-ResStatus ResStatus::toBeUninstalledDueToObsolete= ResStatus (INSTALLED, UNDETERMINED, TRANSACT, EXPLICIT_INSTALL, DUE_TO_OBSOLETE);
-ResStatus ResStatus::incomplete = ResStatus (INSTALLED, INCOMPLETE);
-ResStatus ResStatus::complete = ResStatus (INSTALLED, SATISFIED);
-ResStatus ResStatus::satisfied = ResStatus (UNINSTALLED, SATISFIED);
-ResStatus ResStatus::unneeded = ResStatus (UNINSTALLED, UNNEEDED);
-ResStatus ResStatus::needed = ResStatus (UNINSTALLED, INCOMPLETE);
-
ResStatus::ResStatus (enum StateValue s, enum EstablishValue e, enum TransactValue t, enum InstallDetailValue i, enum RemoveDetailValue r)
: _bitfield (s)
{
if (obj == ResStatus::complete) str << "<complete>"; // installed, satisfied
if (obj == ResStatus::unneeded) str << "<uneeded>"; // uninstalled, unneeded
if (obj == ResStatus::needed) str << "<needed>"; // uninstalled, incomplete
- if (obj == ResStatus::incomplete) str << "<incomplete>"; // installed, incomplete
+ if (obj == ResStatus::incomplete) str << "<incomplete>"; // installed, incomplete
return str;
}
class ResStatus
{
friend std::ostream & operator<<( std::ostream & str, const ResStatus & obj );
-
+ friend bool operator==( const ResStatus & lhs, const ResStatus & rhs );
+
+ /** \name BitField range definitions.
+ *
+ * \note Enlarge FieldType if more bit's needed. It's not yet
+ * checked by the compiler.
+ */
+ //@{
typedef char FieldType;
// Bit Ranges within FieldType defined by 1st bit and size:
typedef bit::Range<FieldType,0, 1> StateField;
typedef bit::Range<FieldType,TransactByField::end, 2> TransactDetailField;
// enlarge FieldType if more bit's needed. It's not yet
// checked by the compiler.
+ //@}
public:
- // do we manage to hide them
-
+ /** \name Status values.
+ *
+ * Each enum corresponds to a BitField range.
+ * \note Take care that enumerator values actually fit into
+ * the corresponding field. It's not yet checked by the compiler.
+ */
+ //@{
enum StateValue
{
UNINSTALLED = 0,
UNNEEDED = EstablishField::minval, // has freshens, none trigger
SATISFIED, // has none or triggered freshens, all requirements fulfilled
INCOMPLETE // installed: has none or triggered freshens, requirements unfulfilled
- // uninstalled: has triggered freshens, requirements unfulfilled
};
enum TransactValue
{
DUE_TO_OBSOLETE = TransactDetailField::minval,
DUE_TO_UNLINK
};
+ //@}
public:
_bitfield = status._bitfield;
}
- static ResStatus toBeInstalled;
- static ResStatus toBeInstalledSoft;
- static ResStatus toBeUninstalled;
- static ResStatus toBeUninstalledDueToUnlink;
- static ResStatus toBeUninstalledDueToObsolete;
- static ResStatus satisfied; // uninstalled, satisfied
- static ResStatus complete; // installed, satisfied
- static ResStatus unneeded; // uninstalled, unneeded
- static ResStatus needed; // uninstalled, incomplete
- static ResStatus incomplete; // installed, incomplete
-
- inline bool operator==( const ResStatus & rhs ) const
- { return _bitfield.value() == rhs._bitfield.value(); }
-
- inline bool operator!=( const ResStatus & rhs ) const
- { return _bitfield.value() != rhs._bitfield.value(); }
+ /** \name Builtin ResStatus constants. */
+ //@{
+ static const ResStatus toBeInstalled;
+ static const ResStatus toBeInstalledSoft;
+ static const ResStatus toBeUninstalled;
+ static const ResStatus toBeUninstalledDueToUnlink;
+ static const ResStatus toBeUninstalledDueToObsolete;
+ static const ResStatus satisfied; // uninstalled, satisfied
+ static const ResStatus complete; // installed, satisfied
+ static const ResStatus unneeded; // uninstalled, unneeded
+ static const ResStatus needed; // uninstalled, incomplete
+ static const ResStatus incomplete; // installed, incomplete
+ //@}
private:
- ResStatus (enum StateValue s, enum EstablishValue e = UNDETERMINED, enum TransactValue t = TRANSACT, enum InstallDetailValue i = EXPLICIT_INSTALL, enum RemoveDetailValue r = EXPLICIT_REMOVE);
+ /** Ctor for intialization of builtin constants. */
+ ResStatus( StateValue s,
+ EstablishValue e = UNDETERMINED,
+ TransactValue t = TRANSACT,
+ InstallDetailValue i = EXPLICIT_INSTALL,
+ RemoveDetailValue r = EXPLICIT_REMOVE );
/** Return whether the corresponding Field has value \a val_r.
*/
void fieldValueAssign( FieldType val_r )
{ _bitfield.assign<_Field>( val_r ); }
-
private:
bit::BitField<FieldType> _bitfield;
};
/** \relates ResStatus Stream output */
std::ostream & operator<<( std::ostream & str, const ResStatus & obj );
+ /** \relates ResStatus */
+ inline bool operator==( const ResStatus & lhs, const ResStatus & rhs )
+ { return lhs._bitfield == rhs._bitfield; }
+
+ /** \relates ResStatus */
+ inline bool operator!=( const ResStatus & lhs, const ResStatus & rhs )
+ { return ! (lhs == rhs); }
+
/////////////////////////////////////////////////////////////////
} // namespace zypp
///////////////////////////////////////////////////////////////////