libzypp  11.13.5
ZYppCommitResult.cc
Go to the documentation of this file.
1 /*---------------------------------------------------------------------\
2 | ____ _ __ __ ___ |
3 | |__ / \ / / . \ . \ |
4 | / / \ V /| _/ _/ |
5 | / /__ | | | | | | |
6 | /_____||_| |_| |_| |
7 | |
8 \---------------------------------------------------------------------*/
13 #include <iostream>
14 #include "zypp/base/LogTools.h"
15 
16 #include "zypp/ZYppCommitResult.h"
17 
19 namespace zypp
20 {
21 
23  //
24  // CLASS NAME : ZYppCommitResult::Impl
25  //
27 
29  {
30  public:
31  Impl()
32  {}
33 
34  public:
35  Pathname _root;
39 
40  private:
41  friend Impl * rwcowClone<Impl>( const Impl * rhs );
43  Impl * clone() const { return new Impl( *this ); }
44  };
45 
47  //
48  // CLASS NAME : ZYppCommitResult
49  //
51 
53  : _result(0), _pimpl( new Impl )
54  {}
55 
57  : _result(0)
58  , _errors( lhs_r._errors )
59  , _remaining( lhs_r._remaining )
60  , _srcremaining( lhs_r._srcremaining )
61  , _pimpl( lhs_r._pimpl )
62  {}
63 
64  ZYppCommitResult::ZYppCommitResult( const Pathname & root_r )
65  : _result(0), _pimpl( new Impl )
66  { _pimpl->_root = root_r; }
67 
69  {}
70 
71  const Pathname & ZYppCommitResult::root() const
72  { return _pimpl->_root; }
73 
75  { return _pimpl->_transaction; }
76 
78  { return _pimpl->_transaction; }
79 
81  { return _pimpl->_transactionStepList; }
82 
84  { return _pimpl->_transactionStepList; }
85 
87  { return _pimpl->_updateMessages; }
88 
90  { return _pimpl->_updateMessages; }
91 
93 
94  std::ostream & operator<<( std::ostream & str, const ZYppCommitResult & obj )
95  {
97  for_( it, obj.transaction().actionBegin(), obj.transaction().actionEnd() )
98  {
99  ++result[0];
100  switch ( it->stepStage() )
101  {
102  case sat::Transaction::STEP_DONE : ++result[1]; break;
103  case sat::Transaction::STEP_ERROR : ++result[2]; break;
104  case sat::Transaction::STEP_TODO : ++result[3]; break;
105  }
106  }
107  str << "CommitResult "
108  << " (total " << result[0]
109  << ", done " << result[1]
110  << ", error " << result[2]
111  << ", skipped " << result[3]
112  << ", updateMessages " << obj.updateMessages().size()
113  << ")";
114  return str;
115  }
116 
118 } // namespace zypp