#
SET(LIBZYPP_MAJOR "15")
SET(LIBZYPP_COMPATMINOR "5")
-SET(LIBZYPP_MINOR "7")
+SET(LIBZYPP_MINOR "8")
SET(LIBZYPP_PATCH "0")
#
-# LAST RELEASED: 15.7.0 (5)
+# LAST RELEASED: 15.8.0 (5)
# (The number in parenthesis is LIBZYPP_COMPATMINOR)
#=======
-------------------------------------------------------------------
+Fri Jul 3 08:23:04 CEST 2015 - ma@suse.de
+
+- Flags<Enum>: add stringify
+- add asString for Patch::InteractiveFlag
+- version 15.8.0 (5)
+
+-------------------------------------------------------------------
+Thu Jul 2 01:13:24 CEST 2015 - ma@suse.de
+
+- Update zypp-po.tar.bz2
+
+-------------------------------------------------------------------
Wed Jul 1 14:00:42 CEST 2015 - ma@suse.de
- add asString for Patch::Category
}
///////////////////////////////////////////////////////////////////
-
- std::string Patch::message( const Locale & lang_r ) const
+ //
+std::string Patch::message( const Locale & lang_r ) const
{ return lookupStrAttribute( sat::SolvAttr::message, lang_r ); }
bool Patch::rebootSuggested() const
return interactiveWhenIgnoring();
}
+ std::string asString( const Patch::InteractiveFlag & obj )
+ {
+ switch ( obj )
+ {
+ case Patch::NoFlags: return ""; break;
+ case Patch::Reboot: return "reboot"; break;
+ case Patch::Message: return "message"; break;
+ case Patch::License: return "license"; break;
+ }
+ return str::hexstring(obj);
+ }
+
Patch::Contents Patch::contents() const
{
Contents result;
/** \relates Patch::Category string representation.*/
std::string asString( const Patch::Category & obj );
+ /** \relates Patch::InteractiveFlag string representation.*/
+ std::string asString( const Patch::InteractiveFlag & obj );
+
/** \relates Patch::SeverityFlag string representation.*/
std::string asString( const Patch::SeverityFlag & obj );
};
///////////////////////////////////////////////////////////////////
+ /** \relates Flags Stringify
+ * Build a string of OR'ed names of each flag value set in \a flag_r.
+ * Remaining bits in \a flag_r are added as hexstring.
+ * \code
+ * enum E { a=1, b=2, c=4 };
+ * ZYPP_DECLARE_FLAGS( E, MyFlags );
+ *
+ * MyFlags f = a|b|c;
+ * cout << f << " = " << stringify( f, { {a,"A"}, {b,"B"} } ) << endl;
+ * // prints: 0x0007 = [A|B|0x4]
+ * \endcode
+ */
+ template<typename Enum>
+ std::string stringify( const Flags<Enum> & flag_r, const std::initializer_list<std::pair<Flags<Enum>,std::string> > & flaglist_r = {},
+ std::string intro_r = "[", std::string sep_r = "|", std::string extro_r = "]" )
+ {
+ std::string ret( std::move(intro_r) );
+ std::string sep;
+
+ Flags<Enum> mask;
+ for ( const auto & pair : flaglist_r )
+ {
+ if ( flag_r.testFlag( pair.first ) )
+ {
+ mask |= pair.first;
+ ret += sep;
+ ret += pair.second;
+ if ( sep.empty() && !sep_r.empty() )
+ { sep = std::move(sep_r); }
+ }
+ }
+ mask = flag_r & ~mask;
+ if ( mask )
+ {
+ ret += sep;
+ ret += str::hexstring( mask, 0 );
+ }
+ ret += std::move(extro_r);
+ return ret;
+ }
+
template<typename Enum>
inline std::ostream & operator<<( std::ostream & str, const Flags<Enum> & obj )
{ return str << str::hexstring(obj); }