apt: apt-pkg/cdrom.h Source File

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