From: DongHun Kwak Date: Tue, 1 Nov 2016 01:46:41 +0000 (+0900) Subject: Imported Upstream version 15.8.0 X-Git-Tag: upstream/16.3.1~58 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F68%2F94668%2F1;p=platform%2Fupstream%2Flibzypp.git Imported Upstream version 15.8.0 Change-Id: I27677879c71808279ed93d6e2e90492ea8a05c6d Signed-off-by: DongHun Kwak --- diff --git a/VERSION.cmake b/VERSION.cmake index a68c729..fa5339b 100644 --- a/VERSION.cmake +++ b/VERSION.cmake @@ -60,9 +60,9 @@ # 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) #======= diff --git a/package/libzypp.changes b/package/libzypp.changes index 98bd908..e9e9f51 100644 --- a/package/libzypp.changes +++ b/package/libzypp.changes @@ -1,4 +1,16 @@ ------------------------------------------------------------------- +Fri Jul 3 08:23:04 CEST 2015 - ma@suse.de + +- Flags: 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 diff --git a/po/zypp-po.tar.bz2 b/po/zypp-po.tar.bz2 index b683023..7a3dc9d 100644 Binary files a/po/zypp-po.tar.bz2 and b/po/zypp-po.tar.bz2 differ diff --git a/zypp/Patch.cc b/zypp/Patch.cc index be97834..a2662f9 100644 --- a/zypp/Patch.cc +++ b/zypp/Patch.cc @@ -202,8 +202,8 @@ namespace zypp } /////////////////////////////////////////////////////////////////// - - 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 @@ -256,6 +256,18 @@ namespace zypp 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; diff --git a/zypp/Patch.h b/zypp/Patch.h index cda6f1c..3042e1c 100644 --- a/zypp/Patch.h +++ b/zypp/Patch.h @@ -239,6 +239,9 @@ namespace zypp /** \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 ); diff --git a/zypp/base/Flags.h b/zypp/base/Flags.h index 8a7742a..9227b95 100644 --- a/zypp/base/Flags.h +++ b/zypp/base/Flags.h @@ -107,6 +107,47 @@ namespace zypp }; /////////////////////////////////////////////////////////////////// + /** \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 + std::string stringify( const Flags & flag_r, const std::initializer_list,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 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 inline std::ostream & operator<<( std::ostream & str, const Flags & obj ) { return str << str::hexstring(obj); }