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 /* Global Start/Stop */
31 virtual void Start() {};
32 virtual void Stop() {};
34 /* When dpkg is invoked (may happen multiple times for each
35 * install/remove block
37 virtual void StartDpkg() {};
39 virtual pid_t
fork() {return fork(); };
41 virtual void Pulse() {};
42 virtual long GetPulseInterval() {
46 virtual bool StatusChanged(std::string PackageName
,
47 unsigned int StepsDone
,
48 unsigned int TotalSteps
,
49 std::string HumanReadableAction
) ;
50 virtual void Error(std::string PackageName
,
51 unsigned int StepsDone
,
52 unsigned int TotalSteps
,
53 std::string ErrorMessage
) {};
54 virtual void ConffilePrompt(std::string PackageName
,
55 unsigned int StepsDone
,
56 unsigned int TotalSteps
,
57 std::string ConfMessage
) {};
60 class PackageManagerProgressFd
: public PackageManager
66 void WriteToStatusFd(std::string msg
);
69 PackageManagerProgressFd(int progress_fd
);
71 virtual void StartDpkg();
74 virtual bool StatusChanged(std::string PackageName
,
75 unsigned int StepsDone
,
76 unsigned int TotalSteps
,
77 std::string HumanReadableAction
);
78 virtual void Error(std::string PackageName
,
79 unsigned int StepsDone
,
80 unsigned int TotalSteps
,
81 std::string ErrorMessage
);
82 virtual void ConffilePrompt(std::string PackageName
,
83 unsigned int StepsDone
,
84 unsigned int TotalSteps
,
85 std::string ConfMessage
);
89 class PackageManagerProgressDeb822Fd
: public PackageManager
95 void WriteToStatusFd(std::string msg
);
98 PackageManagerProgressDeb822Fd(int progress_fd
);
100 virtual void StartDpkg();
103 virtual bool StatusChanged(std::string PackageName
,
104 unsigned int StepsDone
,
105 unsigned int TotalSteps
,
106 std::string HumanReadableAction
);
107 virtual void Error(std::string PackageName
,
108 unsigned int StepsDone
,
109 unsigned int TotalSteps
,
110 std::string ErrorMessage
);
111 virtual void ConffilePrompt(std::string PackageName
,
112 unsigned int StepsDone
,
113 unsigned int TotalSteps
,
114 std::string ConfMessage
);
117 class PackageManagerFancy
: public PackageManager
120 static void SetupTerminalScrollArea(int nr_rows
);
121 static int GetNumberTerminalRows();
122 static void HandleSIGWINCH(int);
123 sighandler_t old_SIGWINCH
;
126 PackageManagerFancy();
127 ~PackageManagerFancy();
128 virtual void Start();
130 virtual bool StatusChanged(std::string PackageName
,
131 unsigned int StepsDone
,
132 unsigned int TotalSteps
,
133 std::string HumanReadableAction
);
136 class PackageManagerText
: public PackageManager
139 virtual bool StatusChanged(std::string PackageName
,
140 unsigned int StepsDone
,
141 unsigned int TotalSteps
,
142 std::string HumanReadableAction
);
146 }; // namespace Progress