/usr/include/x86_64-linux-gnu/zypp/ZYppCommitResult.h is in libzypp-dev 15.3.0-1build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 | /*---------------------------------------------------------------------\
| ____ _ __ __ ___ |
| |__ / \ / / . \ . \ |
| / / \ V /| _/ _/ |
| / /__ | | | | | | |
| /_____||_| |_| |_| |
| |
\---------------------------------------------------------------------*/
/** \file zypp/ZYppCommitResult.h
*
*/
#ifndef ZYPP_ZYPPCOMMITRESULT_H
#define ZYPP_ZYPPCOMMITRESULT_H
#include <iosfwd>
#include <vector>
#include <list>
#include "zypp/PoolItem.h"
#include "zypp/sat/Transaction.h"
#include "zypp/base/DefaultIntegral.h"
///////////////////////////////////////////////////////////////////
namespace zypp
{ /////////////////////////////////////////////////////////////////
namespace sat
{
class Transaction;
}
/** Pair of \ref sat::Solvable and \ref Pathname. */
class UpdateNotificationFile
{
public:
UpdateNotificationFile( sat::Solvable solvable_r, const Pathname & file_r )
: _solvable( solvable_r ), _file( file_r )
{}
public:
sat::Solvable solvable() const { return _solvable; }
const Pathname & file() const { return _file; }
private:
sat::Solvable _solvable;
Pathname _file;
};
typedef std::list<UpdateNotificationFile> UpdateNotifications;
///////////////////////////////////////////////////////////////////
//
// CLASS NAME : ZYppCommitResult
//
/** Result returned from ZYpp::commit.
*
* \note Transaction data are provided and maintained during commit.
* Though the interface does not inhibit manipulation of transaction
* data outside commit (those methods could have been made \c private:),
* this is not recommended as you may easily mess up things.
*
* \see \ref ZYpp::commit
*/
class ZYppCommitResult
{
public:
typedef std::vector<sat::Transaction::Step> TransactionStepList;
public:
ZYppCommitResult();
ZYppCommitResult( const ZYppCommitResult & lhs_r );
ZYppCommitResult( const Pathname & root_r );
~ZYppCommitResult();
public:
/** Remembered root directory of the target.
* \Note Pathnames within this class are relative to the
* targets root directory.
*/
const Pathname & root() const;
/** The full transaction list.
* The complete list including transaction steps that do not require
* any action (like obsoletes or non-package actions). Depending on
* \ref ZYppCommitPolicy::restrictToMedia only a subset of this
* transaction might have been executed.
* \see \ref transactionStepList.
*/
const sat::Transaction & transaction() const;
/** Manipulate \ref transaction */
sat::Transaction & rTransaction();
/** List of \ref sat::Transaction::Step to be executed by commit.
* The list of transaction step commit actually tried to execute.
*/
const TransactionStepList & transactionStepList() const;
/** Manipulate \ref transactionStepList. */
TransactionStepList & rTransactionStepList();
/** List of update messages installed during this commit.
* \Note Pathnames are relative to the targets root directory.
* \code
* ZYppCommitResult result;
* ...
* if ( ! result.updateMessages().empty() )
* {
* MIL << "Received " << result.updateMessages().size() << " update notification(s):" << endl;
* for_( it, result.updateMessages().begin(), result.updateMessages().end() )
* {
* MIL << "- From " << it->solvable().asString() << " in file " << Pathname::showRootIf( result.root(), it->file() ) << ":" << endl;
* {
* // store message files content in a string:
* InputStream istr( Pathname::assertprefix( result.root(), it->file() ) );
* std::ostringstream strstr;
* iostr::copy( istr, strstr );
* std::string message( strstr.str() ); // contains the message
* }
* {
* // or write out the message file indented:
* InputStream istr( Pathname::assertprefix( result.root(), it->file() ) );
* iostr::copyIndent( istr, MIL, "> " ) << endl;
* }
* }
* }
* \endcode
*/
const UpdateNotifications & updateMessages() const;
/** Manipulate \ref updateMessages
* \Note Pathnames are relative to the targets root directory.
*/
UpdateNotifications & rUpdateMessages();
public:
/** \name Some statistics based on \ref Transaction
*
* Class \ref Transaction allows to count and iterate the action steps to
* get more detailed information about the transaction result. Here are just
* a few convenience methods for easy evaluation.
*
* \code
* ZYppCommitResult result;
* const sat::Transaction & trans( result.transaction() );
* for_( it, trans.actionBegin(~sat::Transaction::STEP_DONE), trans.actionEnd() )
* {
* // process all steps not DONE (ERROR and TODO)
* if ( it->satSolvable() )
* std::cout << it->satSolvable() << endl;
* else // deleted @System solvable: print post mortem data available
* std::cout << it->ident() << endl;
* }
* \endcode
* \see \ref Transaction, \ref transaction()
*/
//@{
/** Whether all steps were performed successfully (none skipped or error) */
bool allDone() const
{ return transaction().actionEmpty( ~sat::Transaction::STEP_DONE ); }
/** Whether an error ocurred (skipped streps are ok). */
bool noError() const
{ return transaction().actionEmpty( sat::Transaction::STEP_ERROR ); }
//@}
public:
/** Implementation */
class Impl;
private:
/** Pointer to data. */
RWCOW_pointer<Impl> _pimpl;
};
///////////////////////////////////////////////////////////////////
/** \relates ZYppCommitResult Stream output. */
std::ostream & operator<<( std::ostream & str, const ZYppCommitResult & obj );
/////////////////////////////////////////////////////////////////
} // namespace zypp
///////////////////////////////////////////////////////////////////
#endif // ZYPP_ZYPPCOMMITRESULT_H
|