10.1 compatibility code removed
authorJan Kupec <jkupec@suse.cz>
Wed, 13 Jun 2007 13:29:49 +0000 (13:29 +0000)
committerJan Kupec <jkupec@suse.cz>
Wed, 13 Jun 2007 13:29:49 +0000 (13:29 +0000)
src/zypper-callbacks.cc
src/zypper-callbacks.h
src/zypper-media-callbacks.h
src/zypper-rpm-callbacks.h
src/zypper-source-callbacks.h

index a79bdd2..f77bc70 100644 (file)
@@ -10,17 +10,17 @@ using namespace std;
 void display_progress (const string& s, int percent) {
   static AliveCursor cursor;
 
-  cerr_v << CLEARLN << cursor++ << " " << s << "[" << percent << "%]" << flush;
+  cout_v << CLEARLN << cursor++ << " " << s << "[" << percent << "%]" << flush;
 }
 
 void display_done () {
-  cerr_v << endl;
+  cout_v << endl;
 }
 
 //template<typename Action>
 //Action ...
 int read_action_ari (int default_action) {
-  cerr << _("(A)bort, (R)etry, (I)gnore?") << " "; // don't translate letters in parentheses!!
+  cout << _("(A)bort, (R)etry, (I)gnore?") << " "; // don't translate letters in parentheses!!
 
        // non-interactive mode
        if (gSettings.non_interactive) {
index 907d084..7f92a87 100644 (file)
 #include <string>
 #include <zypp/Resolvable.h>
 
-// trying to compile for 10.1 where the callbacks had different signatures
-#ifdef LIBZYPP_1xx
-typedef std::string cbstring;
-typedef zypp::Url cbUrl;
-#else
-typedef const std::string& cbstring;
-typedef const zypp::Url& cbUrl;
-#endif
-
 /*
 enum Error {
     NO_ERROR,
index 864ede0..e108aaa 100644 (file)
@@ -13,6 +13,8 @@
 #include <stdlib.h>
 #include <iostream>
 
+#include <boost/format.hpp>
+
 #include <zypp/base/Logger.h>
 #include <zypp/ZYppCallbacks.h>
 #include <zypp/Pathname.h>
@@ -32,7 +34,7 @@ namespace ZmartRecipients
 
   struct MediaChangeReportReceiver : public zypp::callback::ReceiveReport<MediaChangeReport>
   {
-    virtual MediaChangeReport::Action requestMedia( zypp::Source_Ref source, unsigned mediumNr, MediaChangeReport::Error error, cbstring description )
+    virtual MediaChangeReport::Action requestMedia( zypp::Source_Ref source, unsigned mediumNr, MediaChangeReport::Error error, const std::string & description )
     { 
       cout << "Please insert media [" << description << "] # " << mediumNr << ". Retry [y/n]: " << endl;
       if (readBoolAnswer())
@@ -46,32 +48,33 @@ namespace ZmartRecipients
     // progress for downloading a file
   struct DownloadProgressReportReceiver : public zypp::callback::ReceiveReport<zypp::media::DownloadProgressReport>
   {
-    virtual void start( cbUrl file, zypp::Pathname localfile )
+    virtual void start( const zypp::Url & file, zypp::Pathname localfile )
     {
-      cerr_v << "Downloading: "
-            << file << " to " << localfile << std::endl;
+      cout_v  << CLEARLN << _("Downloading: ") << file;
+           cout_vv << " to " << localfile;
+      cout_v  << std::endl;
     }
 
-    virtual bool progress(int value, cbUrl /*file*/)
+    virtual bool progress(int value, const zypp::Url & /*file*/)
     {
       display_progress ("Downloading", value);
       return true;
     }
 
-    virtual DownloadProgressReport::Action problem( cbUrl /*file*/, DownloadProgressReport::Error error, cbstring description )
+    virtual DownloadProgressReport::Action problem( const zypp::Url & /*file*/, DownloadProgressReport::Error error, const std::string & description )
     {
       display_done ();
       display_error (error, description);
       return DownloadProgressReport::ABORT;
     }
 
-    virtual void finish( cbUrl /*file*/, Error error, cbstring konreason )
+    virtual void finish( const zypp::Url & /*file*/, Error error, const std::string & konreason )
     {
       display_done ();
       display_error (error, konreason);
     }
   };
-  
+
     ///////////////////////////////////////////////////////////////////
 }; // namespace ZmartRecipients
 ///////////////////////////////////////////////////////////////////
index b2ed6d4..67e8ba1 100644 (file)
@@ -111,12 +111,12 @@ struct ScanRpmDbReceive : public zypp::callback::ReceiveReport<zypp::target::rpm
     return true;
   }
 
-  virtual Action problem( zypp::target::rpm::ScanDBReport::Error error, cbstring description )
+  virtual Action problem( zypp::target::rpm::ScanDBReport::Error error, const std::string & description )
   {
     return zypp::target::rpm::ScanDBReport::problem( error, description );
   }
 
-  virtual void finish( Error error, cbstring reason )
+  virtual void finish( Error error, const std::string & reason )
   {
     display_done ();
     display_error (error, reason);
@@ -138,14 +138,14 @@ struct RemoveResolvableReportReceiver : public zypp::callback::ReceiveReport<zyp
     return true;
   }
 
-  virtual Action problem( zypp::Resolvable::constPtr resolvable, Error error, cbstring description )
+  virtual Action problem( zypp::Resolvable::constPtr resolvable, Error error, const std::string & description )
   {
     cerr << resolvable << endl;
     display_error (error, description);
     return (Action) read_action_ari ();
   }
 
