00001 /*---------------------------------------------------------------------\ 00002 | | 00003 | __ __ ____ _____ ____ | 00004 | \ \ / /_ _/ ___|_ _|___ \ | 00005 | \ V / _` \___ \ | | __) | | 00006 | | | (_| |___) || | / __/ | 00007 | |_|\__,_|____/ |_| |_____| | 00008 | | 00009 | core system | 00010 | (C) SuSE GmbH | 00011 \----------------------------------------------------------------------/ 00012 00013 File: PMCallbacks.h 00014 00015 Author: Michael Andres <ma@suse.de> 00016 Maintainer: Michael Andres <ma@suse.de> 00017 00018 Purpose: Provides some types frequently used in callback settings. 00019 00020 /-*/ 00021 #ifndef PMCallbacks_h 00022 #define PMCallbacks_h 00023 00024 #include <iosfwd> 00025 00026 #include <y2util/CallBack.h> 00027 #include <y2util/Pathname.h> 00028 #include <y2util/ProgressCounter.h> 00029 00030 #include <y2pm/PMError.h> 00031 00033 // 00034 // CLASS NAME : CBSuggest 00044 class CBSuggest { 00045 friend std::ostream & operator<<( std::ostream & str, const CBSuggest & obj ) 00046 { return str << obj.action; } 00047 00048 public: 00049 00053 enum Action { 00054 PROCEED, 00055 RETRY, 00056 SKIP, 00057 CANCEL 00058 }; 00059 00060 friend std::ostream & operator<<( std::ostream & str, const Action & obj ); 00061 00062 private: 00063 00067 Action action; 00068 00069 public: 00070 00074 CBSuggest( const Action & action_r = PROCEED ) 00075 : action( action_r ) 00076 {} 00082 explicit CBSuggest( const std::string & str_r ); 00083 00087 operator const Action &() const { return action; } 00088 }; 00089 00091 00092 #endif // PMCallbacks_h