Fix Werrors with GCC-14.1.0
[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      * If the identical package happens to appear in multiple
51      * repos with different support levels, the maximum
52      * level is returned.
53      *
54      * This is one value from \ref VendorSupportOption.
55      */
56     VendorSupportOption vendorSupport() const;
57
58     /**
59      * True if the vendor support for this package
60      * is unknown or explictly unsupported.
61      */
62     bool maybeUnsupported() const;
63
64     /** Get the package change log */
65     Changelog changelog() const;
66     /** */
67     std::string buildhost() const;
68     /** */
69     std::string distribution() const;
70     /** */
71     std::string license() const;
72     /** */
73     std::string packager() const;
74     /** */
75     std::string group() const;
76     /** */
77     Keywords keywords() const;
78     /** Don't ship it as class Url, because it might be
79      * in fact anything but a legal Url. */
80     std::string url() const;
81     /** Size of corresponding the source package. */
82     ByteCount sourcesize() const;
83     /** */
84     std::list<std::string> authors() const;
85
86     /** Return the packages filelist (if available).
87      * The returned \ref FileList appears to be a container of
88      * \c std::string. In fact it is a query, so it does not
89      * consume much memory.
90     */
91     FileList filelist() const;
92
93     /** \name Source package handling
94     */
95     //@{
96     /** Name of the source rpm this package was built from.
97      */
98     std::string sourcePkgName() const;
99
100     /** Edition of the source rpm this package was built from.
101      */
102     Edition sourcePkgEdition() const;
103
104     /** The type of the source rpm (\c "src" or \c "nosrc").
105      */
106     std::string sourcePkgType() const;
107
108     /** The source rpms \c "name-version-release.type"
109      */
110     std::string sourcePkgLongName() const;
111     //@}
112
113     /**
114      * Checksum the source says this package should have.
115      * \see \ref location
116      */
117     CheckSum checksum() const;
118
119     /** Location of the resolvable in the repository.
120      * \ref OnMediaLocation conatins all information required to
121      * retrieve the packge (url, checksum, etc.).
122      */
123     OnMediaLocation location() const;
124
125     /** Location of the downloaded package in cache or an empty path. */
126     Pathname cachedLocation() const;
127
128     /** Whether the package is cached. */
129     bool isCached() const
130     { return ! cachedLocation().empty(); }
131
132   protected:
133     friend Ptr make<Self>( const sat::Solvable & solvable_r );
134     /** Ctor */
135     Package( const sat::Solvable & solvable_r );
136     /** Dtor */
137     virtual ~Package();
138   };
139
140   ///////////////////////////////////////////////////////////////////
141
142   /////////////////////////////////////////////////////////////////
143 } // namespace zypp
144 ///////////////////////////////////////////////////////////////////
145 #endif // ZYPP_PACKAGE_H