-  virtual void finish( zypp::Resolvable::constPtr /*resolvable*/, Error error, cbstring reason )
+  virtual void finish( zypp::Resolvable::constPtr /*resolvable*/, Error error, const std::string & reason )
   {
     display_done ();
     display_error (error, reason);
@@ -182,7 +182,7 @@ struct InstallResolvableReportReceiver : public zypp::callback::ReceiveReport<zy
     return true;
   }
 
-  virtual Action problem( zypp::Resolvable::constPtr resolvable, Error error, cbstring description, RpmLevel level )
+  virtual Action problem( zypp::Resolvable::constPtr resolvable, Error error, const std::string & description, RpmLevel level )
   {
     cerr << resolvable << " " << description << std::endl;
     cerr << level;
@@ -194,7 +194,7 @@ struct InstallResolvableReportReceiver : public zypp::callback::ReceiveReport<zy
     return (Action) read_action_ari ();
   }
 
-  virtual void finish( zypp::Resolvable::constPtr /*resolvable*/, Error error, cbstring reason, RpmLevel level )
+  virtual void finish( zypp::Resolvable::constPtr /*resolvable*/, Error error, const std::string & reason, RpmLevel level )
   {
     display_done ();
     if (error != NO_ERROR) {
index 2b10833..2578a01 100644 (file)
@@ -37,17 +37,17 @@ namespace ZmartRecipients
         cout << "Determining " << url << " source type..." << endl;
       }
       
-      virtual void failedProbe( const zypp::Url &/*url*/, cbstring type )
+      virtual void failedProbe( const zypp::Url &/*url*/, const std::string & type )
       {
         cout << ".. not " << type << endl;
       }
       
-      virtual void successProbe( const zypp::Url &url, cbstring type )
+      virtual void successProbe( const zypp::Url &url, const std::string & type )
       {
         cout << url << " is type " << type << endl;
       }
       
-      virtual void finish(const zypp::Url &/*url*/, Error error, cbstring reason )
+      virtual void finish(const zypp::Url &/*url*/, Error error, const std::string & reason )
       {
         if ( error == INVALID )
         {
@@ -59,7 +59,7 @@ namespace ZmartRecipients
       virtual bool progress(const zypp::Url &/*url*/, int /*value*/)
       { return true; }
 
-      virtual Action problem( const zypp::Url &/*url*/, Error error, cbstring description )
+      virtual Action problem( const zypp::Url &/*url*/, Error error, const std::string & description )
       {
        display_done ();
        display_error (error, description);
@@ -103,7 +103,7 @@ struct DownloadResolvableReportReceiver : public zypp::callback::ReceiveReport<z
     return true;
   }
   
-  virtual void problemDeltaDownload( cbstring description )
+  virtual void problemDeltaDownload( const std::string & description )
   {
     std::cerr << description << std::endl;
   }
@@ -128,7 +128,7 @@ struct DownloadResolvableReportReceiver : public zypp::callback::ReceiveReport<z
     display_step( "Applying delta " /* + _delta.asString()*/, value );
   }
   
-  virtual void problemDeltaApply( cbstring description )
+  virtual void problemDeltaApply( const std::string & description )
   {
     std::cerr << description << std::endl;
   }
@@ -156,7 +156,7 @@ struct DownloadResolvableReportReceiver : public zypp::callback::ReceiveReport<z
     return true;
   }
   
-  virtual void problemPatchDownload( cbstring description )
+  virtual void problemPatchDownload( const std::string & description )
   {
     std::cerr << description << std::endl;
   }
@@ -167,7 +167,7 @@ struct DownloadResolvableReportReceiver : public zypp::callback::ReceiveReport<z
   }
   
   
-  virtual void start( zypp::Resolvable::constPtr resolvable_ptr, cbUrl url )
+  virtual void start( zypp::Resolvable::constPtr resolvable_ptr, const zypp::Url & url )
   {
     _resolvable_ptr =  resolvable_ptr;
     _url = url;
@@ -190,13 +190,13 @@ struct DownloadResolvableReportReceiver : public zypp::callback::ReceiveReport<z
     return true;
   }
 
-  virtual Action problem( zypp::Resolvable::constPtr resolvable_ptr, Error /*error*/, cbstring description )
+  virtual Action problem( zypp::Resolvable::constPtr resolvable_ptr, Error /*error*/, const std::string & description )
   {
     std::cerr << description << std::endl;
     return (Action) read_action_ari(ABORT);
   }
 
-  virtual void finish( zypp::Resolvable::constPtr /*resolvable_ptr*/, Error error, cbstring reason )
+  virtual void finish( zypp::Resolvable::constPtr /*resolvable_ptr*/, Error error, const std::string & reason )
   {
     display_done ();
     display_error (error, reason);
@@ -206,7 +206,7 @@ struct DownloadResolvableReportReceiver : public zypp::callback::ReceiveReport<z
 #ifndef LIBZYPP_1xx
 struct SourceReportReceiver  : public zypp::callback::ReceiveReport<zypp::source::SourceReport>
 {     
-  virtual void start( zypp::Source_Ref source, cbstring task )
+  virtual void start( zypp::Source_Ref source, const std::string & task )
   {
     _task = task;
     _source = source;
@@ -225,14 +225,14 @@ struct SourceReportReceiver  : public zypp::callback::ReceiveReport<zypp::source
     return true;
   }
   
-  virtual Action problem( zypp::Source_Ref /*source*/, Error error, cbstring description )
+  virtual Action problem( zypp::Source_Ref /*source*/, Error error, const std::string & description )
   {
     display_done ();
     display_error (error, description);
     return (Action) read_action_ari ();
   }
 
-  virtual void finish( zypp::Source_Ref /*source*/, cbstring task, Error error, cbstring reason )
+  virtual void finish( zypp::Source_Ref /*source*/, const std::string & task, Error error, const std::string & reason )
   {
     display_step(100);
     // many of these, avoid newline