backup
[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
89     /** \name Source package handling
90     */
91     //@{
92     /** Name of the source rpm this package was built from.
93      */
94     std::string sourcePkgName() const;
95
96     /** Edition of the source rpm this package was built from.
97      */
98     Edition sourcePkgEdition() const;
99
100     /** The type of the source rpm (\c "src" or \c "nosrc").
101      */
102     std::string sourcePkgType() const;
103
104     /** The source rpms \c "name-version-release.type"
105      */
106     std::string sourcePkgLongName() const;
107     //@}
108
109     /**
110      * Checksum the source says this package should have.
111      * \see \ref location
112      */
113     CheckSum checksum() const;
114
115     /** Location of the resolvable in the repository.
116      * \ref OnMediaLocation conatins all information required to
117      * retrieve the packge (url, checksum, etc.).
118      */
119     OnMediaLocation location() const;
120
121   protected:
122     friend Ptr make<Self>( const sat::Solvable & solvable_r );
123     /** Ctor */
124     Package( const sat::Solvable & solvable_r );
125     /** Dtor */
126     virtual ~Package();
127   };
128
129   ///////////////////////////////////////////////////////////////////
130
131   /////////////////////////////////////////////////////////////////
132 } // namespace zypp
133 ///////////////////////////////////////////////////////////////////
134 #endif // ZYPP_PACKAGE_H