fixup Fix to build with libxml 2.12.x (fixes #505)
[platform/upstream/libzypp.git] / zypp / Package.h
index 72ef0bb..03ef46f 100644 (file)
 #ifndef ZYPP_PACKAGE_H
 #define ZYPP_PACKAGE_H
 
-#include "zypp/ResObject.h"
-#include "zypp/detail/PackageImplIf.h"
+#include <zypp/ResObject.h>
+#include <zypp/PackageKeyword.h>
+#include <zypp/Changelog.h>
+#include <zypp/VendorSupportOptions.h>
 
 ///////////////////////////////////////////////////////////////////
 namespace zypp
@@ -29,86 +31,112 @@ namespace zypp
   */
   class Package : public ResObject
   {
-
   public:
-    typedef detail::PackageImplIf    Impl;
     typedef Package                  Self;
     typedef ResTraits<Self>          TraitsType;
     typedef TraitsType::PtrType      Ptr;
     typedef TraitsType::constPtrType constPtr;
 
   public:
+    typedef sat::ArrayAttr<PackageKeyword,IdString> Keywords;
+    typedef sat::ArrayAttr<std::string,std::string> FileList;
+
+  public:
+
     /**
-     * Checksum the source says this package should have
+     * Returns the level of supportability the vendor
+     * gives to this package.
+     *
+     * If the identical package happens to appear in multiple
+     * repos with different support levels, the maximum
+     * level is returned.
+     *
+     * This is one value from \ref VendorSupportOption.
      */
-    CheckSum checksum() const;
-    /** Time of package installation */
-    Date installtime() const;
+    VendorSupportOption vendorSupport() const;
+
+    /**
+     * True if the vendor support for this package
+     * is unknown or explictly unsupported.
+     */
+    bool maybeUnsupported() const;
+
     /** Get the package change log */
     Changelog changelog() const;
     /** */
-    Date buildtime() const;
-    /** */
     std::string buildhost() const;
     /** */
     std::string distribution() const;
     /** */
-    Vendor vendor() const;
-    /** */
-    Label license() const;
+    std::string license() const;
     /** */
     std::string packager() const;
     /** */
-    PackageGroup group() const;
+    std::string group() const;
+    /** */
+    Keywords keywords() const;
     /** Don't ship it as class Url, because it might be
      * in fact anything but a legal Url. */
     std::string url() const;
-    /** */
-    std::string os() const;
-    /** */
-    Text prein() const;
-    /** */
-    Text postin() const;
-    /** */
-    Text preun() const;
-    /** */
-    Text postun() const;
-    /** */
+    /** Size of corresponding the source package. */
     ByteCount sourcesize() const;
     /** */
-    ByteCount archivesize() const;
-    /** */
     std::list<std::string> authors() const;
-    /** */
-    std::list<std::string> filenames() const;
 
-    /** Disk usage per directory */
-    DiskUsage diskusage() const;
+    /** Return the packages filelist (if available).
+     * The returned \ref FileList appears to be a container of
+     * \c std::string. In fact it is a query, so it does not
+     * consume much memory.
+    */
+    FileList filelist() const;
 
-    /** */
-    License licenseToConfirm() const;
+    /** \name Source package handling
+    */
+    //@{
+    /** Name of the source rpm this package was built from.
+     */
+    std::string sourcePkgName() const;
 
-    /** */
-    bool installOnly() const;
-    /** ID of the media */
-    unsigned mediaId() const;
-    /** location in source */
-    Pathname location() const;
+    /** Edition of the source rpm this package was built from.
+     */
+    Edition sourcePkgEdition() const;
+
+    /** The type of the source rpm (\c "src" or \c "nosrc").
+     */
+    std::string sourcePkgType() const;
+
+    /** The source rpms \c "name-version-release.type"
+     */
+    std::string sourcePkgLongName() const;
+    //@}
 
-    // data here:
+    /**
+     * Checksum the source says this package should have.
+     * \see \ref location
+     */
+    CheckSum checksum() const;
 
+    /** Location of the resolvable in the repository.
+     * \ref OnMediaLocation conatins all information required to
+     * retrieve the packge (url, checksum, etc.).
+     */
+    OnMediaLocation location() const;
+
+    /** Location of the downloaded package in cache or an empty path. */
+    Pathname cachedLocation() const;
+
+    /** Whether the package is cached. */
+    bool isCached() const
+    { return ! cachedLocation().empty(); }
 
   protected:
-    Package( const NVRAD & nvrad_r );
+    friend Ptr make<Self>( const sat::Solvable & solvable_r );
+    /** Ctor */
+    Package( const sat::Solvable & solvable_r );
     /** Dtor */
     virtual ~Package();
-
-  private:
-    /** Access implementation */
-    virtual Impl & pimpl() = 0;
-    /** Access implementation */
-    virtual const Impl & pimpl() const = 0;
   };
+
   ///////////////////////////////////////////////////////////////////
 
   /////////////////////////////////////////////////////////////////