Author: mlandres Date: Wed Nov 28 17:44:01 2007 New Revision: 7964 URL: http://svn.opensuse.org/viewcvs/zypp?rev=7964&view=rev Log: Support libsatsolver compatible Rel construction and conversion from/to unsigned. Modified: trunk/libzypp/zypp/Rel.h Modified: trunk/libzypp/zypp/Rel.h URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/Rel.h?rev=7964&r1=7963&r2=7964&view=diff ============================================================================== --- trunk/libzypp/zypp/Rel.h (original) +++ trunk/libzypp/zypp/Rel.h Wed Nov 28 17:44:01 2007 @@ -59,8 +59,19 @@ /** Enumarators provided \b only for use \ref inSwitch statement. * \see inSwitch + * \note Enumarator values also correspond to the values libsatsolver + * uses to encode these relations. */ - enum for_use_in_switch { EQ_e, NE_e, LT_e, LE_e, GT_e, GE_e, ANY_e, NONE_e }; + enum for_use_in_switch { + NONE_e = 0U, + GT_e = 1U, + EQ_e = 2U, + LT_e = 4U, + GE_e = GT_e|EQ_e, + LE_e = LT_e|EQ_e, + NE_e = GT_e|LT_e, + ANY_e = GT_e|EQ_e|LT_e, + }; /** DefaultCtor ANY. */ Rel() @@ -80,6 +91,12 @@ explicit Rel( const std::string & strval_r ); + /** Ctor from bits. */ + explicit + Rel( unsigned bits_r ) + : _op( for_use_in_switch(bits_r & ANY_e) ) + {} + /** String representation of relational operator. * \return "==", "!=", "<", "<=", ">", ">=", "ANY" or "NONE" */ @@ -107,6 +124,10 @@ for_use_in_switch inSwitch() const { return _op; } + /** Enumarator values suitable for libsatsolver. */ + unsigned bits() const + { return _op; } + private: /** Ctor to initialize the relational operator contants. */ Rel( for_use_in_switch op_r ) -- To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org For additional commands, e-mail: zypp-commit+help@opensuse.org