Imported Upstream version 15.5.0
[platform/upstream/libzypp.git] / zypp / base / UserRequestException.cc
1 /*---------------------------------------------------------------------\
2 |                          ____ _   __ __ ___                          |
3 |                         |__  / \ / / . \ . \                         |
4 |                           / / \ V /|  _/  _/                         |
5 |                          / /__ | | | | | |                           |
6 |                         /_____||_| |_| |_|                           |
7 |                                                                      |
8 \---------------------------------------------------------------------*/
9 /** \file       zypp/base/UserRequestException.cc
10  *
11 */
12 #include <iostream>
13 //#include "zypp/base/Logger.h"
14
15 #include "zypp/base/UserRequestException.h"
16
17 using std::endl;
18
19 ///////////////////////////////////////////////////////////////////
20 namespace zypp
21 { /////////////////////////////////////////////////////////////////
22
23   ///////////////////////////////////////////////////////////////////
24   //
25   //    METHOD NAME : UserRequestException::UserRequestException
26   //    METHOD TYPE : Ctor
27   //
28   UserRequestException::UserRequestException( const std::string & msg_r )
29   : Exception( msg_r ), _kind( UNSPECIFIED )
30   {}
31
32   UserRequestException::UserRequestException( const std::string & msg_r, const Exception & history_r )
33   : Exception( msg_r, history_r ), _kind( UNSPECIFIED )
34   {}
35
36   UserRequestException::UserRequestException( Kind kind_r, const std::string & msg_r )
37   : Exception( msg_r ), _kind( kind_r )
38   {}
39
40   UserRequestException::UserRequestException( Kind kind_r, const std::string & msg_r, const Exception & history_r )
41   : Exception( msg_r, history_r ), _kind( kind_r )
42   {}
43
44   ///////////////////////////////////////////////////////////////////
45   //
46   //    METHOD NAME : UserRequestException::dumpOn
47   //    METHOD TYPE : std::ostream &
48   //
49   std::ostream & UserRequestException::dumpOn( std::ostream & str ) const
50   {
51     switch ( _kind )
52     {
53       case UNSPECIFIED: str << "UNSPECIFIED"; break;
54       case IGNORE:      str << "IGNORE";      break;
55       case SKIP:        str << "SKIP";        break;
56       case RETRY:       str << "RETRY";       break;
57       case ABORT:       str << "ABORT";       break;
58         // no default !
59     }
60     return str << " request: " << msg();
61   }
62
63   /////////////////////////////////////////////////////////////////
64 } // namespace zypp
65 ///////////////////////////////////////////////////////////////////