12 #ifndef ZYPP_CORE_UI_PROGRESSDATA_H 13 #define ZYPP_CORE_UI_PROGRESSDATA_H 21 #include <zypp-core/base/ProvideNumericId> 148 using TimePoint = std::chrono::steady_clock::time_point;
151 :
_state( INIT ), _min( min_r ), _max( max_r ), _val( val_r )
168 friend Data * rwcowClone<Data>(
const Data * rhs );
175 : _d( new
Data( 0, 0, 0 ) )
180 : _d( new
Data( 0, max_r, 0 ) )
185 : _d( new
Data( min_r, max_r, min_r ) )
190 : _d( new
Data( min_r, max_r, val_r ) )
195 if ( _d->_state == RUN )
205 { _d->_min = min_r; }
209 { _d->_max = max_r; }
217 { range( 0, max_r ); }
221 { min( min_r ); max( max_r ); }
225 void name(
const std::string & name_r )
226 { _d->_name = name_r; }
230 { _d->_receiver = fnc_r; }
260 return set( rhs.val() );
265 {
return set( val() + val_r ); }
269 {
return set( val() - val_r ); }
273 {
return set( min() ); }
277 {
return hasRange() ?
set( max() ) : tick(); }
303 {
return min() != max(); }
310 {
return hasRange(); }
317 {
return ! hasRange(); }
323 {
return hasRange() ? val() * 100 / ( max() - min() ) : -1; }
326 const std::string &
name()
const 327 {
return _d->_name; }
331 {
return _d->_receiver; }
337 {
return( _d->_state == END ); }
428 #endif // ZYPP_CORE_UI_PROGRESSDATA_H Data(value_type min_r, value_type max_r, value_type val_r)
ProgressData makeProgressData(const InputStream &input_r)
ProgressData()
Ctor no range [0,0](0).
void sendTo(const ReceiverFnc &fnc_r)
Set ReceiverFnc.
bool decr(value_type val_r=1)
Decrement counter value (default by 1).
function< bool(const ProgressData &)> ReceiverFnc
Most simple version of progress reporting The percentage in most cases.
ProgressData(value_type min_r, value_type max_r, value_type val_r)
Ctor [min,max](val).
String related utilities and Regular expression matching.
bool toMax()
Set counter value to current max value (unless no range).
std::ostream & operator<<(std::ostream &str, const SerialNumber &obj)
void min(value_type min_r)
Set new min value.
void max(value_type max_r)
Set new max value.
void range(value_type max_r)
Set new [0,max].
Progress callback from another progress.
Base class for objects providing a numeric Id.
const ReceiverFnc & receiver() const
bool toMin()
Set counter value to current min value.
const Arch Arch_armv7hnl Arch_armv7nhl ZYPP_API
ProgressData(value_type min_r, value_type max_r)
Ctor [min,max](min).
Maintain [min,max] and counter (value) for progress counting.
void noRange()
Set no range [0,0].
bool incr(value_type val_r=1)
Increment counter value (default by 1).
void noSend()
Set no ReceiverFnc.
const std::string & name() const
ProgressData::value_type _weight
ProgressData(value_type max_r)
Ctor [0,max](0).
value_type reportValue() const
bool tick()
Leave counter value unchanged (still alive).
AutoDispose< void * > _state
std::chrono::steady_clock::time_point TimePoint
void range(value_type min_r, value_type max_r)
Set new [min,max].
void name(const std::string &name_r)
Set counter name.
Easy-to use interface to the ZYPP dependency resolver.
ProgressData::value_type _last_value
bool reportPercent() const
RW_pointer supporting 'copy on write' functionality.
RWCOW_pointer< Data > _d
Pointer to data.