libzypp: zypp/media/detail/OptionalDownloadProgressReport.h Source File

libzypp 17.38.11

OptionalDownloadProgressReport.h
Go to the documentation of this file.
1/*---------------------------------------------------------------------\
2| ____ _ __ __ ___ |
3| |__ / \ / / . \ . \ |
4| / / \ V /| _/ _/ |
5| / /__ | | | | | | |
6| /_____||_| |_| |_| |
7| |
8\---------------------------------------------------------------------*/
9#ifndef ZYPP_MEDIA_DETAIL_OPTIONALDOWNLOADPROGRESSREPORT_INCLUDED
10#define ZYPP_MEDIA_DETAIL_OPTIONALDOWNLOADPROGRESSREPORT_INCLUDED
11
12#include <zypp/ZYppCallbacks.h>
13#include <zypp/Callback.h>
14
15
16namespace internal {
17
21 struct OptionalDownloadProgressReport : public zypp::callback::ReceiveReport<zypp::media::DownloadProgressReport>
22 {
23 using TimePoint = std::chrono::steady_clock::time_point;
24
25 OptionalDownloadProgressReport( bool isOptional=false );
26
27 OptionalDownloadProgressReport(const OptionalDownloadProgressReport &) = delete;
28 OptionalDownloadProgressReport(OptionalDownloadProgressReport &&) = delete;
29 OptionalDownloadProgressReport &operator= (const OptionalDownloadProgressReport &) = delete;
30 OptionalDownloadProgressReport &operator= (OptionalDownloadProgressReport &&) = delete;
31
32 ~OptionalDownloadProgressReport() override;
33
34 void reportbegin() override;
35
36 void reportend() override;
37
38 void report( const UserData & userData_r = UserData() ) override;
39
40 void start( const zypp::Url & file_r, zypp::Pathname localfile_r ) override;
41
42 bool progress( int value_r, const zypp::Url & file_r, double dbps_avg_r = -1, double dbps_current_r = -1 ) override;
43
44 Action problem( const zypp::Url & file_r, Error error_r, const std::string & description_r ) override;
45
46 void finish( const zypp::Url & file_r, Error error_r, const std::string & reason_r ) override;
47
48 private:
49 // _isOptional also indicates the delayed start
50 bool notStarted() const;
51
52 void sendStart();
53
54 private:
55 Receiver *const _oldRec;
56 bool _isOptional;
57 zypp::Url _startFile;
58 zypp::Pathname _startLocalfile;
59 TimePoint _lastProgressSent;
60 };
61
62
63}
64
65
66#endif
Callback.h
ZYppCallbacks.h
zypp::Url
Url manipulation class.
Definition Url.h:93
zypp::filesystem::Pathname
Pathname.
Definition Pathname.h:48
internal
Definition OptionalDownloadProgressReport.cc:12
internal::OptionalDownloadProgressReport::notStarted
bool notStarted() const
Definition OptionalDownloadProgressReport.cc:80
internal::OptionalDownloadProgressReport::~OptionalDownloadProgressReport
~OptionalDownloadProgressReport() override
Definition OptionalDownloadProgressReport.cc:21
internal::OptionalDownloadProgressReport::report
void report(const UserData &userData_r=UserData()) override
The most generic way of sending/receiving data.
Definition OptionalDownloadProgressReport.cc:34
internal::OptionalDownloadProgressReport::_startFile
zypp::Url _startFile
Definition OptionalDownloadProgressReport.h:57
internal::OptionalDownloadProgressReport::_startLocalfile
zypp::Pathname _startLocalfile
Definition OptionalDownloadProgressReport.h:58
internal::OptionalDownloadProgressReport::start
void start(const zypp::Url &file_r, zypp::Pathname localfile_r) override
Definition OptionalDownloadProgressReport.cc:37
internal::OptionalDownloadProgressReport::reportbegin
void reportbegin() override
Definition OptionalDownloadProgressReport.cc:28
internal::OptionalDownloadProgressReport::finish
void finish(const zypp::Url &file_r, Error error_r, const std::string &reason_r) override
Definition OptionalDownloadProgressReport.cc:74
internal::OptionalDownloadProgressReport::reportend
void reportend() override
Definition OptionalDownloadProgressReport.cc:31
internal::OptionalDownloadProgressReport::problem
Action problem(const zypp::Url &file_r, Error error_r, const std::string &description_r) override
Definition OptionalDownloadProgressReport.cc:68
internal::OptionalDownloadProgressReport::operator=
OptionalDownloadProgressReport & operator=(const OptionalDownloadProgressReport &)=delete
internal::OptionalDownloadProgressReport::OptionalDownloadProgressReport
OptionalDownloadProgressReport(bool isOptional=false)
Definition OptionalDownloadProgressReport.cc:16
internal::OptionalDownloadProgressReport::TimePoint
std::chrono::steady_clock::time_point TimePoint
Definition OptionalDownloadProgressReport.h:23
internal::OptionalDownloadProgressReport::_oldRec
Receiver *const _oldRec
Definition OptionalDownloadProgressReport.h:55
internal::OptionalDownloadProgressReport::OptionalDownloadProgressReport
OptionalDownloadProgressReport(OptionalDownloadProgressReport &&)=delete
internal::OptionalDownloadProgressReport::progress
bool progress(int value_r, const zypp::Url &file_r, double dbps_avg_r=-1, double dbps_current_r=-1) override
Download progress.
Definition OptionalDownloadProgressReport.cc:49
internal::OptionalDownloadProgressReport::_isOptional
bool _isOptional
Definition OptionalDownloadProgressReport.h:56
internal::OptionalDownloadProgressReport::sendStart
void sendStart()
Definition OptionalDownloadProgressReport.cc:83
internal::OptionalDownloadProgressReport::_lastProgressSent
TimePoint _lastProgressSent
Definition OptionalDownloadProgressReport.h:59
internal::OptionalDownloadProgressReport::OptionalDownloadProgressReport
OptionalDownloadProgressReport(const OptionalDownloadProgressReport &)=delete
zypp::callback::ReceiveReport
Definition Callback.h:169
zypp::callback::ReceiveReport< zypp::media::DownloadProgressReport >::Receiver
ReceiveReport< zypp::media::DownloadProgressReport > Receiver
Definition Callback.h:171
zypp::callback::ReportBase::UserData
callback::UserData UserData
Definition Callback.h:151
zypp::media::DownloadProgressReport::Action
Action
Definition ZYppCallbacks.h:364
zypp::media::DownloadProgressReport::Error
Error
Definition ZYppCallbacks.h:370