Author: mlandres
Date: Tue Jul 10 15:18:41 2007
New Revision: 5949
URL: http://svn.opensuse.org/viewcvs/zypp?rev=5949&view=rev
Log:
add methods to get the ProgressData percent/alive value.
Modified:
branches/REFACTORING-10_3/libzypp/zypp/ProgressData.h
Modified: branches/REFACTORING-10_3/libzypp/zypp/ProgressData.h
URL: http://svn.opensuse.org/viewcvs/zypp/branches/REFACTORING-10_3/libzypp/zypp/ProgressData.h?rev=5949&r1=5948&r2=5949&view=diff
==============================================================================
--- branches/REFACTORING-10_3/libzypp/zypp/ProgressData.h (original)
+++ branches/REFACTORING-10_3/libzypp/zypp/ProgressData.h Tue Jul 10 15:18:41 2007
@@ -139,7 +139,7 @@
/** Most simple version of progress reporting
* The percentage in most cases. Sometimes just keepalive.
* \p sender ProgressData object who sends the progress info
- * \p
+ * \p
*/
typedef function ReceiverFnc;
@@ -293,6 +293,27 @@
bool hasRange() const
{ return min() != max(); }
+
+ /** @return Wheter \ref reportValue will return a percent value.
+ * Same as \ref hasRange.
+ * \see \ref reportAlive
+ */
+ bool reportPercent() const
+ { return hasRange(); }
+
+ /** @return Wheter \ref reportValue always returns -1, because we
+ * trigger 'still alive' messages. I.e. \ref hasrange is \c false.
+ * \see \ref reportPercent
+ */
+ bool reportAlive() const
+ { return ! hasRange(); }
+
+ /** @return Either a a percent value or -1.
+ * \see \ref reportPercent and \ref reportAlive.
+ */
+ value_type reportValue() const
+ { return hasRange() ? val() * 100 / ( max() - min() ) : -1; }
+
/** @return The counters name. */
const std::string & name() const
{ return _d->_name; }
@@ -320,7 +341,7 @@
ProgressData makeProgressData( const InputStream & input_r );
///////////////////////////////////////////////////////////////////
-
+
/**
* \short Progress callback from another progress
*
@@ -369,7 +390,7 @@
*/
CombinedProgressData( ProgressData &pd,
ProgressData::value_type weight );
-
+
/**
* Implements the \ref ProgressData::ReceiverFnc
* callback interface
--
To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org
For additional commands, e-mail: zypp-commit+help@opensuse.org