1
// helper code for the swig generated bindings
3
#include<apt-pkg/configuration.h>
4
#include<apt-pkg/init.h>
5
#include<apt-pkg/progress.h>
6
#include "rinstallprogress.h"
10
class SwigOpProgress : public OpProgress {
12
virtual void Update() { UpdateStatus(Percent); };
14
virtual void UpdateStatus(float p) {};
15
virtual void Done() {};
19
class SwigInstallProgress : public RInstallProgress {
21
virtual void startUpdate() {
23
virtual void updateInterface() {
25
virtual void finishUpdate() {
27
// get a str feed to the user with the result of the install run
28
virtual const char* getResultStr(pkgPackageManager::OrderResult r) {
29
RInstallProgress::getResultStr(r);
31
virtual pkgPackageManager::OrderResult start(RPackageManager *pm,
33
int numPackagesTotal = 0)
35
return RInstallProgress::start(pm,numPackages,numPackagesTotal);
40
class pkgAcquireStatus;
50
class SwigAcquireStatus : public pkgAcquireStatus
53
virtual bool Pulse(pkgAcquire *Owner) {
54
pkgAcquireStatus::Pulse(Owner);
55
UpdatePulse(FetchedBytes, CurrentCPS, CurrentItems);
58
// Called by items when they have finished a real download
59
virtual void Fetched(unsigned long Size,unsigned long ResumePoint) {
60
pkgAcquireStatus::Fetched(Size, ResumePoint);
63
// Called to change media
64
virtual bool MediaChange(string Media,string Drive) = 0;
66
// Each of these is called by the workers when an event occures
67
virtual void IMSHit(ItemDesc &/*Itm*/) {};
68
virtual void Fetch(ItemDesc &/*Itm*/) {};
69
virtual void Done(ItemDesc &/*Itm*/) {};
70
virtual void Fail(ItemDesc &/*Itm*/) {};
71
virtual void UpdatePulse(double FetchedBytes, double CurrentCPS, unsigned long CurrentItems) {};
72
virtual void Start() {
73
pkgAcquireStatus::Start();
76
pkgAcquireStatus::Stop();