13 #include <zypp/base/Logger.h> 14 #include <zypp-core/base/InputStream> 15 #include <zypp/base/String.h> 17 #include <zypp-core/ui/ProgressData> 21 #undef ZYPP_BASE_LOGGER_LOGGROUP 22 #define ZYPP_BASE_LOGGER_LOGGROUP "Progress" 35 bool forceReport {
_d->_state !=
RUN };
37 static constexpr std::chrono::milliseconds minfequency { 1000 };
38 static constexpr std::chrono::milliseconds maxfequency { 100 };
40 Data::TimePoint::duration elapsed { now -
_d->_last_send };
41 if ( not forceReport && elapsed < maxfequency ) {
50 if ( elapsed > minfequency
51 || newVal !=
_d->_last_val
54 _d->_last_val = newVal;
62 if ( elapsed > minfequency || forceReport )
64 _d->_last_val =
_d->_val;
81 if ( !
_d->_receiver( *
this ) )
83 if (
_d->_state !=
END )
85 WAR <<
"User request to ABORT pending action. " 87 _d->_last_val, (
hasRange() ?
"%" :
"!" ) ) << endl;
92 else if (
_d->_state ==
END )
109 return str <<
str::form(
"{%u|%s}[%lld,%lld](%lld)%lld%%)",
127 if ( input_r.
size() > 0 )
151 float real_increment = parent_factor*increment;
ProgressData makeProgressData(const InputStream &input_r)
String related utilities and Regular expression matching.
unsigned numericId() const
std::ostream & operator<<(std::ostream &str, const SerialNumber &obj)
void min(value_type min_r)
Set new min value.
std::string form(const char *format,...) __attribute__((format(printf
Printf style construction of std::string.
void max(value_type max_r)
Set new max value.
bool report()
Send report if necessary.
void range(value_type max_r)
Set new [0,max].
bool operator()(const ProgressData &progress)
Implements the ProgressData::ReceiverFnc callback interface.
Maintain [min,max] and counter (value) for progress counting.
CombinedProgressData(ProgressData &pd, ProgressData::value_type weight=0)
Ctor.
bool incr(value_type val_r=1)
Increment counter value (default by 1).
const std::string & name() const
ProgressData::value_type _weight
value_type reportValue() const
bool tick()
Leave counter value unchanged (still alive).
std::chrono::steady_clock::time_point TimePoint
void name(const std::string &name_r)
Set counter name.
Easy-to use interface to the ZYPP dependency resolver.
ProgressData::value_type _last_value
RWCOW_pointer< Data > _d
Pointer to data.