libzypp
11.13.5
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
ResObject.cc
Go to the documentation of this file.
1
/*---------------------------------------------------------------------\
2
| ____ _ __ __ ___ |
3
| |__ / \ / / . \ . \ |
4
| / / \ V /| _/ _/ |
5
| / /__ | | | | | | |
6
| /_____||_| |_| |_| |
7
| |
8
\---------------------------------------------------------------------*/
13
#include "
zypp/ResObject.h
"
14
#include "
zypp/sat/SolvAttr.h
"
15
#include "
zypp/sat/Solvable.h
"
16
#include "
zypp/Repository.h
"
17
#include "
zypp/RepoInfo.h
"
18
#include "
zypp/IdString.h
"
19
20
using namespace
zypp;
21
using namespace
std;
22
24
namespace
zypp
25
{
26
27
IMPL_PTR_TYPE
(
ResObject
);
28
30
//
31
// METHOD NAME : ResObject::ResObject
32
// METHOD TYPE : Ctor
33
//
34
ResObject::ResObject
(
const
sat::Solvable
& solvable_r )
35
:
Resolvable
( solvable_r )
36
{}
37
39
//
40
// METHOD NAME : ResObject::~ResObject
41
// METHOD TYPE : Dtor
42
//
43
ResObject::~ResObject
()
44
{}
45
47
//
48
// METHOD NAME : ResObject::dumpOn
49
// METHOD TYPE : std::ostream &
50
//
51
std::ostream &
ResObject::dumpOn
( std::ostream & str )
const
52
{
53
return
Resolvable::dumpOn
( str );
54
}
55
57
58
std::string
ResObject::summary
(
const
Locale
& lang_r )
const
59
{
return
lookupStrAttribute
(
sat::SolvAttr::summary
, lang_r ); }
60
61
std::string
ResObject::description
(
const
Locale
& lang_r )
const
62
{
return
lookupStrAttribute
(
sat::SolvAttr::description
, lang_r ); }
63
64
std::string
ResObject::insnotify
(
const
Locale
& lang_r )
const
65
{
return
lookupStrAttribute
(
sat::SolvAttr::insnotify
, lang_r ); }
66
67
std::string
ResObject::delnotify
(
const
Locale
& lang_r )
const
68
{
return
lookupStrAttribute
(
sat::SolvAttr::delnotify
, lang_r ); }
69
70
std::string
ResObject::licenseToConfirm
(
const
Locale
& lang_r )
const
71
{
72
std::string ret =
lookupStrAttribute
(
sat::SolvAttr::eula
, lang_r );
73
if
( ret.empty() && isKind<Product>() )
74
return
repoInfo
().
getLicense
( lang_r );
75
return
ret;
76
}
77
78
std::string
ResObject::distribution
()
const
79
{
return
lookupStrAttribute
(
sat::SolvAttr::distribution
); }
80
81
std::string
ResObject::cpeId
()
const
82
{
return
lookupStrAttribute
(
sat::SolvAttr::cpeid
); }
83
84
ByteCount
ResObject::installSize
()
const
85
{
return
ByteCount
(
lookupNumAttribute
(
sat::SolvAttr::installsize
) ); }
86
87
ByteCount
ResObject::downloadSize
()
const
88
{
return
ByteCount
(
lookupNumAttribute
(
sat::SolvAttr::downloadsize
) ); }
89
90
unsigned
ResObject::mediaNr
()
const
91
{
return
lookupNumAttribute
(
sat::SolvAttr::medianr
); }
92
93
Date
ResObject::buildtime
()
const
94
{
return
Date
(
lookupNumAttribute
(
sat::SolvAttr::buildtime
) ); }
95
96
Date
ResObject::installtime
()
const
97
{
return
Date
(
lookupNumAttribute
(
sat::SolvAttr::installtime
) ); }
98
99
#warning DUMMY diskusage
100
const
DiskUsage
&
ResObject::diskusage
()
const
101
{
102
static
DiskUsage
_du;
103
return
_du;
104
}
105
107
}
// namespace zypp
109
110
#include "
zypp/ResObjects.h
"
111
113
namespace
zypp
114
{
115
116
ResObject::Ptr
makeResObject
(
const
sat::Solvable
& solvable_r )
117
{
118
if
( ! solvable_r )
119
return
0;
120
121
ResKind
kind( solvable_r.
kind
() );
122
#define OUTS(X) if ( kind == ResTraits<X>::kind ) return make<X>( solvable_r );
123
OUTS
(
Package
);
124
OUTS(
Patch
);
125
OUTS(
Pattern
);
126
OUTS(
Product
);
127
OUTS(
SrcPackage
);
128
#undef OUTS
129
// unknow => return a plain ResObject
130
return
new
ResObject
( solvable_r );
131
}
132
134
}
// namespace zypp
zypp
ResObject.cc
Generated by
1.8.1