X-Git-Url: https://git.saurik.com/apt.git/blobdiff_plain/1a7c9eba99a9521a7722be37d6bafe5fa4936630..30b683f4f3021cd191ffef04bfaf2deb65820a52:/apt-pkg/contrib/progress.h diff --git a/apt-pkg/contrib/progress.h b/apt-pkg/contrib/progress.h index e3530cdcb..f7fbc9ccf 100644 --- a/apt-pkg/contrib/progress.h +++ b/apt-pkg/contrib/progress.h @@ -1,13 +1,13 @@ // -*- mode: cpp; mode: fold -*- // Description /*{{{*/ -// $Id: progress.h,v 1.2 1998/08/23 03:52:23 jgg Exp $ +// $Id: progress.h,v 1.6 2001/05/07 05:06:52 jgg Exp $ /* ###################################################################### OpProgress - Operation Progress This class allows lengthy operations to communicate their progress to the GUI. The progress model is simple and is not designed to handle - the complex case of the multi-activity aquire class. + the complex case of the multi-activity acquire class. The model is based on the concept of an overall operation consisting of a series of small sub operations. Each sub operation has it's own @@ -18,34 +18,35 @@ ##################################################################### */ /*}}}*/ -// Header section: pkglib #ifndef PKGLIB_PROGRESS_H #define PKGLIB_PROGRESS_H -#ifdef __GNUG__ -#pragma interface "apt-pkg/progress.h" -#endif #include #include +#ifndef APT_8_CLEANER_HEADERS +using std::string; +#endif + +class Configuration; class OpProgress { - unsigned long Current; - unsigned long Total; - unsigned long Size; - unsigned long SubTotal; + unsigned long long Current; + unsigned long long Total; + unsigned long long Size; + unsigned long long SubTotal; float LastPercent; // Change reduction code struct timeval LastTime; - string LastOp; - string LastSubOp; + std::string LastOp; + std::string LastSubOp; protected: - string Op; - string SubOp; + std::string Op; + std::string SubOp; float Percent; bool MajorChange; @@ -55,10 +56,10 @@ class OpProgress public: - void Progress(unsigned long Current); - void SubProgress(unsigned long SubTotal,string Op); - void OverallProgress(unsigned long Current,unsigned long Total, - unsigned long Size,string Op); + void Progress(unsigned long long Current); + void SubProgress(unsigned long long SubTotal, const std::string &Op = "", float const Percent = -1); + void OverallProgress(unsigned long long Current,unsigned long long Total, + unsigned long long Size,const std::string &Op); virtual void Done() {}; OpProgress(); @@ -68,9 +69,10 @@ class OpProgress class OpTextProgress : public OpProgress { protected: - - string OldOp; + + std::string OldOp; bool NoUpdate; + bool NoDisplay; unsigned long LastLen; virtual void Update(); void Write(const char *S); @@ -79,7 +81,9 @@ class OpTextProgress : public OpProgress virtual void Done(); - OpTextProgress(bool NoUpdate = false) : NoUpdate(NoUpdate), LastLen(0) {}; + OpTextProgress(bool NoUpdate = false) : NoUpdate(NoUpdate), + NoDisplay(false), LastLen(0) {}; + OpTextProgress(Configuration &Config); virtual ~OpTextProgress() {Done();}; };