libzypp  17.31.31
MediaNetwork.h
Go to the documentation of this file.
1 /*---------------------------------------------------------------------\
2 | ____ _ __ __ ___ |
3 | |__ / \ / / . \ . \ |
4 | / / \ V /| _/ _/ |
5 | / /__ | | | | | | |
6 | /_____||_| |_| |_| |
7 | |
8 \---------------------------------------------------------------------*/
12 #ifndef ZYPP_MEDIA_MEDIANETWORK_H
13 #define ZYPP_MEDIA_MEDIANETWORK_H
14 
15 #include <zypp/base/Flags.h>
16 #include <zypp/ZYppCallbacks.h>
18 
19 namespace internal {
20  struct SharedData;
21 }
22 
23 namespace zyppng {
24  class DownloadSpec;
25 }
26 
27 namespace zypp {
28  namespace media {
29  //
30  // CLASS NAME : MediaNetwork
36  {
37  protected:
38 
39  void attachTo (bool next = false) override;
40  void releaseFrom( const std::string & ejectDev ) override;
41  void getFile( const OnMediaLocation & file ) const override;
42  void getFileCopy( const OnMediaLocation & file, const Pathname & targetFilename ) const override;
43  void getDir( const Pathname & dirname, bool recurse_r ) const override;
44  void getDirInfo( std::list<std::string> & retlist,
45  const Pathname & dirname, bool dots = true ) const override;
46  void getDirInfo( filesystem::DirContent & retlist,
47  const Pathname & dirname, bool dots = true ) const override;
53  void disconnectFrom() override;
54 
60  bool getDoesFileExist( const Pathname & filename ) const override;
61 
62  bool checkAttachPoint(const Pathname &apoint) const override;
63 
64 
65  public:
66 
67  MediaNetwork( const Url & url_r,
68  const Pathname & attach_point_hint_r );
69 
70  ~MediaNetwork() override { try { release(); } catch(...) {} }
71 
72  private:
73 
74  void runRequest ( const zyppng::DownloadSpec &spec, callback::SendReport<DownloadProgressReport> *report = nullptr ) const;
75 
76  private:
77  mutable std::shared_ptr<::internal::SharedData> _shared;
78  };
79 
80  } // namespace media
81 } // namespace zypp
82 
83 #endif // ZYPP_MEDIA_MEDIANETWORK_H
Describes a resource file located on a medium.
bool getDoesFileExist(const Pathname &filename) const override
void getDirInfo(std::list< std::string > &retlist, const Pathname &dirname, bool dots=true) const override
Call concrete handler to provide a content list of directory on media via retlist.
void disconnectFrom() override
bool checkAttachPoint(const Pathname &apoint) const override
Verify if the specified directory as attach point (root) as requires by the particular media handler ...
std::shared_ptr<::internal::SharedData > _shared
Definition: MediaNetwork.h:77
std::list< DirEntry > DirContent
Returned by readdir.
Definition: PathInfo.h:518
void attachTo(bool next=false) override
Call concrete handler to attach the media.
Common baseclass for MediaCurl and MediaNetwork.
void getFileCopy(const OnMediaLocation &file, const Pathname &targetFilename) const override
Call concrete handler to provide a file under a different place in the file system (usually not under...
MediaNetwork(const Url &url_r, const Pathname &attach_point_hint_r)
Implementation class for FTP, HTTP and HTTPS MediaHandler.
Definition: MediaNetwork.h:35
void getFile(const OnMediaLocation &file) const override
Call concrete handler to provide file below attach point.
void runRequest(const zyppng::DownloadSpec &spec, callback::SendReport< DownloadProgressReport > *report=nullptr) const
Easy-to use interface to the ZYPP dependency resolver.
Definition: CodePitfalls.doc:1
void release(const std::string &ejectDev="")
Use concrete handler to release the media.
void releaseFrom(const std::string &ejectDev) override
Call concrete handler to release the media.
void getDir(const Pathname &dirname, bool recurse_r) const override
Call concrete handler to provide directory content (not recursive!) below attach point.
Url manipulation class.
Definition: Url.h:91