Imported Upstream version 17.14.0
[platform/upstream/libzypp.git] / zypp / media / MediaDISK.h
1 /*---------------------------------------------------------------------\
2 |                          ____ _   __ __ ___                          |
3 |                         |__  / \ / / . \ . \                         |
4 |                           / / \ V /|  _/  _/                         |
5 |                          / /__ | | | | | |                           |
6 |                         /_____||_| |_| |_|                           |
7 |                                                                      |
8 \---------------------------------------------------------------------*/
9 /** \file zypp/media/MediaDISK.h
10  *
11 */
12 #ifndef ZYPP_MEDIA_MEDIADISK_H
13 #define ZYPP_MEDIA_MEDIADISK_H
14
15 #include "zypp/media/MediaHandler.h"
16
17 namespace zypp {
18   namespace media {
19
20     ///////////////////////////////////////////////////////////////////
21     //
22     //  CLASS NAME : MediaDISK
23     /**
24      * @short Implementation class for DISK MediaHandler
25      * @see MediaHandler
26      **/
27     class MediaDISK : public MediaHandler {
28
29       private:
30         std::string _device;
31         std::string _filesystem;
32
33       protected:
34
35         virtual void attachTo (bool next = false) override;
36         virtual void releaseFrom( const std::string & ejectDev ) override;
37         virtual void getFile(const Pathname & filename, const ByteCount &expectedFileSize_r ) const override;
38         virtual void getDir( const Pathname & dirname, bool recurse_r ) const override;
39         virtual void getDirInfo( std::list<std::string> & retlist,
40                                  const Pathname & dirname, bool dots = true ) const override;
41         virtual void getDirInfo( filesystem::DirContent & retlist,
42                                  const Pathname & dirname, bool dots = true ) const override;
43         virtual bool getDoesFileExist( const Pathname & filename ) const override;
44
45       public:
46
47         MediaDISK( const Url &      url_r,
48                    const Pathname & attach_point_hint_r );
49
50         virtual ~MediaDISK() override { try { release(); } catch(...) {} }
51
52         virtual bool isAttached() const override;
53
54         bool    verifyIfDiskVolume(const Pathname &name);
55     };
56
57 ///////////////////////////////////////////////////////////////////
58
59   } // namespace media
60 } // namespace zypp
61
62 #endif // ZYPP_MEDIA_MEDIADISK_H