libzypp 17.37.10

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
15#include <zypp/media/MediaHandler.h>
16#include <zypp/media/MediaManager.h>
17
18 namespace zypp {
19 namespace media {
20
22 //
23 // CLASS NAME : MediaCD
28 class MediaCD : public MediaHandler {
29
30 private:
31 using DeviceList = std::list<MediaSource>;
33 mutable DeviceList _devices;
34
36 int _lastdev;
37 int _lastdev_tried;
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 void attachTo (bool next = false) override;
47 void releaseFrom( const std::string & ejectDev ) override;
48 void getFile(const OnMediaLocation & file) const override;
49 void getDir( const Pathname & dirname, bool recurse_r ) const override;
50 void getDirInfo( std::list<std::string> & retlist,
51 const Pathname & dirname, bool dots = true ) const override;
52 void getDirInfo( filesystem::DirContent & retlist,
53 const Pathname & dirname, bool dots = true ) const override;
54 bool getDoesFileExist( const Pathname & filename ) const override;
55
56 void forceEject(const std::string & ejectDev) override;
57
58 bool hasMoreDevices() override;
59
60 void
61 getDetectedDevices(std::vector<std::string> & devices,
62 unsigned int & index) const override;
63
64 public:
65
66 MediaCD(MirroredOrigin origin_r,
67 const Pathname & attach_point_hint_r );
68
69 ~MediaCD() override { try { release(); } catch(...) {} }
70
71 bool isAttached() const override;
72 };
73
75 } // namespace media
76} // namespace zypp
77#endif // ZYPP_MEDIA_MEDIACD_H
MediaHandler.h
MediaManager.h
zypp::MirroredOrigin
Manages a data source characterized by an authoritative URL and a list of mirror URLs.
Definition MirroredOrigin.h:170
zypp::OnMediaLocation
Describes a resource file located on a medium.
Definition onmedialocation.h:37
zypp::filesystem::Pathname
Pathname.
Definition Pathname.h:47
zypp::media::MediaCD::~MediaCD
~MediaCD() override
Definition MediaCD.h:69
zypp::media::MediaCD::closeTray
static bool closeTray(const std::string &device_r)
Definition MediaCD.cc:189
zypp::media::MediaCD::isAttached
bool isAttached() const override
True if media is attached.
Definition MediaCD.cc:581
zypp::media::MediaCD::MediaCD
MediaCD(MirroredOrigin origin_r, const Pathname &attach_point_hint_r)
Definition MediaCD.cc:130
zypp::media::MediaCD::forceEject
void forceEject(const std::string &ejectDev) override
Call concrete handler to physically eject the media (i.e.
Definition MediaCD.cc:524
zypp::media::MediaCD::getDirInfo
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.
Definition MediaCD.cc:618
zypp::media::MediaCD::getDetectedDevices
void getDetectedDevices(std::vector< std::string > &devices, unsigned int &index) const override
Fill in a vector of detected ejectable devices and the index of the currently attached device within ...
Definition MediaCD.cc:655
zypp::media::MediaCD::_lastdev_tried
int _lastdev_tried
Definition MediaCD.h:37
zypp::media::MediaCD::getFile
void getFile(const OnMediaLocation &file) const override
Call concrete handler to provide file below attach point.
Definition MediaCD.cc:593
zypp::media::MediaCD::getDir
void getDir(const Pathname &dirname, bool recurse_r) const override
Call concrete handler to provide directory content (not recursive!) below attach point.
Definition MediaCD.cc:605
zypp::media::MediaCD::releaseFrom
void releaseFrom(const std::string &ejectDev) override
Call concrete handler to release the media.
Definition MediaCD.cc:482
zypp::media::MediaCD::getDoesFileExist
bool getDoesFileExist(const Pathname &filename) const override
check if a file exists
Definition MediaCD.cc:638
zypp::media::MediaCD::DeviceList
std::list< MediaSource > DeviceList
Definition MediaCD.h:31
zypp::media::MediaCD::_lastdev
int _lastdev
number of last successful mounted device in list
Definition MediaCD.h:36
zypp::media::MediaCD::openTray
static bool openTray(const std::string &device_r)
Definition MediaCD.cc:178
zypp::media::MediaCD::detectDevices
DeviceList detectDevices(bool supportingDVD) const
Definition MediaCD.cc:195
zypp::media::MediaCD::hasMoreDevices
bool hasMoreDevices() override
Check if the media has one more device available for attach(true).
Definition MediaCD.cc:644
zypp::media::MediaCD::_devices
DeviceList _devices
list of devices to try to mount
Definition MediaCD.h:33
zypp::media::MediaCD::attachTo
void attachTo(bool next=false) override
Call concrete handler to attach the media.
Definition MediaCD.cc:271
zypp::media::MediaHandler::MediaHandler
MediaHandler(MirroredOrigin origin_r, const Pathname &attach_point_r, Pathname urlpath_below_attachpoint_r, const bool does_download_r)
If the concrete media handler provides a nonempty attach_point, it must be an existing directory.
Definition MediaHandler.cc:55
zypp::media::MediaHandler::release
void release(const std::string &ejectDev="")
Use concrete handler to release the media.
Definition MediaHandler.cc:704
zypp::filesystem::DirContent
std::list< DirEntry > DirContent
Returned by readdir.
Definition PathInfo.h:526
zypp::media
Definition MediaNetworkRequestExecutor.h:22
zypp
Easy-to use interface to the ZYPP dependency resolver.
Definition Application.cc:20