]>
git.saurik.com Git - apt.git/blob - apt-pkg/contrib/progress.h
1 // -*- mode: cpp; mode: fold -*-
3 // $Id: progress.h,v 1.1 1998/07/21 05:33:21 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 aquire 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 // Header section: pkglib
22 #ifndef PKGLIB_PROGRESS_H
23 #define PKGLIB_PROGRESS_H
26 #pragma interface "apt-pkg/progress.h"
34 unsigned long Current
;
37 unsigned long SubTotal
;
40 // Change reduction code
41 struct timeval LastTime
;
52 bool CheckChange(float Interval
= 0.7);
53 virtual void Update() {};
57 void Progress(unsigned long Current
);
58 void SubProgress(unsigned long SubTotal
,string Op
);
59 void OverallProgress(unsigned long Current
,unsigned long Total
,
60 unsigned long Size
,string Op
);
63 virtual ~OpProgress() {};
66 class OpTextProgress
: public OpProgress
72 unsigned long LastLen
;
73 virtual void Update();
74 void Write(const char *S
);
80 OpTextProgress(bool NoUpdate
= false) : NoUpdate(NoUpdate
), LastLen(0) {};
81 virtual ~OpTextProgress() {Done();};