libzypp  17.14.0
MediaCD.h
Go to the documentation of this file.
1 /*---------------------------------------------------------------------\
2 | ____ _ __ __ ___ |
3 | |__ / \ / / . \ . \ |
4 | / / \ V /| _/ _/ |
5 | / /__ | | | | | | |
6 | /_____||_| |_| |_| |
7 | |
8 \---------------------------------------------------------------------*/
12 #ifndef ZYPP_MEDIA_MEDIACD_H
13 #define ZYPP_MEDIA_MEDIACD_H
14 
17 
18 namespace zypp {
19  namespace media {
20 
22  //
23  // CLASS NAME : MediaCD
28  class MediaCD : public MediaHandler {
29 
30  private:
31  typedef std::list<MediaSource> DeviceList;
34 
36  int _lastdev;
38 
39  static bool openTray( const std::string & device_r );
40  static bool closeTray( const std::string & device_r );
41 
42  DeviceList detectDevices(bool supportingDVD) const;
43 
44  protected:
45 
46  virtual void attachTo (bool next = false) override;
47  virtual void releaseFrom( const std::string & ejectDev ) override;
48  virtual void getFile(const Pathname & filename, const ByteCount &expectedFileSize_r ) const override;
49  virtual void getDir( const Pathname & dirname, bool recurse_r ) const override;
50  virtual void getDirInfo( std::list<std::string> & retlist,
51  const Pathname & dirname, bool dots = true ) const override;
52  virtual void getDirInfo( filesystem::DirContent & retlist,
53  const Pathname & dirname, bool dots = true ) const override;
54  virtual bool getDoesFileExist( const Pathname & filename ) const override;
55 
56  virtual void forceEject(const std::string & ejectDev) override;
57 
58  virtual bool hasMoreDevices() override;
59 
60  virtual void
61  getDetectedDevices(std::vector<std::string> & devices,
62  unsigned int & index) const override;
63 
64  public:
65 
66  MediaCD( const Url & url_r,
67  const Pathname & attach_point_hint_r );
68 
69  virtual ~MediaCD() override { try { release(); } catch(...) {} }
70 
71  virtual bool isAttached() const override;
72  };
73 
75  } // namespace media
76 } // namespace zypp
77 #endif // ZYPP_MEDIA_MEDIACD_H