diff options
author | Michael Vogt <mvo@debian.org> | 2013-10-13 15:05:04 +0200 |
---|---|---|
committer | Michael Vogt <mvo@debian.org> | 2013-10-13 15:05:04 +0200 |
commit | e6ad8031b774af9bdd5d460d9983450bb5a03d0d (patch) | |
tree | c337e4b089a091770b181c9575ab61eea9cb0074 /apt-pkg/iprogress.h | |
parent | 6c5ae8ed079e01082f606614641b19b7c08893ad (diff) |
move the status-fd progress reporting out of the pkgDPkgPM class, at this point, breaks ABI/API, lets see what we can do about this
Diffstat (limited to 'apt-pkg/iprogress.h')
-rw-r--r-- | apt-pkg/iprogress.h | 56 |
1 files changed, 48 insertions, 8 deletions
diff --git a/apt-pkg/iprogress.h b/apt-pkg/iprogress.h index 5f1655ab9..6519e9445 100644 --- a/apt-pkg/iprogress.h +++ b/apt-pkg/iprogress.h @@ -1,13 +1,13 @@ #ifndef PKGLIB_IPROGRESS_H -#define PKGLIB_IPROGRSS_H +#define PKGLIB_IPROGRESS_H +#include <string> +#include <unistd.h> -#include <apt-pkg/packagemanager.h> namespace APT { namespace Progress { - class PackageManager { private: @@ -20,15 +20,54 @@ namespace Progress { int last_reported_progress; public: - PackageManager() : percentage(0.0), last_reported_progress(0) {}; + PackageManager() + : percentage(0.0), last_reported_progress(0) {}; virtual ~PackageManager() {}; virtual void Started() {}; virtual void Finished() {}; + + virtual pid_t fork() {return fork(); }; virtual bool StatusChanged(std::string PackageName, unsigned int StepsDone, - unsigned int TotalSteps); + unsigned int TotalSteps, + std::string HumanReadableAction) ; + virtual void Error(std::string PackageName, + unsigned int StepsDone, + unsigned int TotalSteps, + std::string ErrorMessage) {}; + virtual void ConffilePrompt(std::string PackageName, + unsigned int StepsDone, + unsigned int TotalSteps, + std::string ConfMessage) {}; + }; + + class PackageManagerProgressFd : public PackageManager + { + protected: + int OutStatusFd; + int StepsDone; + int StepsTotal; + + public: + PackageManagerProgressFd(int progress_fd); + virtual void Started(); + virtual void Finished(); + + virtual bool StatusChanged(std::string PackageName, + unsigned int StepsDone, + unsigned int TotalSteps, + std::string HumanReadableAction); + virtual void Error(std::string PackageName, + unsigned int StepsDone, + unsigned int TotalSteps, + std::string ErrorMessage); + virtual void ConffilePrompt(std::string PackageName, + unsigned int StepsDone, + unsigned int TotalSteps, + std::string ConfMessage); + }; class PackageManagerFancy : public PackageManager @@ -43,7 +82,8 @@ namespace Progress { virtual void Finished(); virtual bool StatusChanged(std::string PackageName, unsigned int StepsDone, - unsigned int TotalSteps); + unsigned int TotalSteps, + std::string HumanReadableAction); }; class PackageManagerText : public PackageManager @@ -51,8 +91,8 @@ namespace Progress { public: virtual bool StatusChanged(std::string PackageName, unsigned int StepsDone, - unsigned int TotalSteps); - + unsigned int TotalSteps, + std::string HumanReadableAction); }; |