libzypp  13.10.6
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);
47  virtual void releaseFrom( const std::string & ejectDev );
48  virtual void getFile( const Pathname & filename ) const;
49  virtual void getDir( const Pathname & dirname, bool recurse_r ) const;
50  virtual void getDirInfo( std::list<std::string> & retlist,
51  const Pathname & dirname, bool dots = true ) const;
52  virtual void getDirInfo( filesystem::DirContent & retlist,
53  const Pathname & dirname, bool dots = true ) const;
54  virtual bool getDoesFileExist( const Pathname & filename ) const;
55 
56  virtual void forceEject(const std::string & ejectDev);
57 
58  virtual bool hasMoreDevices();
59 
60  virtual void
61  getDetectedDevices(std::vector<std::string> & devices,
62  unsigned int & index) const;
63 
64  public:
65 
66  MediaCD( const Url & url_r,
67  const Pathname & attach_point_hint_r );
68 
69  virtual ~MediaCD() { try { release(); } catch(...) {} }
70 
71  virtual bool isAttached() const;
72  };
73 
75  } // namespace media
76 } // namespace zypp
77 #endif // ZYPP_MEDIA_MEDIACD_H
virtual void forceEject(const std::string &ejectDev)
Call concrete handler to physically eject the media (i.e.
Definition: MediaCD.cc:658
virtual void getFile(const Pathname &filename) const
Call concrete handler to provide file below attach point.
Definition: MediaCD.cc:723
Implementation class for CD/DVD MediaHandler.
Definition: MediaCD.h:28
virtual bool isAttached() const
True if media is attached.
Definition: MediaCD.cc:711
MediaCD(const Url &url_r, const Pathname &attach_point_hint_r)
Definition: MediaCD.cc:203
virtual void getDetectedDevices(std::vector< std::string > &devices, unsigned int &index) const
Fill in a vector of detected ejectable devices and the index of the currently attached device within ...
Definition: MediaCD.cc:785
std::list< MediaSource > DeviceList
Definition: MediaCD.h:31
virtual void getDirInfo(std::list< std::string > &retlist, const Pathname &dirname, bool dots=true) const
Call concrete handler to provide a content list of directory on media via retlist.
Definition: MediaCD.cc:748
virtual void attachTo(bool next=false)
Call concrete handler to attach the media.
Definition: MediaCD.cc:403
static bool openTray(const std::string &device_r)
Definition: MediaCD.cc:250
virtual void releaseFrom(const std::string &ejectDev)
Call concrete handler to release the media.
Definition: MediaCD.cc:616
Abstract base class for &#39;physical&#39; MediaHandler like MediaCD, etc.
Definition: MediaHandler.h:45
virtual bool hasMoreDevices()
Check if the media has one more device available for attach(true).
Definition: MediaCD.cc:774
std::list< DirEntry > DirContent
Returned by readdir.
Definition: PathInfo.h:544
DeviceList _devices
list of devices to try to mount
Definition: MediaCD.h:33
virtual void getDir(const Pathname &dirname, bool recurse_r) const
Call concrete handler to provide directory content (not recursive!) below attach point.
Definition: MediaCD.cc:735
DeviceList detectDevices(bool supportingDVD) const
Definition: MediaCD.cc:327
virtual ~MediaCD()
Definition: MediaCD.h:69
virtual bool getDoesFileExist(const Pathname &filename) const
check if a file exists
Definition: MediaCD.cc:768
int _lastdev
number of last successful mounted device in list
Definition: MediaCD.h:36
void release(const std::string &ejectDev="")
Use concrete handler to release the media.
Url manipulation class.
Definition: Url.h:87
static bool closeTray(const std::string &device_r)
Definition: MediaCD.cc:309