]> git.saurik.com Git - apt.git/blobdiff - apt-pkg/iprogress.h
move common code into PackageManager::StatusChanged()
[apt.git] / apt-pkg / iprogress.h
index f097e09432b271d9daa79f35d72e2ab4f8184ff5..5f1655ab970c524c1b2b4e129c1a9cdfad08e4ac 100644 (file)
@@ -14,21 +14,26 @@ namespace Progress {
     /** \brief dpointer placeholder */
     void *d;
 
     /** \brief dpointer placeholder */
     void *d;
 
+ protected:
+    std::string progress_str;
+    float percentage;
+    int last_reported_progress;
+
  public:
  public:
+    PackageManager() : percentage(0.0), last_reported_progress(0) {};
     virtual ~PackageManager() {};
 
     virtual void Started() {};
     virtual void Finished() {};
     
     virtual ~PackageManager() {};
 
     virtual void Started() {};
     virtual void Finished() {};
     
-    virtual void StatusChanged(std::string PackageName, 
+    virtual bool StatusChanged(std::string PackageName, 
                                unsigned int StepsDone,
                                unsigned int StepsDone,
-                               unsigned int TotalSteps) {};
+                               unsigned int TotalSteps);
  };
 
  class PackageManagerFancy : public PackageManager
  {
  protected:
  };
 
  class PackageManagerFancy : public PackageManager
  {
  protected:
-    int last_reported_progress;
     int nr_terminal_rows;
     void SetupTerminalScrollArea(int nr_rows);
 
     int nr_terminal_rows;
     void SetupTerminalScrollArea(int nr_rows);
 
@@ -36,19 +41,15 @@ namespace Progress {
     PackageManagerFancy();
     virtual void Started();
     virtual void Finished();
     PackageManagerFancy();
     virtual void Started();
     virtual void Finished();
-    virtual void StatusChanged(std::string PackageName, 
+    virtual bool StatusChanged(std::string PackageName, 
                                unsigned int StepsDone,
                                unsigned int TotalSteps);
  };
 
  class PackageManagerText : public PackageManager
  {
                                unsigned int StepsDone,
                                unsigned int TotalSteps);
  };
 
  class PackageManagerText : public PackageManager
  {
- protected:
-    int last_reported_progress;
-
  public:
  public:
-    PackageManagerText() : last_reported_progress(0) {};
-    virtual void StatusChanged(std::string PackageName, 
+    virtual bool StatusChanged(std::string PackageName, 
                                unsigned int StepsDone,
                                unsigned int TotalSteps);
 
                                unsigned int StepsDone,
                                unsigned int TotalSteps);