added disk usage data to PackageImplIf interface, provide this info from
[platform/upstream/libzypp.git] / zypp / target / rpm / RpmHeader.h
1 /*---------------------------------------------------------------------\
2 |                          ____ _   __ __ ___                          |
3 |                         |__  / \ / / . \ . \                         |
4 |                           / / \ V /|  _/  _/                         |
5 |                          / /__ | | | | | |                           |
6 |                         /_____||_| |_| |_|                           |
7 |                                                                      |
8 \---------------------------------------------------------------------*/
9 /** \file zypp/target/rpm/RpmHeader.h
10  *
11 */
12 #ifndef ZYPP_TARGET_RPM_RPMHEADER_H
13 #define ZYPP_TARGET_RPM_RPMHEADER_H
14
15 #include <iosfwd>
16 #include <list>
17
18 #include "zypp/target/rpm/BinHeader.h"
19
20 #include "zypp/Package.h"
21 #include "zypp/Changelog.h"
22 #include "zypp/CapSetFwd.h"
23 #include "zypp/Pathname.h"
24
25 namespace zypp {
26   namespace target {
27     namespace rpm {
28
29       
30       ///////////////////////////////////////////////////////////////////
31       //
32       //        CLASS NAME : RpmHeader
33       /**
34        * @short Wrapper class for rpm header struct.
35        *
36        * <code>RpmHeader</code> provides methods to query the content
37        * of a rpm header struct retrieved from the RPM database or by reading
38        * the rpm header of a package on disk.
39        *
40        * The rpm header contains all data associated with a package. So you
41        * probabely do not want to permanently store too many of them.
42        *
43        * <B>NEVER create <code>RpmHeader</code> from a NULL <code>Header</code>! </B>
44        **/
45       class RpmHeader : public BinHeader {
46         public:
47           typedef intrusive_ptr<RpmHeader> Ptr;
48           typedef intrusive_ptr<const RpmHeader> constPtr;
49
50         private:
51       
52           CapSet PkgRelList_val( tag tag_r, bool pre, std::set<std::string> * freq_r = 0 ) const;
53       
54         public:
55       
56           /**
57            *
58            **/
59           RpmHeader( Header h_r = 0 );
60       
61           /**
62            * <B>Dangerous!<\B> This one takes the header out of rhs
63            * and leaves rhs empty.
64            **/
65           RpmHeader( BinHeader::Ptr & rhs );
66       
67           virtual ~RpmHeader();
68       
69           bool isSrc() const;
70       
71         public:
72       
73           std::string    tag_name()        const;
74           Edition tag_edition()     const;
75           Arch    tag_arch()        const;
76       
77           Date       tag_installtime() const;
78           Date       tag_buildtime()   const;
79       
80           /**
81            * If <code>freq_r</code> is not NULL, file dependencies found are inserted.
82            **/
83           CapSet tag_provides ( std::set<std::string> * freq_r = 0 ) const;
84           /**
85            * @see #tag_provides
86            **/
87           CapSet tag_requires ( std::set<std::string> * freq_r = 0 ) const;
88           /**
89            * @see #tag_provides
90            **/
91           CapSet tag_prerequires ( std::set<std::string> * freq_r = 0 ) const;
92           /**
93            * @see #tag_provides
94            **/
95           CapSet tag_conflicts( std::set<std::string> * freq_r = 0 ) const;
96           /**
97            * @see #tag_provides
98            **/
99           CapSet tag_obsoletes( std::set<std::string> * freq_r = 0 ) const;
100       
101           ByteCount tag_size()        const;
102           ByteCount tag_archivesize() const;
103       
104           std::string tag_summary()      const;
105           std::string tag_description()  const;
106           std::string tag_group()        const;
107           std::string tag_vendor()       const;
108           std::string tag_distribution() const;
109           std::string tag_license()      const;
110           std::string tag_buildhost()    const;
111           std::string tag_packager()     const;
112           std::string tag_url()          const;
113           std::string tag_os()           const;
114           std::string tag_prein()        const;
115           std::string tag_postin()       const;
116           std::string tag_preun()        const;
117           std::string tag_postun()       const;
118           std::string tag_sourcerpm()    const;
119       
120           std::list<std::string> tag_filenames() const;
121       
122           Changelog tag_changelog() const;
123      
124           /**
125            * Returns reference to arg <code>dudata_r</code>.
126            **/
127           Package::DiskUsage & tag_du( Package::DiskUsage & dudata_r ) const;
128       
129         public:
130       
131           virtual std::ostream & dumpOn( std::ostream & str ) const;
132       
133         public:
134       
135           /**
136            * Digest and signature verification flags
137            **/
138           enum VERIFICATION {
139             VERIFY       = 0x0000,
140             NODIGEST     = (1<<0),
141             NOSIGNATURE  = (1<<1),
142             NOVERIFY     = 0xffff
143           };
144       
145           /**
146            * Get an accessible packages data from disk.
147            * Returns NULL on any error.
148            **/
149           static RpmHeader::constPtr readPackage( const Pathname & path,
150                                           VERIFICATION verification = VERIFY );
151       };
152
153 ///////////////////////////////////////////////////////////////////
154     } // namespace rpm
155   } // namespace target
156 } // namespace zypp
157
158 #endif // ZYPP_TARGET_RPM_RPMHEADER_H
159