cdrom.h 1.5 KB

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