Imported Upstream version 15.8.0 68/94668/1
authorDongHun Kwak <dh0128.kwak@samsung.com>
Tue, 1 Nov 2016 01:46:41 +0000 (10:46 +0900)
committerDongHun Kwak <dh0128.kwak@samsung.com>
Tue, 1 Nov 2016 01:46:42 +0000 (10:46 +0900)
Change-Id: I27677879c71808279ed93d6e2e90492ea8a05c6d
Signed-off-by: DongHun Kwak <dh0128.kwak@samsung.com>
VERSION.cmake
package/libzypp.changes
po/zypp-po.tar.bz2
zypp/Patch.cc
zypp/Patch.h
zypp/base/Flags.h

index a68c729..fa5339b 100644 (file)
@@ -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)
 #=======
index 98bd908..e9e9f51 100644 (file)
@@ -1,4 +1,16 @@
 -------------------------------------------------------------------
+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
index b683023..7a3dc9d 100644 (file)
Binary files a/po/zypp-po.tar.bz2 and b/po/zypp-po.tar.bz2 differ
index be97834..a2662f9 100644 (file)
@@ -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;
index cda6f1c..3042e1c 100644 (file)
@@ -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 );
 
index 8a7742a..9227b95 100644 (file)
@@ -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<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); }