00001 /*---------------------------------------------------------------------\ 00002 | ____ _ __ __ ___ | 00003 | |__ / \ / / . \ . \ | 00004 | / / \ V /| _/ _/ | 00005 | / /__ | | | | | | | 00006 | /_____||_| |_| |_| | 00007 | | 00008 \---------------------------------------------------------------------*/ 00012 #ifndef ZYPP_MEDIA_MEDIACD_H 00013 #define ZYPP_MEDIA_MEDIACD_H 00014 00015 #include "zypp/media/MediaHandler.h" 00016 #include "zypp/media/MediaManager.h" 00017 00018 namespace zypp { 00019 namespace media { 00020 00022 // 00023 // CLASS NAME : MediaCD 00028 class MediaCD : public MediaHandler { 00029 00030 private: 00031 00032 typedef std::list<MediaSource> DeviceList; 00034 DeviceList _devices; 00035 00037 int _lastdev; 00038 int _lastdev_tried; 00039 00040 static bool openTray( const std::string & device_r ); 00041 static bool closeTray( const std::string & device_r ); 00042 00043 DeviceList detectDevices(bool supportingDVD); 00044 00045 protected: 00046 00047 virtual void attachTo (bool next = false); 00048 virtual void releaseFrom( bool eject ); 00049 virtual void getFile( const Pathname & filename ) const; 00050 virtual void getDir( const Pathname & dirname, bool recurse_r ) const; 00051 virtual void getDirInfo( std::list<std::string> & retlist, 00052 const Pathname & dirname, bool dots = true ) const; 00053 virtual void getDirInfo( filesystem::DirContent & retlist, 00054 const Pathname & dirname, bool dots = true ) const; 00055 virtual bool getDoesFileExist( const Pathname & filename ) const; 00056 00057 virtual void forceEject(); 00058 00059 virtual bool isAutoMountedMedia(const AttachedMedia &media); 00060 00061 virtual bool hasMoreDevices(); 00062 00063 public: 00064 00065 MediaCD( const Url & url_r, 00066 const Pathname & attach_point_hint_r ); 00067 00068 virtual ~MediaCD() { try { release(); } catch(...) {} } 00069 00070 virtual bool isAttached() const; 00071 }; 00072 00074 } // namespace media 00075 } // namespace zypp 00076 #endif // ZYPP_MEDIA_MEDIACD_H
1.5.3