00001 /*---------------------------------------------------------------------\ 00002 | ____ _ __ __ ___ | 00003 | |__ / \ / / . \ . \ | 00004 | / / \ V /| _/ _/ | 00005 | / /__ | | | | | | | 00006 | /_____||_| |_| |_| | 00007 | | 00008 \---------------------------------------------------------------------*/ 00012 #ifndef ZYPP_BASE_USERREQUESTEXCEPTION_H 00013 #define ZYPP_BASE_USERREQUESTEXCEPTION_H 00014 00015 #include <iosfwd> 00016 00017 #include "zypp/base/Exception.h" 00018 00020 namespace zypp 00021 { 00022 00024 // 00025 // CLASS NAME : UserRequestException 00026 // 00064 class UserRequestException : public Exception 00065 { 00066 public: 00067 enum Kind { UNSPECIFIED, IGNORE, SKIP, RETRY, ABORT }; 00068 public: 00069 explicit 00070 UserRequestException( const std::string & msg_r = std::string() ); 00071 explicit 00072 UserRequestException( Kind kind_r, const std::string & msg_r = std::string() ); 00073 public: 00074 Kind kind() const 00075 { return _kind; } 00076 protected: 00077 virtual std::ostream & dumpOn( std::ostream & str ) const; 00078 private: 00079 Kind _kind; 00080 }; 00082 00083 struct IgnoreRequestException : public UserRequestException 00084 { 00085 explicit 00086 IgnoreRequestException( const std::string & msg_r = std::string() ) 00087 : UserRequestException( IGNORE, msg_r ) 00088 {} 00089 }; 00090 00091 struct SkipRequestException : public UserRequestException 00092 { 00093 explicit 00094 SkipRequestException( const std::string & msg_r = std::string() ) 00095 : UserRequestException( SKIP, msg_r ) 00096 {} 00097 }; 00098 00099 struct RetryRequestException : public UserRequestException 00100 { 00101 explicit 00102 RetryRequestException( const std::string & msg_r = std::string() ) 00103 : UserRequestException( RETRY, msg_r ) 00104 {} 00105 }; 00106 00107 struct AbortRequestException : public UserRequestException 00108 { 00109 explicit 00110 AbortRequestException( const std::string & msg_r = std::string() ) 00111 : UserRequestException( ABORT, msg_r ) 00112 {} 00113 }; 00114 00116 } // namespace zypp 00118 #endif // ZYPP_BASE_USERREQUESTEXCEPTION_H