Moved DiskUsage class out of PackageImplIf
[platform/upstream/libzypp.git] / zypp / target / rpm / RpmPackageImpl.cc
1 /*---------------------------------------------------------------------\
2 |                          ____ _   __ __ ___                          |
3 |                         |__  / \ / / . \ . \                         |
4 |                           / / \ V /|  _/  _/                         |
5 |                          / /__ | | | | | |                           |
6 |                         /_____||_| |_| |_|                           |
7 |                                                                      |
8 \---------------------------------------------------------------------*/
9 /** \file zypp/target/rpm/RPMPackageImpl.cc
10  *
11 */
12
13 #include "zypp/target/rpm/RpmPackageImpl.h"
14 #include "zypp/base/String.h"
15 #include "zypp/base/Logger.h"
16
17 #include <list>
18 #include <string>
19
20 using namespace std;
21 using namespace zypp::detail;
22
23 ///////////////////////////////////////////////////////////////////
24 namespace zypp
25 { /////////////////////////////////////////////////////////////////
26   ///////////////////////////////////////////////////////////////////
27   namespace target
28   { /////////////////////////////////////////////////////////////////
29     namespace rpm
30     {
31       ///////////////////////////////////////////////////////////////////
32       //
33       //        CLASS NAME : RPMPackageImpl
34       //
35       ///////////////////////////////////////////////////////////////////
36
37
38       RPMPackageImpl::RPMPackageImpl(
39         const RpmHeader::constPtr data
40       )
41       : _summary(data->tag_summary()),
42         _description(),
43         _buildtime(data->tag_buildtime()),
44         _buildhost(data->tag_buildhost()),
45         _url(data->tag_url()),
46         _vendor(data->tag_vendor()),
47         _license(data->tag_license()),
48         _packager(data->tag_packager()),
49         _group(data->tag_group()),
50         _changelog(data->tag_changelog()),
51         _type("rpm"), // FIXME in the future
52 //      _authors(data->authors),
53 //      _keywords(data->keywords),
54         _filenames(data->tag_filenames())
55 #if 0
56       : _size_package( strtol(parsed.sizePackage.c_str(), 0, 10)),
57         _size_archive( strtol(parsed.sizeArchive.c_str(), 0, 10)),
58         _size_installed( strtol(parsed.sizeInstalled.c_str(), 0, 10)),
59         _sourcepkg( parsed.sourcerpm),
60         _dir_sizes(parsed.dirSizes),
61 #endif
62       {
63         _description.push_back(data->tag_description());
64         data->tag_du(_disk_usage);
65       }
66
67
68       /** Package summary */
69       Label RPMPackageImpl::summary() const
70       { return _summary; }
71
72       /** Package description */
73       Text RPMPackageImpl::description() const
74       { return _description; }
75
76       Text RPMPackageImpl::insnotify() const
77       // metadata doesn't priovide this attribute
78       { return ResObjectImplIf::insnotify(); }
79
80       Text RPMPackageImpl::delnotify() const
81       // metadata doesn't priovide this attribute
82       { return ResObjectImplIf::delnotify(); }
83
84       ByteCount RPMPackageImpl::size() const
85       { }
86
87       bool RPMPackageImpl::providesSources() const
88       { return ResObjectImplIf::providesSources(); }
89
90       Label RPMPackageImpl::instSrcLabel() const
91       { return ResObjectImplIf::instSrcLabel(); }
92       
93       Vendor RPMPackageImpl::instSrcVendor() const
94       { return ResObjectImplIf::instSrcVendor(); }
95       
96       /** */
97       Date RPMPackageImpl::buildtime() const
98       { return _buildtime; }
99
100       /** */
101       std::string RPMPackageImpl::buildhost() const
102       { return _buildhost; }
103
104       /** */
105       Date RPMPackageImpl::installtime() const
106       { return PackageImplIf::installtime(); }
107
108       /** */
109       std::string RPMPackageImpl::distribution() const
110       { }
111
112       /** */
113       Vendor RPMPackageImpl::vendor() const
114       { return _vendor; }
115
116       /** */
117       Label RPMPackageImpl::license() const
118       { return _license; }
119
120       /** */
121       std::string RPMPackageImpl::packager() const
122       { return _packager; }
123
124       /** */
125       PackageGroup RPMPackageImpl::group() const
126       { return _group; }
127
128       /** */
129       Changelog RPMPackageImpl::changelog() const
130       { return _changelog; }
131
132       /** Don't ship it as class Url, because it might be
133        * in fact anything but a legal Url. */
134       std::string RPMPackageImpl::url() const
135       { return _url; }
136
137       /** */
138       std::string RPMPackageImpl::os() const
139       // metadata doesn't priovide this attribute
140       { return PackageImplIf::os(); }
141
142       /** */
143       Text RPMPackageImpl::prein() const
144       // metadata doesn't priovide this attribute
145       { return PackageImplIf::prein(); }
146
147       /** */
148       Text RPMPackageImpl::postin() const
149       // metadata doesn't priovide this attribute
150       { return PackageImplIf::postin(); }
151
152       /** */
153       Text RPMPackageImpl::preun() const
154       // metadata doesn't priovide this attribute
155       { return PackageImplIf::preun(); }
156
157       /** */
158       Text RPMPackageImpl::postun() const
159       // metadata doesn't priovide this attribute
160       { return PackageImplIf::postun(); }
161
162       /** */
163       ByteCount RPMPackageImpl::sourcesize() const
164       { }
165
166       /** */
167       ByteCount RPMPackageImpl::archivesize() const
168       { }
169
170       /** */
171       Text RPMPackageImpl::authors() const
172       { return _authors; }
173
174       /** */
175       Text RPMPackageImpl::filenames() const
176       { return _filenames; }
177
178       License RPMPackageImpl::licenseToConfirm() const
179       { return _license_to_confirm; }
180
181       /** */
182       std::string RPMPackageImpl::type() const
183       { return _type; }
184
185       /** */
186       std::list<std::string> RPMPackageImpl::keywords() const
187       { return _keywords; }
188
189       /** */
190       DiskUsage RPMPackageImpl::diskUsage() const
191       { return _disk_usage; }
192 #if 0
193       /** */
194       std::list<std::string> RPMPackageImpl::insnotify() const
195       { return std::list<std::string>(); }
196       /** */
197       std::list<std::string> RPMPackageImpl::delnotify() const
198       { return std::list<std::string>(); }
199       /** */
200       unsigned RPMPackageImpl::packageSize() const
201       { return _size_package; }
202       /** */
203       unsigned RPMPackageImpl::archiveSize() const
204       { return _size_archive; }
205       /** */
206       unsigned RPMPackageImpl::installedSize() const
207       { return _size_installed; }
208 // FIXME do not understand items below
209       /** */
210       bool RPMPackageImpl::providesSources() const
211       {
212         return false;
213       }
214       /** */
215       std::string RPMPackageImpl::instSrcLabel() const
216       {
217         return "";
218       }
219       /** */
220       std::string RPMPackageImpl::instSrcVendor() const
221       {
222         return "";
223       }
224       /** */
225       unsigned RPMPackageImpl::instSrcRank() const
226       {
227         return 0;
228       }
229       /** */
230       std::string RPMPackageImpl::buildhost() const
231       {
232         return _buildhost;
233       }
234       /** */
235       std::string RPMPackageImpl::distribution() const
236       {
237         return "";
238       }
239       /** */
240       std::string RPMPackageImpl::vendor() const
241       {
242         return _vendor;
243       }
244       /** */
245       std::string RPMPackageImpl::license() const
246       {
247         return _license;
248       }
249       /** */
250       std::list<std::string> RPMPackageImpl::licenseToConfirm() const
251       {
252         return std::list<std::string>();
253       }
254       /** */
255       std::string RPMPackageImpl::packager() const
256       {
257         return _packager;
258       }
259       /** */
260       std::string RPMPackageImpl::group() const
261       {
262         return _group;
263       }
264       /** */
265       std::list<std::string> RPMPackageImpl::changelog() const
266       {}
267       /** */
268       std::string RPMPackageImpl::url() const
269       {
270         return _url;
271       }
272       /** */
273       std::string RPMPackageImpl::os() const
274       {}
275       /** */
276       std::list<std::string> RPMPackageImpl::prein() const
277       {}
278       /** */
279       std::list<std::string> RPMPackageImpl::postin() const
280       {}
281       /** */
282       std::list<std::string> RPMPackageImpl::preun() const
283       {}
284       /** */
285       std::list<std::string> RPMPackageImpl::postun() const
286       {}
287       /** */
288       std::string RPMPackageImpl::sourcepkg() const
289       { return _sourcepkg; }
290       /** */
291       std::list<std::string> RPMPackageImpl::authors() const
292       { return _authors; }
293       /** */
294       std::list<std::string> RPMPackageImpl::filenames() const
295       {}
296       /** */
297       std::list<std::string> RPMPackageImpl::recommends() const
298       {}
299       /** */
300       std::list<std::string> RPMPackageImpl::suggests() const
301       {}
302       /** */
303       std::string RPMPackageImpl::location() const
304       {}
305       /** */
306       std::string RPMPackageImpl::md5sum() const
307       {}
308       /** */
309       std::string RPMPackageImpl::externalUrl() const
310       {}
311       /** */
312       std::list<Edition> RPMPackageImpl::patchRpmBaseVersions() const
313       {}
314       /** */
315       unsigned RPMPackageImpl::patchRpmSize() const
316       {}
317       /** */
318       bool RPMPackageImpl::forceInstall() const
319       {}
320       /** */
321       std::string RPMPackageImpl::patchRpmMD5() const
322       {}
323       /** */
324       bool RPMPackageImpl::isRemote() const
325       {}
326       /** */
327       bool RPMPackageImpl::prefererCandidate() const
328       {}
329
330 #endif
331
332     } // namespace rpm
333     /////////////////////////////////////////////////////////////////
334   } // namespace target
335   ///////////////////////////////////////////////////////////////////
336   /////////////////////////////////////////////////////////////////
337 } // namespace zypp
338 ///////////////////////////////////////////////////////////////////