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())
00040 : maj_nr(_maj)
00041 , min_nr(_min)
00042 , type(_type)
00043 , name(_name)
00044 , bdir(_bdir)
00045 {}
00046
00047 MediaSource()
00048 : maj_nr(0)
00049 , min_nr(0)
00050 {}
00051
00052 virtual
00053 ~MediaSource()
00054 {}
00055
00059 virtual bool equals(const MediaSource &src) const
00060 {
00061 if( type == src.type)
00062 {
00063 if( maj_nr == 0)
00064 return name == src.name;
00065 else
00066 return maj_nr == src.maj_nr &&
00067 min_nr == src.min_nr;
00068 }
00069 return false;
00070 }
00071
00075 virtual std::string asString() const
00076 {
00077 std::string tmp1;
00078 if(maj_nr != 0)
00079 {
00080 tmp1 = "[" + str::numstring(maj_nr) + "," +
00081 str::numstring(min_nr) + "]";
00082 }
00083 return type + "<" + name + tmp1 + ">";
00084 }
00085
00086 unsigned int maj_nr;
00087 unsigned int min_nr;
00088 std::string type;
00089 std::string name;
00090 std::string bdir;
00091 };
00092
00093
00095
00098 class AttachPoint
00099 {
00100 public:
00101 AttachPoint(const Pathname &_path=Pathname(),
00102 bool _temp=true)
00103 : path(_path)
00104 , temp(_temp)
00105 {}
00106
00107 bool empty() const { return path.empty(); }
00108
00109 Pathname path;
00110 bool temp;
00111 };
00112
00113
00115 typedef zypp::RW_pointer<MediaSource> MediaSourceRef;
00116 typedef zypp::RW_pointer<AttachPoint> AttachPointRef;
00117
00118
00120
00124 struct AttachedMedia
00125 {
00126 AttachedMedia()
00127 {}
00128
00129 AttachedMedia(const MediaSourceRef &_mediaSource,
00130 const AttachPointRef &_attachPoint)
00131 : mediaSource( _mediaSource)
00132 , attachPoint( _attachPoint)
00133 {}
00134
00135 MediaSourceRef mediaSource;
00136 AttachPointRef attachPoint;
00137 };
00138
00139
00140 }
00141 }
00142
00143
00144 #endif // ZYPP_MEDIA_MEDIASOURCE_H
00145