Main Page | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members

RpmDbCallbacks.h

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------\
00002 |                                                                      |
00003 |                      __   __    ____ _____ ____                      |
00004 |                      \ \ / /_ _/ ___|_   _|___ \                     |
00005 |                       \ V / _` \___ \ | |   __) |                    |
00006 |                        | | (_| |___) || |  / __/                     |
00007 |                        |_|\__,_|____/ |_| |_____|                    |
00008 |                                                                      |
00009 |                               core system                            |
00010 |                                                        (C) SuSE GmbH |
00011 \----------------------------------------------------------------------/
00012 
00013   File:       RpmDbCallbacks.h
00014 
00015   Author:     Michael Andres <ma@suse.de>
00016   Maintainer: Michael Andres <ma@suse.de>
00017 
00018   Purpose: Callbacks triggered by RpmDb
00019 
00020 /-*/
00021 #ifndef RpmDbCallbacks_h
00022 #define RpmDbCallbacks_h
00023 
00024 #include <iosfwd>
00025 
00026 #include <y2pm/PMPackagePtr.h>
00027 #include <y2pm/PMCallbacks.h>
00028 
00030 namespace RpmDbCallbacks {
00032 
00034   // Reporting progress of rpm database conversion.
00036   struct ConvertDbCallback : public RedirectCallback<ConvertDbCallback> {
00037     virtual void start( const Pathname & v3db ) = 0;
00038     virtual void progress( const ProgressData & prg,
00039                            unsigned failed, unsigned ignored, unsigned alreadyInV4 ) = 0;
00040     virtual void dbInV4( const std::string & pkg ) = 0;
00046     virtual CBSuggest dbReadError( int offset ) = 0;
00047     virtual void dbWriteError( const std::string & pkg ) = 0;
00048     virtual void stop( PMError error ) = 0;
00049   };
00050 
00051   class ConvertDbReport : public Report<ConvertDbCallback> {
00052     virtual void start( const Pathname & v3db ) {
00053       ConvertDbCallback::start( v3db );
00054     }
00055     virtual void progress( const ProgressData & prg,
00056                            unsigned failed, unsigned ignored, unsigned alreadyInV4 ) {
00057       ConvertDbCallback::progress( prg, failed, ignored, alreadyInV4 );
00058     }
00059     virtual void dbInV4( const std::string & pkg ) {
00060       ConvertDbCallback::dbInV4( pkg );
00061     }
00062     virtual CBSuggest dbReadError( int offset ) {
00063       return ConvertDbCallback::dbReadError( offset );
00064     }
00065     virtual void dbWriteError( const std::string & pkg ) {
00066       ConvertDbCallback::dbWriteError( pkg );
00067     }
00068     virtual void stop( PMError error ) {
00069       ConvertDbCallback::stop( error );
00070     }
00071   };
00072 
00073   extern ConvertDbReport convertDbReport;
00074 
00076   // Reporting progress of rpm database rebuild.
00078   struct RebuildDbCallback : public RedirectCallback<RebuildDbCallback> {
00079     virtual void start() = 0;
00080     virtual void progress( const ProgressData & prg ) = 0;
00081     virtual void notify( const std::string & msg ) = 0;
00082     virtual void stop( PMError error ) = 0;
00083   };
00084 
00085   class RebuildDbReport : public Report<RebuildDbCallback> {
00086     virtual void start() {
00087       RebuildDbCallback::start();
00088     }
00089     virtual void progress( const ProgressData & prg ) {
00090       RebuildDbCallback::progress( prg );
00091     }
00092     virtual void notify( const std::string & msg ) {
00093       RebuildDbCallback::notify( msg );
00094     }
00095     virtual void stop( PMError error ) {
00096       RebuildDbCallback::stop( error );
00097     }
00098   };
00099 
00100   extern RebuildDbReport rebuildDbReport;
00101 
00103   // Reporting progress reading the rpm database
00105   struct ScanDbCallback : public RedirectCallback<ScanDbCallback> {
00106     virtual void start() = 0;
00107     virtual void progress( const ProgressData & prg ) = 0;
00108     virtual void stop( PMError error ) = 0;
00109   };
00110 
00111   class ScanDbReport : public Report<ScanDbCallback> {
00112     virtual void start() {
00113       ScanDbCallback::start();
00114     }
00115     virtual void progress( const ProgressData & prg ) {
00116       ScanDbCallback::progress( prg );
00117     }
00118     virtual void stop( PMError error ) {
00119       ScanDbCallback::stop( error );
00120     }
00121   };
00122 
00123   extern ScanDbReport scanDbReport;
00124 
00126   // Reporting progress of rpm package installation.
00128   struct InstallPkgCallback : public RedirectCallback<InstallPkgCallback> {
00129     virtual void start( const Pathname & filename ) = 0;
00130     virtual void progress( const ProgressData & prg ) = 0;
00131     virtual void stop( PMError error ) = 0;
00132   };
00133 
00134   class InstallPkgReport : public Report<InstallPkgCallback> {
00135     virtual void start( const Pathname & filename ) {
00136       InstallPkgCallback::start( filename );
00137     }
00138     virtual void progress( const ProgressData & prg ) {
00139       InstallPkgCallback::progress( prg );
00140     }
00141     virtual void stop( PMError error ) {
00142       InstallPkgCallback::stop( error );
00143     }
00144   };
00145 
00146   extern InstallPkgReport installPkgReport;
00147 
00149   // Reporting progress of rpm package deletion.
00151   struct RemovePkgCallback : public RedirectCallback<RemovePkgCallback> {
00152     virtual void start( const std::string & label ) = 0;
00153     virtual void progress( const ProgressData & prg ) = 0;
00154     virtual void stop( PMError error ) = 0;
00155   };
00156 
00157   class RemovePkgReport : public Report<RemovePkgCallback> {
00158     virtual void start( const std::string & label ) {
00159       RemovePkgCallback::start( label );
00160     }
00161     virtual void progress( const ProgressData & prg ) {
00162       RemovePkgCallback::progress( prg );
00163     }
00164     virtual void stop( PMError error ) {
00165       RemovePkgCallback::stop( error );
00166     }
00167   };
00168 
00169   extern RemovePkgReport removePkgReport;
00170 
00171 #if 0
00172 
00173   // Reporting @
00175   struct @Callback : public RedirectCallback<@Callback> {
00176     virtual void start() = 0;
00177     virtual void progress( const ProgressData & prg ) = 0;
00178     virtual void stop( PMError error ) = 0;
00179   };
00180 
00181   class @Report : public Report<@Callback> {
00182     virtual void start() {
00183       @Callback::start();
00184     }
00185     virtual void progress( const ProgressData & prg ) {
00186       @Callback::progress( prg );
00187     }
00188     virtual void stop( PMError error ) {
00189       @Callback::stop( error );
00190     }
00191   };
00192 
00193   extern @Report @Report;
00194 #endif
00195 
00197 } // namespace RpmDbCallbacks
00199 
00200 #endif // RpmDbCallbacks_h

Generated on Fri Nov 9 14:30:32 2007 for yast2-packagemanager by doxygen 1.3.6