1 #ifndef PKGLIB_IPROGRESS_H
2 #define PKGLIB_IPROGRESS_H
12 PackageManager
* PackageManagerProgressFactory();
17 /** \brief dpointer placeholder */
21 std::string progress_str
;
23 int last_reported_progress
;
27 : percentage(0.0), last_reported_progress(-1) {};
28 virtual ~PackageManager() {};
30 virtual void Start() {};
31 virtual void Stop() {};
33 virtual pid_t
fork() {return fork(); };
35 virtual void Pulse() {};
36 virtual long GetPulseInterval() {
40 virtual bool StatusChanged(std::string PackageName
,
41 unsigned int StepsDone
,
42 unsigned int TotalSteps
,
43 std::string HumanReadableAction
) ;
44 virtual void Error(std::string PackageName
,
45 unsigned int StepsDone
,
46 unsigned int TotalSteps
,
47 std::string ErrorMessage
) {};
48 virtual void ConffilePrompt(std::string PackageName
,
49 unsigned int StepsDone
,
50 unsigned int TotalSteps
,
51 std::string ConfMessage
) {};
54 class PackageManagerProgressFd
: public PackageManager
60 void WriteToStatusFd(std::string msg
);
63 PackageManagerProgressFd(int progress_fd
);
68 virtual bool StatusChanged(std::string PackageName
,
69 unsigned int StepsDone
,
70 unsigned int TotalSteps
,
71 std::string HumanReadableAction
);
72 virtual void Error(std::string PackageName
,
73 unsigned int StepsDone
,
74 unsigned int TotalSteps
,
75 std::string ErrorMessage
);
76 virtual void ConffilePrompt(std::string PackageName
,
77 unsigned int StepsDone
,
78 unsigned int TotalSteps
,
79 std::string ConfMessage
);
83 class PackageManagerProgressDeb822Fd
: public PackageManager
89 void WriteToStatusFd(std::string msg
);
92 PackageManagerProgressDeb822Fd(int progress_fd
);
97 virtual bool StatusChanged(std::string PackageName
,
98 unsigned int StepsDone
,
99 unsigned int TotalSteps
,
100 std::string HumanReadableAction
);
101 virtual void Error(std::string PackageName
,
102 unsigned int StepsDone
,
103 unsigned int TotalSteps
,
104 std::string ErrorMessage
);
105 virtual void ConffilePrompt(std::string PackageName
,
106 unsigned int StepsDone
,
107 unsigned int TotalSteps
,
108 std::string ConfMessage
);
111 class PackageManagerFancy
: public PackageManager
114 int nr_terminal_rows
;
115 void SetupTerminalScrollArea(int nr_rows
);
118 PackageManagerFancy();
119 virtual void Start();
121 virtual bool StatusChanged(std::string PackageName
,
122 unsigned int StepsDone
,
123 unsigned int TotalSteps
,
124 std::string HumanReadableAction
);
127 class PackageManagerText
: public PackageManager
130 virtual bool StatusChanged(std::string PackageName
,
131 unsigned int StepsDone
,
132 unsigned int TotalSteps
,
133 std::string HumanReadableAction
);
137 }; // namespace Progress