libzypp
11.13.5
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
MediaSource.h
Go to the documentation of this file.
1
/*---------------------------------------------------------------------\
2
| ____ _ __ __ ___ |
3
| |__ / \ / / . \ . \ |
4
| / / \ V /| _/ _/ |
5
| / /__ | | | | | | |
6
| /_____||_| |_| |_| |
7
| |
8
\---------------------------------------------------------------------*/
12
#ifndef ZYPP_MEDIA_MEDIASOURCE_H
13
#define ZYPP_MEDIA_MEDIASOURCE_H
14
15
#include <iosfwd>
16
17
#include "
zypp/Pathname.h
"
18
#include "
zypp/base/String.h
"
19
#include "
zypp/base/PtrTypes.h
"
20
21
22
namespace
zypp {
23
namespace
media {
24
26
29
typedef
unsigned
int
MediaAccessId
;
30
31
33
36
class
MediaSource
37
{
38
public
:
39
MediaSource
(
const
std::string &_type,
const
std::string &_name,
40
unsigned
int
_maj=0,
unsigned
int
_min=0,
41
const
std::string &_bdir=std::string(),
bool
_own=
true
)
42
:
maj_nr
(_maj)
43
,
min_nr
(_min)
44
,
type
(_type)
45
,
name
(_name)
46
,
bdir
(_bdir)
47
,
iown
(_own)
48
{}
49
50
MediaSource
()
51
:
maj_nr
(0)
52
,
min_nr
(0)
53
{}
54
55
virtual
56
~MediaSource
()
57
{}
58
62
virtual
bool
equals
(
const
MediaSource
&src)
const
63
{
64
if
(
type
== src.
type
)
65
{
66
if
(
maj_nr
== 0)
67
return
name
== src.
name
;
68
else
69
return
maj_nr
== src.
maj_nr
&&
70
min_nr
== src.
min_nr
;
71
}
72
return
false
;
73
}
74
78
virtual
std::string
asString
()
const
79
{
80
std::string tmp1;
81
if
(
maj_nr
!= 0)
82
{
83
tmp1 =
"["
+
str::numstring
(
maj_nr
) +
","
+
84
str::numstring
(
min_nr
) +
"]"
;
85
}
86
return
type
+
"<"
+
name
+ tmp1 +
">"
;
87
}
88
89
unsigned
int
maj_nr
;
90
unsigned
int
min_nr
;
91
std::string
type
;
92
std::string
name
;
93
std::string
bdir
;
94
bool
iown
;
95
};
96
98
inline
std::ostream &
operator<<
( std::ostream & str,
const
MediaSource
& obj )
99
{
return
str << obj.
asString
(); }
100
102
105
class
AttachPoint
106
{
107
public
:
108
AttachPoint
(
const
Pathname &_path=Pathname(),
109
bool
_temp=
true
)
110
:
path
(_path)
111
,
temp
(_temp)
112
{}
113
114
bool
empty
()
const
{
return
path
.empty(); }
115
116
Pathname
path
;
117
bool
temp
;
118
};
119
121
std::ostream &
operator<<
( std::ostream & str,
const
AttachPoint
& obj );
122
124
typedef
zypp::RW_pointer<MediaSource>
MediaSourceRef
;
125
typedef
zypp::RW_pointer<AttachPoint>
AttachPointRef
;
126
127
129
133
struct
AttachedMedia
134
{
135
AttachedMedia
()
136
{}
137
138
AttachedMedia
(
const
MediaSourceRef
&_mediaSource,
139
const
AttachPointRef
&_attachPoint)
140
:
mediaSource
( _mediaSource)
141
,
attachPoint
( _attachPoint)
142
{}
143
144
MediaSourceRef
mediaSource
;
145
AttachPointRef
attachPoint
;
146
};
147
149
std::ostream &
operator<<
( std::ostream & str,
const
AttachedMedia
& obj );
150
151
}
// namespace media
152
}
// namespace zypp
153
154
155
#endif // ZYPP_MEDIA_MEDIASOURCE_H
156
zypp
media
MediaSource.h
Generated by
1.8.1