Imported Upstream version 15.21.5
[platform/upstream/libzypp.git] / zypp / Patch.cc
index 1ee504f..b15f14d 100644 (file)
@@ -44,7 +44,7 @@ namespace zypp
   ///////////////////////////////////////////////////////////////////
 
   std::string Patch::category() const
-  { return lookupStrAttribute( sat::SolvAttr::patchcategory ); }
+  { return str::toLower(lookupStrAttribute( sat::SolvAttr::patchcategory )); }
 
   Patch::Category Patch::categoryEnum() const
   { return categoryEnum( category() ); }
@@ -114,10 +114,25 @@ namespace zypp
     return CAT_OTHER;
   }
 
+  std::string asString( const Patch::Category & obj )
+  {
+    switch ( obj )
+    {
+      case Patch::CAT_OTHER:           return std::string( "other" );          break;
+      case Patch::CAT_YAST:            return std::string( "yast" );           break;
+      case Patch::CAT_SECURITY:                return std::string( "security" );       break;
+      case Patch::CAT_RECOMMENDED:     return std::string( "recommended" );    break;
+      case Patch::CAT_OPTIONAL:                return std::string( "optional" );       break;
+      case Patch::CAT_DOCUMENT:                return std::string( "document" );       break;
+    }
+    // make gcc happy:
+    return std::string( "other" );
+  }
+
   ///////////////////////////////////////////////////////////////////
 
   std::string Patch::severity() const
-  { return lookupStrAttribute( sat::SolvAttr::severity ); }
+  { return str::toLower(lookupStrAttribute( sat::SolvAttr::severity )); }
 
   Patch::SeverityFlag Patch::severityFlag() const
   { return severityFlag( severity() ); }
@@ -187,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
@@ -241,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;