apt 3.0.3
commandline package manager
cdrom.h
1#ifndef PKGLIB_CDROM_H
2#define PKGLIB_CDROM_H
3
4#include <apt-pkg/macros.h>
5
6#include <string>
7#include <vector>
8
9#include <cstddef>
10
11class Configuration;
12class OpProgress;
13
14class APT_PUBLIC pkgCdromStatus /*{{{*/
15{
16 void * const d;
17 protected:
18 int totalSteps;
19
20 public:
22 virtual ~pkgCdromStatus();
23
24 // total steps
25 virtual void SetTotal(int total) { totalSteps = total; };
26 // update steps, will be called regularly as a "pulse"
27 virtual void Update(std::string text="", int current=0) = 0;
28
29 // ask for cdrom insert
30 virtual bool ChangeCdrom() = 0;
31 // ask for cdrom name
32 virtual bool AskCdromName(std::string &Name) = 0;
33 // Progress indicator for the Index rewriter
34 virtual OpProgress* GetOpProgress() {return NULL; };
35};
36 /*}}}*/
37class APT_PUBLIC pkgCdrom /*{{{*/
38{
39 protected:
40 enum {
41 STEP_PREPARE = 1,
42 STEP_UNMOUNT,
43 STEP_WAIT,
44 STEP_MOUNT,
45 STEP_IDENT,
46 STEP_SCAN,
47 STEP_COPY,
48 STEP_WRITE,
49 STEP_UNMOUNT3,
50 STEP_LAST
51 };
52
53
54 bool FindPackages(std::string CD,
55 std::vector<std::string> &List,
56 std::vector<std::string> &SList,
57 std::vector<std::string> &SigList,
58 std::vector<std::string> &TransList,
59 std::string &InfoDir, pkgCdromStatus *log,
60 unsigned int Depth = 0);
61 bool DropBinaryArch(std::vector<std::string> &List);
62 bool DropRepeats(std::vector<std::string> &List,const char *Name);
63 bool DropTranslation(std::vector<std::string> &List);
64 void ReduceSourcelist(std::string CD,std::vector<std::string> &List);
65 bool WriteDatabase(Configuration &Cnf);
66 bool WriteSourceList(std::string Name,std::vector<std::string> &List,bool Source);
67 int Score(std::string Path);
68
69 public:
70 bool Ident(std::string &ident, pkgCdromStatus *log);
71 bool Add(pkgCdromStatus *log);
72
73 pkgCdrom();
74 virtual ~pkgCdrom();
75
76 private:
77 void * const d;
78
79 APT_HIDDEN bool MountAndIdentCDROM(Configuration &Database, std::string &CDROM,
80 std::string &ident, pkgCdromStatus * const log, bool const interactive);
81 APT_HIDDEN bool UnmountCDROM(std::string const &CDROM, pkgCdromStatus * const log);
82};
83 /*}}}*/
84
85
86// class that uses libudev to find cdrom/removable devices dynamically
87struct APT_PUBLIC CdromDevice /*{{{*/
88{
89 std::string DeviceName;
90 bool Mounted;
91 std::string MountPath;
92};
93 /*}}}*/
94class APT_PUBLIC pkgUdevCdromDevices /*{{{*/
95{
96 void * const d;
97 public:
99 virtual ~pkgUdevCdromDevices();
100
101 // convenience interface, this will just call ScanForRemovable
102 // with "APT::cdrom::CdromOnly"
103 std::vector<CdromDevice> Scan();
104
105 std::vector<CdromDevice> ScanForRemovable(bool CdromOnly);
106};
107 /*}}}*/
108
109#endif
Definition configuration.h:41
Definition progress.h:30
Definition cdrom.h:15
Definition cdrom.h:38
Definition cdrom.h:95
Definition cdrom.h:88