12 #ifndef ZYPP_PROGRESSDATA_H
13 #define ZYPP_PROGRESSDATA_H
170 friend Data * rwcowClone<Data>(
const Data * rhs );
177 :
_d( new
Data( 0, 0, 0 ) )
182 :
_d( new
Data( 0, max_r, 0 ) )
187 :
_d( new
Data( min_r, max_r, min_r ) )
192 :
_d( new
Data( min_r, max_r, val_r ) )
197 if (
_d->_state ==
RUN )
207 {
_d->_min = min_r; }
211 {
_d->_max = max_r; }
219 {
range( 0, max_r ); }
223 {
min( min_r );
max( max_r ); }
227 void name(
const std::string & name_r )
228 {
_d->_name = name_r; }
232 {
_d->_receiver = fnc_r; }
259 {
return set(
val() + val_r ); }
263 {
return set(
val() - val_r ); }
297 {
return min() !=
max(); }
320 const std::string &
name()
const
321 {
return _d->_name; }
325 {
return _d->_receiver; }
331 {
return(
_d->_state ==
END ); }
422 #endif // ZYPP_PROGRESSDATA_H
Data(value_type min_r, value_type max_r, value_type val_r)
const std::string & name() const
const ReceiverFnc & receiver() const
bool reportPercent() const
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).
ProgressData(value_type min_r, value_type max_r, value_type val_r)
Ctor [min,max](val).
bool toMax()
Set counter value to current max value (unless no range).
void min(value_type min_r)
Set new min value.
void max(value_type max_r)
Set new max value.
function< bool(const ProgressData &)> ReceiverFnc
Most simple version of progress reporting The percentage in most cases.
bool report()
Send report if necessary.
void range(value_type max_r)
Set new [0,max].
Progress callback from another progress.
Base class for objects providing a numeric Id.
bool toMin()
Set counter value to current min value.
Store and operate on date (time_t).
std::ostream & operator<<(std::ostream &str, const Exception &obj)
bool operator()(const ProgressData &progress)
Implements the ProgressData::ReceiverFnc callback interface.
ProgressData(value_type min_r, value_type max_r)
Ctor [min,max](min).
Maintain [min,max] and counter (value) for progress counting.
CombinedProgressData(ProgressData &pd, ProgressData::value_type weight=0)
Ctor.
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.
ProgressData::value_type _weight
ProgressData(value_type max_r)
Ctor [0,max](0).
bool tick()
Leave counter value unchanged (still alive).
bool set(value_type val_r)
Set new counter value.
void range(value_type min_r, value_type max_r)
Set new [min,max].
void name(const std::string &name_r)
Set counter name.
ProgressData::value_type _last_value
value_type reportValue() const
RW_pointer supporting 'copy on write' functionality.
RWCOW_pointer< Data > _d
Pointer to data.