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

Y2PMCallbacks.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:       Y2PMCallbacks.h
00014 
00015   Author:     Michael Andres <ma@suse.de>
00016   Maintainer: Michael Andres <ma@suse.de>
00017 
00018   Purpose: Callbacks triggered by Y2PM
00019 
00020 /-*/
00021 #ifndef Y2PMCallbacks_h
00022 #define Y2PMCallbacks_h
00023 
00024 #include <iosfwd>
00025 
00026 #include <y2util/FSize.h>
00027 
00028 #include <y2pm/InstSrcPtr.h>
00029 
00030 #include <y2pm/PMCallbacks.h>
00031 #include <y2pm/RpmDbCallbacks.h>
00032 #include <y2pm/MediaCallbacks.h>
00033 #include <y2pm/InstTargetCallbacks.h>
00034 #include <y2pm/InstSrcManagerCallbacks.h>
00035 #include <y2pm/PMPackageManagerCallbacks.h>
00036 #include <y2pm/PMSelectionManagerCallbacks.h>
00037 
00039 namespace Y2PMCallbacks {
00041 
00043   // Reporting messages during commitPackages
00045   struct CommitCallback : public RedirectCallback<CommitCallback> {
00046     virtual void advanceToMedia( constInstSrcPtr srcptr, unsigned mediaNr ) = 0;
00047   };
00048 
00049   class CommitReport : public Report<CommitCallback> {
00050     virtual void advanceToMedia( constInstSrcPtr srcptr, unsigned mediaNr ) {
00051       CommitCallback::advanceToMedia( srcptr, mediaNr );
00052     }
00053   };
00054 
00055   extern CommitReport commitReport;
00056 
00058   // Reporting package provision (e.g. downloading from a remote InstSsrc).
00060   struct CommitProvideCallback : public RedirectCallback<CommitProvideCallback> {
00061     virtual void start( constPMPackagePtr pkg, bool sourcepkg ) = 0;
00062     virtual CBSuggest attempt( unsigned cnt ) = 0;
00063     virtual CBSuggest result( PMError error, const Pathname & localpath ) = 0;
00064     virtual void stop( PMError error, const Pathname & localpath ) = 0;
00065   };
00066 
00067   class CommitProvideReport : public Report<CommitProvideCallback> {
00068     virtual void start( constPMPackagePtr pkg, bool sourcepkg ) {
00069       CommitProvideCallback::start( pkg, sourcepkg );
00070     }
00071     virtual CBSuggest attempt( unsigned cnt ) {
00072       return CommitProvideCallback::attempt( cnt );
00073     }
00074     virtual CBSuggest result( PMError error, const Pathname & localpath ) {
00075       return CommitProvideCallback::result( error, localpath );
00076     }
00077     virtual void stop( PMError error, const Pathname & localpath ) {
00078       CommitProvideCallback::stop( error, localpath );
00079     }
00080   };
00081 
00082   extern CommitProvideReport commitProvideReport;
00083 
00085   // Reporting rpm package installation.
00087   struct CommitInstallCallback : public RedirectCallback<CommitInstallCallback> {
00088     virtual void start( constPMPackagePtr pkg, bool sourcepkg, const Pathname & path ) = 0;
00089     virtual CBSuggest attempt( unsigned cnt ) = 0;
00090     virtual CBSuggest result( PMError error ) = 0;
00091     virtual void stop( PMError error ) = 0;
00092   };
00093 
00094   class CommitInstallReport : public Report<CommitInstallCallback> {
00095     virtual void start( constPMPackagePtr pkg, bool sourcepkg, const Pathname & path ) {
00096       CommitInstallCallback::start( pkg, sourcepkg, path );
00097     }
00098     virtual CBSuggest attempt( unsigned cnt ) {
00099       return CommitInstallCallback::attempt( cnt );
00100     }
00101     virtual CBSuggest result( PMError error ) {
00102       return CommitInstallCallback::result( error );
00103     }
00104     virtual void stop( PMError error ) {
00105       CommitInstallCallback::stop( error );
00106     }
00107   };
00108 
00109   extern CommitInstallReport commitInstallReport;
00110 
00112   // Reporting rpm package deletion.
00114   struct CommitRemoveCallback : public RedirectCallback<CommitRemoveCallback> {
00115     virtual void start( constPMPackagePtr pkg ) = 0;
00116     virtual CBSuggest attempt( unsigned cnt ) = 0;
00117     virtual CBSuggest result( PMError error ) = 0;
00118     virtual void stop( PMError error ) = 0;
00119   };
00120 
00121   class CommitRemoveReport : public Report<CommitRemoveCallback> {
00122     virtual void start( constPMPackagePtr pkg ) {
00123       CommitRemoveCallback::start( pkg );
00124     }
00125     virtual CBSuggest attempt( unsigned cnt ) {
00126       return CommitRemoveCallback::attempt( cnt );
00127     }
00128     virtual CBSuggest result( PMError error ) {
00129       return CommitRemoveCallback::result( error );
00130     }
00131     virtual void stop( PMError error ) {
00132       CommitRemoveCallback::stop( error );
00133     }
00134   };
00135 
00136   extern CommitRemoveReport commitRemoveReport;
00137 
00138 #if 0
00139 
00140   // Reporting @
00142   struct @Callback : public RedirectCallback<@Callback> {
00143     virtual void start() = 0;
00144     virtual void progress( const ProgressData & prg ) = 0;
00145     virtual void stop( PMError error ) = 0;
00146   };
00147 
00148   class @Report : public Report<@Callback> {
00149     virtual void start() {
00150       @Callback::start();
00151     }
00152     virtual void progress( const ProgressData & prg ) {
00153       @Callback::progress( prg );
00154     }
00155     virtual void stop( PMError error ) {
00156       @Callback::stop( error );
00157     }
00158   };
00159 
00160   extern @Report @Report;
00161 #endif
00162 
00164 } // namespace Y2PMCallbacks
00166 
00167 #endif // Y2PMCallbacks_h

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