]>
git.saurik.com Git - apt.git/blob - apt-pkg/contrib/progress.h
1 // -*- mode: cpp; mode: fold -*-
3 // $Id: progress.h,v 1.6 2001/05/07 05:06:52 jgg Exp $
4 /* ######################################################################
6 OpProgress - Operation Progress
8 This class allows lengthy operations to communicate their progress
9 to the GUI. The progress model is simple and is not designed to handle
10 the complex case of the multi-activity acquire class.
12 The model is based on the concept of an overall operation consisting
13 of a series of small sub operations. Each sub operation has it's own
14 completion status and the overall operation has it's completion status.
15 The units of the two are not mixed and are completely independent.
17 The UI is expected to subclass this to provide the visuals to the user.
19 ##################################################################### */
21 #ifndef PKGLIB_PROGRESS_H
22 #define PKGLIB_PROGRESS_H
27 #include <apt-pkg/macros.h>
29 #ifndef APT_8_CLEANER_HEADERS
36 unsigned long long Current
;
37 unsigned long long Total
;
38 unsigned long long Size
;
39 unsigned long long SubTotal
;
42 // Change reduction code
43 struct timeval LastTime
;
45 std::string LastSubOp
;
55 bool CheckChange(float Interval
= 0.7);
56 virtual void Update() {};
60 void Progress(unsigned long long Current
);
61 void SubProgress(unsigned long long SubTotal
, const std::string
&Op
= "", float const Percent
= -1);
62 void OverallProgress(unsigned long long Current
,unsigned long long Total
,
63 unsigned long long Size
,const std::string
&Op
);
64 virtual void Done() {};
67 virtual ~OpProgress() {};
70 class OpTextProgress
: public OpProgress
77 unsigned long LastLen
;
78 virtual void Update() APT_OVERRIDE
;
79 void Write(const char *S
);
83 virtual void Done() APT_OVERRIDE
;
85 OpTextProgress(bool NoUpdate
= false) : NoUpdate(NoUpdate
),
86 NoDisplay(false), LastLen(0) {};
87 OpTextProgress(Configuration
&Config
);
88 virtual ~OpTextProgress() {Done();};