- Add Package::filelist, faster and less memory consuming
[platform/upstream/libzypp.git] / zypp / Package.h
1 /*---------------------------------------------------------------------\
2 |                          ____ _   __ __ ___                          |
3 |                         |__  / \ / / . \ . \                         |
4 |                           / / \ V /|  _/  _/                         |
5 |                          / /__ | | | | | |                           |
6 |                         /_____||_| |_| |_|                           |
7 |                                                                      |
8 \---------------------------------------------------------------------*/
9 /** \file       zypp/Package.h
10  *
11 */
12 #ifndef ZYPP_PACKAGE_H
13 #define ZYPP_PACKAGE_H
14
15 #include "zypp/ResObject.h"
16 #include "zypp/PackageKeyword.h"
17 #include "zypp/Changelog.h"
18 #include "zypp/VendorSupportOptions.h"
19
20 ///////////////////////////////////////////////////////////////////
21 namespace zypp
22 { /////////////////////////////////////////////////////////////////
23
24   DEFINE_PTR_TYPE(Package);
25
26   ///////////////////////////////////////////////////////////////////
27   //
28   //    CLASS NAME : Package
29   //
30   /** Package interface.
31   */
32   class Package : public ResObject
33   {
34   public:
35     typedef Package                  Self;
36     typedef ResTraits<Self>          TraitsType;
37     typedef TraitsType::PtrType      Ptr;
38     typedef TraitsType::constPtrType constPtr;
39
40   public:
41     typedef sat::ArrayAttr<PackageKeyword,IdString> Keywords;
42     typedef sat::ArrayAttr<std::string,std::string> FileList;
43
44   public:
45
46     /**
47      * Returns the level of supportability the vendor
48      * gives to this package.
49      *
50      * This is one value from \ref VendorSupportOption
51      */
52     VendorSupportOption vendorSupport() const;
53
54     /**
55      * True if the vendor support for this package
56      * is unknown or explictly unsupported.
57      */
58     bool maybeUnsupported() const;
59
60     /** Get the package change log */
61     Changelog changelog() const;
62     /** */
63     std::string buildhost() const;
64     /** */
65     std::string distribution() const;
66     /** */
67     std::string license() const;
68     /** */
69     std::string packager() const;
70     /** */
71     std::string group() const;
72     /** */
73     Keywords keywords() const;
74     /** Don't ship it as class Url, because it might be
75      * in fact anything but a legal Url. */
76     std::string url() const;
77     /** Size of corresponding the source package. */
78     ByteCount sourcesize() const;
79     /** */
80     std::list<std::string> authors() const;
81
82     /** Return the packages filelist (if available).
83      * The returned \ref FileList appears to be a container of
84      * \c std::string. In fact it is a query, so it does not
85      * consume much memory.
86     */
87     FileList filelist() const;
88     /** \deprecated Use filelist, it's faster and saves memeory. */
89     std::list<std::string> filenames() const ZYPP_DEPRECATED;
90
91     /** Name of the source rpm this package was built from.
92      */
93     std::string sourcePkgName() const;
94
95     /** Edition of the source rpm this package was built from.
96      */
97     Edition sourcePkgEdition() const;
98
99     /**
100      * Checksum the source says this package should have.
101      * \see \ref location
102      */
103     CheckSum checksum() const;
104
105     /** Location of the resolvable in the repository.
106      * \ref OnMediaLocation conatins all information required to
107      * retrieve the packge (url, checksum, etc.).
108      */
109     OnMediaLocation location() const;
110
111   protected:
112     friend Ptr make<Self>( const sat::Solvable & solvable_r );
113     /** Ctor */
114     Package( const sat::Solvable & solvable_r );
115     /** Dtor */
116     virtual ~Package();
117   };
118
119   ///////////////////////////////////////////////////////////////////
120
121   /////////////////////////////////////////////////////////////////
122 } // namespace zypp
123 ///////////////////////////////////////////////////////////////////
124 #endif // ZYPP_PACKAGE_H