UserRequestException.h
Go to the documentation of this file.00001
00002
00003
00004
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
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 UserRequestException( const std::string & msg_r, const Exception & history_r );
00072 explicit
00073 UserRequestException( Kind kind_r, const std::string & msg_r = std::string() );
00074 UserRequestException( Kind kind_r, const std::string & msg_r, const Exception & history_r );
00075 public:
00076 Kind kind() const
00077 { return _kind; }
00078 protected:
00079 virtual std::ostream & dumpOn( std::ostream & str ) const;
00080 private:
00081 Kind _kind;
00082 };
00084
00086 #define declException( EXCP, KIND ) \
00087 struct EXCP : public UserRequestException { \
00088 explicit \
00089 EXCP( const std::string & msg_r = std::string() ) \
00090 : UserRequestException( KIND, msg_r ) \
00091 {} \
00092 EXCP( const std::string & msg_r, const Exception & history_r ) \
00093 : UserRequestException( KIND, msg_r, history_r ) \
00094 {} \
00095 }
00096
00097 declException( IgnoreRequestException, IGNORE );
00098 declException( SkipRequestException, SKIP );
00099 declException( RetryRequestException, RETRY );
00100 declException( AbortRequestException, ABORT );
00101
00102 #undef declException
00103
00105 }
00107 #endif // ZYPP_BASE_USERREQUESTEXCEPTION_H