libzypp  10.5.0
MediaCD.h
Go to the documentation of this file.
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         typedef std::list<MediaSource> DeviceList;
00033         mutable DeviceList _devices;
00034 
00036         int        _lastdev;
00037         int        _lastdev_tried;
00038 
00039         static bool openTray( const std::string & device_r );
00040         static bool closeTray( const std::string & device_r );
00041 
00042         DeviceList  detectDevices(bool supportingDVD) const;
00043 
00044       protected:
00045 
00046         virtual void attachTo (bool next = false);
00047         virtual void releaseFrom( const std::string & ejectDev );
00048         virtual void getFile( const Pathname & filename ) const;
00049         virtual void getDir( const Pathname & dirname, bool recurse_r ) const;
00050         virtual void getDirInfo( std::list<std::string> & retlist,
00051                                  const Pathname & dirname, bool dots = true ) const;
00052         virtual void getDirInfo( filesystem::DirContent & retlist,
00053                                  const Pathname & dirname, bool dots = true ) const;
00054         virtual bool getDoesFileExist( const Pathname & filename ) const;
00055 
00056         virtual void forceEject(const std::string & ejectDev);
00057 
00058         virtual bool hasMoreDevices();
00059 
00060         virtual void
00061         getDetectedDevices(std::vector<std::string> & devices,
00062                            unsigned int & index) const;
00063 
00064       public:
00065 
00066         MediaCD( const Url &      url_r,
00067                  const Pathname & attach_point_hint_r );
00068 
00069         virtual ~MediaCD() { try { release(); } catch(...) {} }
00070 
00071         virtual bool isAttached() const;
00072     };
00073 
00075   } // namespace media
00076 } // namespace zypp
00077 #endif // ZYPP_MEDIA_MEDIACD_H