PackageImplIf: added basic attributes to the interface.
authorMichael Andres <ma@suse.de>
Thu, 24 Nov 2005 14:20:59 +0000 (14:20 +0000)
committerMichael Andres <ma@suse.de>
Thu, 24 Nov 2005 14:20:59 +0000 (14:20 +0000)
zypp/NeedAType.h
zypp/detail/Makefile.am
zypp/detail/PackageImplIf.cc [new file with mode: 0644]
zypp/detail/PackageImplIf.h

index 3645668..a2f1913 100644 (file)
@@ -81,6 +81,21 @@ namespace zypp
    Text, while a a packages file list would be list<string> */
   typedef std::list<std::string> Text;
 
+  /** Offer a License text and methods to remember confirmation. */
+  typedef std::list<std::string> License;
+
+  /** An rpm package group value. Also provide acces to a
+   * (singleton) tree like group hierarchy which contains
+   * all existing groups. No more need to fiddle with YStringTreeItem
+   * classes and forgetting to add parsed groups there for use in the UI.
+   * PackageGroup can be selforganizing.
+  */
+  typedef std::string PackageGroup;
+
+  /**
+   */
+  typedef std::list<std::string> PackageKeywords;
+
   /** Class representing a Date (time_t). Basically store a time_t and offer
   conversions into formated strings. */
   typedef time_t Date;
index 9671f9d..bfaecdf 100644 (file)
@@ -33,6 +33,7 @@ noinst_LTLIBRARIES =  lib@PACKAGE@_detail.la
 lib@PACKAGE@_detail_la_SOURCES = \
        ResolvableImpl.cc       \
        ResObjectImplIf.cc      \
+       PackageImplIf.cc        \
        \
        \
        \
diff --git a/zypp/detail/PackageImplIf.cc b/zypp/detail/PackageImplIf.cc
new file mode 100644 (file)
index 0000000..4200c61
--- /dev/null
@@ -0,0 +1,91 @@
+/*---------------------------------------------------------------------\
+|                          ____ _   __ __ ___                          |
+|                         |__  / \ / / . \ . \                         |
+|                           / / \ V /|  _/  _/                         |
+|                          / /__ | | | | | |                           |
+|                         /_____||_| |_| |_|                           |
+|                                                                      |
+\---------------------------------------------------------------------*/
+/** \file      zypp/detail/PackageImplIf.cc
+ *
+*/
+#include "zypp/detail/PackageImplIf.h"
+
+///////////////////////////////////////////////////////////////////
+namespace zypp
+{ /////////////////////////////////////////////////////////////////
+  ///////////////////////////////////////////////////////////////////
+  namespace detail
+  { /////////////////////////////////////////////////////////////////
+
+    /////////////////////////////////////////////////////////////////
+    // Default implementation of PackageImplIf attributes,
+    // as far as resonable.
+    /////////////////////////////////////////////////////////////////
+
+      Date PackageImplIf::buildtime() const
+      { return Date(); }
+
+      std::string PackageImplIf::buildhost() const
+      { return std::string(); }
+
+      Date PackageImplIf::installtime() const
+      { return Date(); }
+
+      std::string PackageImplIf::distribution() const
+      { return std::string(); }
+
+      Vendor PackageImplIf::vendor() const
+      { return Vendor(); }
+
+      Label PackageImplIf::license() const
+      { return Label(); }
+
+      std::string PackageImplIf::packager() const
+      { return std::string(); }
+
+      PackageGroup PackageImplIf::group() const
+      { return PackageGroup(); }
+
+      Text PackageImplIf::changelog() const
+      { return Text(); }
+
+      std::string PackageImplIf::url() const
+      { return std::string(); }
+
+      std::string PackageImplIf::os() const
+      { return std::string(); }
+
+      std::list<std::string> PackageImplIf::prein() const
+      { return std::list<std::string>(); }
+
+      std::list<std::string> PackageImplIf::postin() const
+      { return std::list<std::string>(); }
+
+      std::list<std::string> PackageImplIf::preun() const
+      { return std::list<std::string>(); }
+
+      std::list<std::string> PackageImplIf::postun() const
+      { return std::list<std::string>(); }
+
+      FSize PackageImplIf::sourcesize() const
+      { return FSize(); }
+
+      FSize PackageImplIf::archivesize() const
+      { return FSize(); }
+
+      std::list<std::string> PackageImplIf::authors() const
+      { return std::list<std::string>(); }
+
+      std::list<std::string> PackageImplIf::filenames() const
+      { return std::list<std::string>(); }
+
+      License PackageImplIf::licenseToConfirm() const
+      { return License(); }
+
+    /////////////////////////////////////////////////////////////////
+  } // namespace detail
+  ///////////////////////////////////////////////////////////////////
+  /////////////////////////////////////////////////////////////////
+} // namespace zypp
+///////////////////////////////////////////////////////////////////
index 68d9c8e..03daaf3 100644 (file)
@@ -36,104 +36,92 @@ namespace zypp
       typedef Package ResType;
 
     public:
-#if 0
-      /** */
-      virtual std::list<std::string> insnotify() const;
-      /** */
-      virtual std::list<std::string> delnotify() const;
-      /** */
-      virtual FSize size() const;
-      /** */
-      virtual bool providesSources() const;
-      /** */
-      virtual std::string instSrcLabel() const;
-      /** */
-      virtual Vendor instSrcVendor() const;
-      /** */
-      virtual unsigned instSrcRank() const;
-      /** */
-      virtual PkgSplitSet splitprovides() const;
+      /** \name Rpm Package Attributes. */
+      //@{
       /** */
