| 1 | #ifndef PKGLIB_CDROM_H |
| 2 | #define PKGLIB_CDROM_H |
| 3 | |
| 4 | #include<apt-pkg/init.h> |
| 5 | #include<string> |
| 6 | #include<vector> |
| 7 | |
| 8 | #ifdef __GNUG__ |
| 9 | #pragma interface "apt-pkg/cdrom.h" |
| 10 | #endif |
| 11 | |
| 12 | using namespace std; |
| 13 | |
| 14 | class pkgCdromStatus |
| 15 | { |
| 16 | protected: |
| 17 | int totalSteps; |
| 18 | |
| 19 | public: |
| 20 | pkgCdromStatus() {}; |
| 21 | virtual ~pkgCdromStatus() {}; |
| 22 | |
| 23 | // total steps |
| 24 | virtual void SetTotal(int total) { totalSteps = total; }; |
| 25 | // update steps, will be called regularly as a "pulse" |
| 26 | virtual void Update(string text="", int current=0) = 0; |
| 27 | |
| 28 | // ask for cdrom insert |
| 29 | virtual bool ChangeCdrom() = 0; |
| 30 | // ask for cdrom name |
| 31 | virtual bool AskCdromName(string &Name) = 0; |
| 32 | // Progress indicator for the Index rewriter |
| 33 | virtual OpProgress* GetOpProgress() {return NULL; }; |
| 34 | }; |
| 35 | |
| 36 | class pkgCdrom |
| 37 | { |
| 38 | protected: |
| 39 | enum { |
| 40 | STEP_PREPARE = 1, |
| 41 | STEP_UNMOUNT, |
| 42 | STEP_WAIT, |
| 43 | STEP_MOUNT, |
| 44 | STEP_IDENT, |
| 45 | STEP_SCAN, |
| 46 | STEP_COPY, |
| 47 | STEP_WRITE, |
| 48 | STEP_UNMOUNT3, |
| 49 | STEP_LAST |
| 50 | }; |
| 51 | |
| 52 | |
| 53 | bool FindPackages(string CD,vector<string> &List, |
| 54 | vector<string> &SList, vector<string> &SigList, |
| 55 | string &InfoDir, pkgCdromStatus *log, |
| 56 | unsigned int Depth = 0); |
| 57 | bool DropBinaryArch(vector<string> &List); |
| 58 | bool DropRepeats(vector<string> &List,const char *Name); |
| 59 | void ReduceSourcelist(string CD,vector<string> &List); |
| 60 | bool WriteDatabase(Configuration &Cnf); |
| 61 | bool WriteSourceList(string Name,vector<string> &List,bool Source); |
| 62 | int Score(string Path); |
| 63 | |
| 64 | public: |
| 65 | bool Ident(string &ident, pkgCdromStatus *log); |
| 66 | bool Add(pkgCdromStatus *log); |
| 67 | }; |
| 68 | |
| 69 | |
| 70 | |
| 71 | #endif |