File: rswig.h

package info (click to toggle)
synaptic 0.84.2
  • links: PTS
  • area: main
  • in suites: stretch
  • size: 21,356 kB
  • ctags: 2,544
  • sloc: cpp: 24,304; xml: 10,562; ansic: 2,084; makefile: 582; sh: 438; sed: 93; python: 82
file content (80 lines) | stat: -rw-r--r-- 2,213 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
// helper code for the swig generated bindings

#include<apt-pkg/configuration.h>
#include<apt-pkg/init.h>
#include<apt-pkg/progress.h>
#include<apt-pkg/acquire.h>
#include "rinstallprogress.h"

bool RInitSystem();

class SwigOpProgress : public OpProgress {
 protected:
   virtual void Update() { UpdateStatus(Percent); };
 public:
   virtual void UpdateStatus(float p) {};
   virtual void Done() {};
};


class SwigInstallProgress : public RInstallProgress {
 public:
   virtual void startUpdate() {
   };
   virtual void updateInterface() {
   };
   virtual void finishUpdate() {
   };
   // get a str feed to the user with the result of the install run
   virtual const char* getResultStr(pkgPackageManager::OrderResult r) {
      RInstallProgress::getResultStr(r);
   };
   virtual pkgPackageManager::OrderResult start(RPackageManager *pm,
                                                int numPackages = 0,
                                                int numPackagesTotal = 0) 
   {
      return RInstallProgress::start(pm,numPackages,numPackagesTotal);
   };
};

class pkgAcquire;
class pkgAcquireStatus;
class Item;
struct ItemDesc
{
   string URI;
   string Description;
   string ShortDesc;
   Item *Owner;
};

class SwigAcquireStatus : public pkgAcquireStatus 
{
 protected:
   virtual bool Pulse(pkgAcquire *Owner) {
      pkgAcquireStatus::Pulse(Owner);
      UpdatePulse(FetchedBytes, CurrentCPS, CurrentItems);
   };
 public:
   // Called by items when they have finished a real download
   virtual void Fetched(unsigned long Size,unsigned long ResumePoint) {
      pkgAcquireStatus::Fetched(Size, ResumePoint);
   };
   
   // Called to change media
   virtual bool MediaChange(string Media,string Drive) = 0;
   
   // Each of these is called by the workers when an event occures
   virtual void IMSHit(ItemDesc &/*Itm*/) {};
   virtual void Fetch(ItemDesc &/*Itm*/) {};
   virtual void Done(ItemDesc &/*Itm*/) {};
   virtual void Fail(ItemDesc &/*Itm*/) {};
   virtual void UpdatePulse(double FetchedBytes, double CurrentCPS, unsigned long CurrentItems) {};
   virtual void Start() {
      pkgAcquireStatus::Start();
   };
   virtual void Stop() {
      pkgAcquireStatus::Stop();
   };

};