1 /*---------------------------------------------------------------------\
3 | |__ / \ / / . \ . \ |
8 \---------------------------------------------------------------------*/
9 /** \file zypp/ZYppCommitResult.h
12 #ifndef ZYPP_ZYPPCOMMITRESULT_H
13 #define ZYPP_ZYPPCOMMITRESULT_H
18 #include "zypp/PoolItem.h"
20 ///////////////////////////////////////////////////////////////////
22 { /////////////////////////////////////////////////////////////////
24 /** Pair of \ref sat::Solvable and \ref Pathname. */
25 class UpdateNotificationFile
28 UpdateNotificationFile( sat::Solvable solvable_r, const Pathname & file_r )
29 : _solvable( solvable_r ), _file( file_r )
32 sat::Solvable solvable() const { return _solvable; }
33 const Pathname & file() const { return _file; }
35 sat::Solvable _solvable;
39 typedef std::list<UpdateNotificationFile> UpdateNotifications;
41 ///////////////////////////////////////////////////////////////////
43 // CLASS NAME : ZYppCommitResult
45 /** Result returned from ZYpp::commit.
47 * \see \ref ZYpp::commit
48 * \todo document fields.
50 class ZYppCommitResult
54 ZYppCommitResult( const Pathname & root_r );
57 /** Remembered root directory of the target.
58 * \Note Pathnames within this class are relative to the
59 * targets root directory.
61 const Pathname & root() const;
63 /** List of update messages installed during this commit.
64 * \Note Pathnames are relative to the targets root directory.
66 * ZYppCommitResult result;
68 * if ( ! result.updateMessages().empty() )
70 * MIL << "Received " << result.updateMessages().size() << " update notification(s):" << endl;
71 * for_( it, result.updateMessages().begin(), result.updateMessages().end() )
73 * MIL << "- From " << it->solvable().asString() << " in file " << Pathname::showRootIf( result.root(), it->file() ) << ":" << endl;
75 * // store message files content in a string:
76 * InputStream istr( Pathname::assertprefix( result.root(), it->file() ) );
77 * std::ostringstream strstr;
78 * iostr::copy( istr, strstr );
79 * std::string message( strstr.str() ); // contains the message
82 * // or write out the message file indented:
83 * InputStream istr( Pathname::assertprefix( result.root(), it->file() ) );
84 * iostr::copyIndent( istr, MIL, "> " ) << endl;
90 const UpdateNotifications & updateMessages() const;
92 /** Change list of update messages installed during this commit.
93 * \Note Pathnames are relative to the targets root directory.
95 UpdateNotifications & setUpdateMessages();
98 /** \name Oldstlye interface to be removed asap.
101 typedef std::list<PoolItem> PoolItemList;
103 * number of committed resolvables
107 * list of resolvables with error
109 PoolItemList _errors;
111 * list of resolvables remaining (due to wrong media)
113 PoolItemList _remaining;
115 * list of kind:source resolvables remaining (due to wrong media)
117 PoolItemList _srcremaining;
121 /** Implementation */
124 /** Pointer to data. */
125 RWCOW_pointer<Impl> _pimpl;
127 ///////////////////////////////////////////////////////////////////
129 /** \relates ZYppCommitResult Stream output. */
130 std::ostream & operator<<( std::ostream & str, const ZYppCommitResult & obj );
132 /////////////////////////////////////////////////////////////////
134 ///////////////////////////////////////////////////////////////////
135 #endif // ZYPP_ZYPPCOMMITRESULT_H