libzypp: zypp/ng/progressobserveradaptor.h Source File

libzypp 17.38.6

progressobserveradaptor.h
Go to the documentation of this file.
1/*---------------------------------------------------------------------\
2| ____ _ __ __ ___ |
3| |__ / \ / / . \ . \ |
4| / / \ V /| _/ _/ |
5| / /__ | | | | | | |
6| /_____||_| |_| |_| |
7| |
8\---------------------------------------------------------------------*/
9#ifndef ZYPP_NG_PROGRESSOBSERVERADAPTOR_INCLUDED
10#define ZYPP_NG_PROGRESSOBSERVERADAPTOR_INCLUDED
11
12#include <zypp/ZYppCallbacks.h>
13#include <zypp-core/ng/ui/ProgressObserver>
14
15namespace zyppng {
16 struct ProgressObserverAdaptor
17 {
18
19 ProgressObserverAdaptor( zypp::callback::SendReport<zypp::ProgressReport> &report );
20
21 ProgressObserverAdaptor( const zypp::ProgressData::ReceiverFnc &fnc, zypp::callback::SendReport<zypp::ProgressReport> &report );
22
23 ProgressObserverRef observer();
24
25 private:
26 void init();
27 bool update(bool fin = false);
28
29 ProgressObserverRef _observer;
30 zypp::ProgressData::ReceiverFnc _fnc;
31 zypp::callback::SendReport<zypp::ProgressReport> &_report;
32 bool _first = true;
33 };
34}
35
36#endif // ZYPP_NG_PROGRESSOBSERVERADAPTOR_INCLUDED
ZYppCallbacks.h
zypp::ProgressData::ReceiverFnc
function< bool(const ProgressData &)> ReceiverFnc
Most simple version of progress reporting The percentage in most cases.
Definition progressdata.h:140
zyppng
Definition MediaNetworkRequestExecutor.h:16
zypp::callback::SendReport
Definition Callback.h:237
zyppng::ProgressObserverAdaptor::_report
zypp::callback::SendReport< zypp::ProgressReport > & _report
Definition progressobserveradaptor.h:31
zyppng::ProgressObserverAdaptor::_fnc
zypp::ProgressData::ReceiverFnc _fnc
Definition progressobserveradaptor.h:30
zyppng::ProgressObserverAdaptor::_first
bool _first
Definition progressobserveradaptor.h:32
zyppng::ProgressObserverAdaptor::update
bool update(bool fin=false)
Definition progressobserveradaptor.cc:45
zyppng::ProgressObserverAdaptor::_observer
ProgressObserverRef _observer
Definition progressobserveradaptor.h:29
zyppng::ProgressObserverAdaptor::ProgressObserverAdaptor
ProgressObserverAdaptor(zypp::callback::SendReport< zypp::ProgressReport > &report)
Definition progressobserveradaptor.cc:31
zyppng::ProgressObserverAdaptor::observer
ProgressObserverRef observer()
Definition progressobserveradaptor.cc:44
zyppng::ProgressObserverAdaptor::init
void init()
Definition progressobserveradaptor.cc:14