1 /*---------------------------------------------------------------------\
3 | |__ / \ / / . \ . \ |
8 \---------------------------------------------------------------------*/
10 #ifndef ZYPP_PROVIDEFILEPOLICY_H
11 #define ZYPP_PROVIDEFILEPOLICY_H
15 #include "zypp/base/Function.h"
16 #include "zypp/base/Functional.h"
18 ///////////////////////////////////////////////////////////////////
20 { /////////////////////////////////////////////////////////////////
21 ///////////////////////////////////////////////////////////////////
22 // CLASS NAME : ProvideFilePolicy
24 /** Policy for \ref provideFile.
25 * Provides callback hooks for e.g progress reporting or
26 * behaviour on checksum failure. Provides default
27 * implementations if no callback is set.
29 class ProvideFilePolicy
32 /** Progress callback signature. */
33 typedef function<bool ( int )> ProgressCB;
36 ProvideFilePolicy & progressCB( ProgressCB progressCB_r )
37 { _progressCB = progressCB_r; return *this; }
39 /** Evaluate callback. */
40 bool progress( int value ) const;
43 /** FailOnChecksumError callback signature. */
44 typedef function<bool ()> FailOnChecksumErrorCB;
47 ProvideFilePolicy & failOnChecksumErrorCB( FailOnChecksumErrorCB failOnChecksumErrorCB_r )
48 { _failOnChecksumErrorCB = failOnChecksumErrorCB_r; return *this; }
50 /** Set callback convenience.
51 * Let callback return \c yesno_r.
53 ProvideFilePolicy & failOnChecksumErrorCB( bool yesno_r );
55 /** Evaluate callback. */
56 bool failOnChecksumError() const;
59 FailOnChecksumErrorCB _failOnChecksumErrorCB;
60 ProgressCB _progressCB;
64 ///////////////////////////////////////////////////////////////////
65 #endif // ZYPP_PROVIDEFILEPOLICY_H