-      virtual Date buildtime() const;
+      virtual Date buildtime() const PURE_VIRTUAL;
       /** */
-      virtual std::string buildhost() const;
+      virtual std::string buildhost() const PURE_VIRTUAL;
       /** */
-      virtual Date installtime() const;
+      virtual Date installtime() const PURE_VIRTUAL;
       /** */
-      virtual std::string distribution() const;
+      virtual std::string distribution() const PURE_VIRTUAL;
       /** */
-      virtual Vendor vendor() const;
+      virtual Vendor vendor() const PURE_VIRTUAL;
       /** */
-      virtual std::string license() const;
+      virtual Label license() const PURE_VIRTUAL;
       /** */
-      virtual std::list<std::string> licenseToConfirm() const;
+      virtual std::string packager() const PURE_VIRTUAL;
       /** */
-      virtual std::string packager() const;
+      virtual PackageGroup group() const PURE_VIRTUAL;
       /** */
-      virtual std::string group() const;
+      virtual Text changelog() const PURE_VIRTUAL;
+      /** Don't ship it as class Url, because it might be
+       * in fact anything but a legal Url. */
+      virtual std::string url() const PURE_VIRTUAL;
       /** */
-      virtual YStringTreeItem * group_ptr() const;
+      virtual std::string os() const PURE_VIRTUAL;
       /** */
-      virtual std::list<std::string> changelog() const;
+      virtual std::list<std::string> prein() const PURE_VIRTUAL;
       /** */
-      virtual std::string url() const;
+      virtual std::list<std::string> postin() const PURE_VIRTUAL;
       /** */
-      virtual std::string os() const;
+      virtual std::list<std::string> preun() const PURE_VIRTUAL;
       /** */
-      virtual std::list<std::string> prein() const;
+      virtual std::list<std::string> postun() const PURE_VIRTUAL;
       /** */
-      virtual std::list<std::string> postin() const;
+      virtual FSize sourcesize() const PURE_VIRTUAL;
       /** */
-      virtual std::list<std::string> preun() const;
+      virtual FSize archivesize() const PURE_VIRTUAL;
       /** */
-      virtual std::list<std::string> postun() const;
+      virtual std::list<std::string> authors() const PURE_VIRTUAL;
       /** */
-      virtual std::string sourceloc() const;
-      /** */
-      virtual FSize sourcesize() const;
-      /** */
-      virtual FSize archivesize() const;
-      /** */
-      virtual std::list<std::string> authors() const;
-      /** */
-      virtual std::list<std::string> filenames() const;
-      /** */
-      virtual std::list<std::string> recommends() const;
-      /** */
-      virtual std::list<std::string> suggests() const;
+      virtual std::list<std::string> filenames() const PURE_VIRTUAL;
+      //@}
+
+      /** \name Additional Package Attributes.
+       * \todo review what's actually needed here. Maybe worth grouping
+       * all the package rertieval related stuff in a class. Easier to ship
+       * and handle it.
+      */
+      //@{
+      /** */
+      virtual License licenseToConfirm() const PURE_VIRTUAL;
+#if 0
       /** */
-      virtual std::string location() const;
+      virtual std::string sourceloc() const PURE_VIRTUAL;
       /** */
-      virtual unsigned int medianr() const;
+      virtual void du( PkgDu & dudata_r ) const PURE_VIRTUAL;
       /** */
-      virtual std::list<std::string> keywords() const;
+      virtual std::string location() const PURE_VIRTUAL;
       /** */
-      virtual std::string md5sum() const;
+      virtual unsigned int medianr() const PURE_VIRTUAL;
       /** */
-      virtual std::string externalUrl() const;
+      virtual PackageKeywords keywords() const PURE_VIRTUAL;
       /** */
-      virtual std::list<PkgEdition> patchRpmBaseVersions() const;
+      virtual std::string md5sum() const PURE_VIRTUAL;
       /** */
-      virtual FSize patchRpmSize() const;
+      virtual std::string externalUrl() const PURE_VIRTUAL;
       /** */
-      virtual bool forceInstall() const;
+      virtual std::list<Edition> patchRpmBaseVersions() const PURE_VIRTUAL;
       /** */
-      virtual std::string patchRpmMD5() const;
+      virtual FSize patchRpmSize() const PURE_VIRTUAL;
       /** */
-      virtual bool isRemote() const;
+      virtual bool forceInstall() const PURE_VIRTUAL;
       /** */
-      virtual PMError providePkgToInstall( Pathname& path_r ) const;
+      virtual std::string patchRpmMD5() const PURE_VIRTUAL;
       /** */
-      virtual PMError provideSrcPkgToInstall( Pathname& path_r ) const;
+      virtual bool isRemote() const PURE_VIRTUAL;
       /** */
-      virtual constInstSrcPtr source() const;
+      virtual PMError providePkgToInstall( Pathname& path_r ) const PURE_VIRTUAL;
       /** */
-      virtual bool prefererCandidate() const;
+      virtual PMError provideSrcPkgToInstall( Pathname& path_r ) const PURE_VIRTUAL;
       /** */
-      virtual void du( PkgDu & dudata_r ) const;
+      virtual constInstSrcPtr source() const PURE_VIRTUAL;
       /** */
-      virtual std::list<PMPackageDelta> deltas() const;
+      virtual std::list<PMPackageDelta> deltas() const PURE_VIRTUAL;
 #endif
+      //@}
     };
     ///////////////////////////////////////////////////////////////////