Add example code printing updateMessages.
[platform/upstream/libzypp.git] / zypp / ZYppCommitResult.cc
1 /*---------------------------------------------------------------------\
2 |                          ____ _   __ __ ___                          |
3 |                         |__  / \ / / . \ . \                         |
4 |                           / / \ V /|  _/  _/                         |
5 |                          / /__ | | | | | |                           |
6 |                         /_____||_| |_| |_|                           |
7 |                                                                      |
8 \---------------------------------------------------------------------*/
9 /** \file       zypp/ZYppCommitResult.cc
10  *
11 */
12
13 #include <iostream>
14
15 #include "zypp/ZYppCommitResult.h"
16
17 ///////////////////////////////////////////////////////////////////
18 namespace zypp
19 { /////////////////////////////////////////////////////////////////
20
21   ///////////////////////////////////////////////////////////////////
22   //
23   //    CLASS NAME : ZYppCommitResult::Impl
24   //
25   ///////////////////////////////////////////////////////////////////
26
27   class ZYppCommitResult::Impl
28   {
29     public:
30       Impl()
31       {}
32
33     public:
34       Pathname                  _root;
35       UpdateNotifications       _updateMessages;
36
37     private:
38       friend Impl * rwcowClone<Impl>( const Impl * rhs );
39       /** clone for RWCOW_pointer */
40       Impl * clone() const { return new Impl( *this ); }
41   };
42
43   ///////////////////////////////////////////////////////////////////
44   //
45   //    CLASS NAME : ZYppCommitResult
46   //
47   ///////////////////////////////////////////////////////////////////
48
49   ZYppCommitResult::ZYppCommitResult()
50   : _result(0), _pimpl( new Impl )
51   {}
52
53   ZYppCommitResult::ZYppCommitResult( const Pathname & root_r )
54   : _result(0), _pimpl( new Impl )
55   { _pimpl->_root = root_r; }
56
57   const Pathname & ZYppCommitResult::root() const
58   { return _pimpl->_root; }
59
60   const UpdateNotifications & ZYppCommitResult::updateMessages() const
61   { return _pimpl->_updateMessages; }
62
63   UpdateNotifications & ZYppCommitResult::setUpdateMessages()
64   { return _pimpl->_updateMessages; }
65
66   ///////////////////////////////////////////////////////////////////
67
68   std::ostream & operator<<( std::ostream & str, const ZYppCommitResult & obj )
69   {
70     str << "CommitResult " << obj._result
71         << " (errors " << obj._errors.size()
72         << ", remaining " << obj._remaining.size()
73         << ", srcremaining " << obj._srcremaining.size()
74         << ", updateMessages " << obj.updateMessages().size()
75         << ")";
76     return str;
77   }
78
79   /////////////////////////////////////////////////////////////////
80 } // namespace zypp
81 ///////////////////////////////////////////////////////////////////