00001
00002
00003
00004
00005
00006
00007
00008
00012 #ifndef ZYPP_MEDIA_MEDIASOURCE_H
00013 #define ZYPP_MEDIA_MEDIASOURCE_H
00014
00015 #include "zypp/Pathname.h"
00016 #include "zypp/base/String.h"
00017 #include "zypp/base/PtrTypes.h"
00018
00019
00020 namespace zypp {
00021 namespace media {
00022
00024
00027 typedef unsigned int MediaAccessId;
00028
00029
00031
00034 class MediaSource
00035 {
00036 public:
00037 MediaSource(const std::string &_type, const std::string &_name,
00038 unsigned int _maj=0, unsigned int _min=0,
00039 const std::string &_bdir=std::string(), bool _own=true)
00040 : maj_nr(_maj)
00041 , min_nr(_min)
00042 , type(_type)
00043 , name(_name)
00044 , bdir(_bdir)
00045 , iown(_own)
00046 {}
00047
00048 MediaSource()
00049 : maj_nr(0)
00050 , min_nr(0)
00051 {}
00052
00053 virtual
00054 ~MediaSource()
00055 {}
00056
00060 virtual bool equals(const MediaSource &src) const
00061 {
00062 if( type == src.type)
00063 {
00064 if( maj_nr == 0)
00065 return name == src.name;
00066 else
00067 return maj_nr == src.maj_nr &&
00068 min_nr == src.min_nr;
00069 }
00070 return false;
00071 }
00072
00076 virtual std::string asString() const
00077 {
00078 std::string tmp1;
00079 if(maj_nr != 0)
00080 {
00081 tmp1 = "[" + str::numstring(maj_nr) + "," +
00082 str::numstring(min_nr) + "]";
00083 }
00084 return type + "<" + name + tmp1 + ">";
00085 }
00086
00087 unsigned int maj_nr;
00088 unsigned int min_nr;
00089 std::string type;
00090 std::string name;
00091 std::string bdir;
00092 bool iown;
00093 };
00094
00095
00097
00100 class AttachPoint
00101 {
00102 public:
00103 AttachPoint(const Pathname &_path=Pathname(),
00104 bool _temp=true)
00105 : path(_path)
00106 , temp(_temp)
00107 {}
00108
00109 bool empty() const { return path.empty(); }
00110
00111 Pathname path;
00112 bool temp;
00113 };
00114
00115
00117 typedef zypp::RW_pointer<MediaSource> MediaSourceRef;
00118 typedef zypp::RW_pointer<AttachPoint> AttachPointRef;
00119
00120
00122
00126 struct AttachedMedia
00127 {
00128 AttachedMedia()
00129 {}
00130
00131 AttachedMedia(const MediaSourceRef &_mediaSource,
00132 const AttachPointRef &_attachPoint)
00133 : mediaSource( _mediaSource)
00134 , attachPoint( _attachPoint)
00135 {}
00136
00137 MediaSourceRef mediaSource;
00138 AttachPointRef attachPoint;
00139 };
00140
00141
00142 }
00143 }
00144
00145
00146 #endif // ZYPP_MEDIA_MEDIASOURCE_H
00147