Refined Resolvables interfaces, implementatio interfaces, factory
authorMichael Andres <ma@suse.de>
Thu, 17 Nov 2005 00:13:10 +0000 (00:13 +0000)
committerMichael Andres <ma@suse.de>
Thu, 17 Nov 2005 00:13:10 +0000 (00:13 +0000)
and pointer types. Compiles again, but need documentation.

43 files changed:
zypp/Makefile.am
zypp/Message.cc
zypp/Message.h
zypp/Package.cc
zypp/Package.h
zypp/Patch.cc
zypp/Patch.h
zypp/Product.cc
zypp/Product.h
zypp/ResObject.cc [new file with mode: 0644]
zypp/ResObject.h [new file with mode: 0644]
zypp/ResTraits.cc
zypp/ResTraits.h
zypp/Resolvable.cc
zypp/Resolvable.h
zypp/Script.cc
zypp/Script.h
zypp/Selection.cc
zypp/Selection.h
zypp/detail/Makefile.am
zypp/detail/MessageImpl.cc
zypp/detail/MessageImpl.h
zypp/detail/MessageImplIf.h [new file with mode: 0644]
zypp/detail/PackageImpl.cc
zypp/detail/PackageImpl.h
zypp/detail/PackageImplIf.h [new file with mode: 0644]
zypp/detail/PatchImpl.cc
zypp/detail/PatchImpl.h
zypp/detail/PatchImplIf.h [new file with mode: 0644]
zypp/detail/ProductImpl.cc
zypp/detail/ProductImpl.h
zypp/detail/ProductImplIf.h [new file with mode: 0644]
zypp/detail/ResObjectImplIf.h [new file with mode: 0644]
zypp/detail/ResolvableImpl.cc
zypp/detail/ResolvableImpl.h
zypp/detail/ScriptImpl.cc
zypp/detail/ScriptImpl.h
zypp/detail/ScriptImplIf.h [new file with mode: 0644]
zypp/detail/SelectionImpl.cc
zypp/detail/SelectionImpl.h
zypp/detail/SelectionImplIf.h [new file with mode: 0644]
zypp/source/yum/YUMScriptImpl.cc
zypp/source/yum/YUMScriptImpl.h

index e107bdd..8ae9cfa 100644 (file)
@@ -13,6 +13,7 @@ include_HEADERS = \
        Dependencies.h  \
        Edition.h       \
        ResKind.h       \
+       ResObject.h     \
        Resolvable.h    \
        ResTraits.h     \
        Package.h       \
@@ -37,6 +38,7 @@ lib@PACKAGE@_la_SOURCES = \
        Dependencies.cc \
        Edition.cc      \
        ResKind.cc      \
+       ResObject.cc    \
        Resolvable.cc   \
        ResTraits.cc    \
        Package.cc      \
index 667e359..b35468d 100644 (file)
@@ -9,26 +9,23 @@
 /** \file zypp/Message.cc
  *
 */
-#include <iostream>
-
 #include "zypp/Message.h"
-#include "zypp/detail/MessageImpl.h"
 
 using namespace std;
 
 ///////////////////////////////////////////////////////////////////
 namespace zypp
 { /////////////////////////////////////////////////////////////////
-  IMPL_PTR_TYPE(Message)
 
   ///////////////////////////////////////////////////////////////////
   //
   //   METHOD NAME : Message::Message
   //   METHOD TYPE : Ctor
   //
-  Message::Message( detail::MessageImplPtr impl_r )
-  : Resolvable( impl_r )
-  , _pimpl( impl_r )
+  Message::Message( const std::string & name_r,
+                    const Edition & edition_r,
+                    const Arch & arch_r )
+  : ResObject( ResKind("Message"), name_r, edition_r, arch_r )
   {}
 
   ///////////////////////////////////////////////////////////////////
@@ -41,23 +38,15 @@ namespace zypp
 
   ///////////////////////////////////////////////////////////////////
   //
-  //   METHOD NAME : Message::text
-  //   Get the text of the message
+  //   Message interface forwarded to implementation
   //
+  ///////////////////////////////////////////////////////////////////
+
   std::string Message::text()
-  {
-    return _pimpl->text();
-  }
+  { return pimpl().text(); }
 
-  ///////////////////////////////////////////////////////////////////
-  //
-  //   METHOD NAME : Message::text
-  //   Get the type of the message ("OK", "YesNo")
-  //
   std::string Message::type()
-  {
-    return _pimpl->type();
-  }
+  { return pimpl().type(); }
 
   /////////////////////////////////////////////////////////////////
 } // namespace zypp
index d636929..b0cf9d6 100644 (file)
 #ifndef ZYPP_MESSAGE_H
 #define ZYPP_MESSAGE_H
 
-#include "zypp/Resolvable.h"
+#include "zypp/ResObject.h"
+#include "zypp/detail/MessageImplIf.h"
 
 ///////////////////////////////////////////////////////////////////
 namespace zypp
 { /////////////////////////////////////////////////////////////////
 
   ///////////////////////////////////////////////////////////////////
-  namespace detail
-  { /////////////////////////////////////////////////////////////////
-    DEFINE_PTR_TYPE(MessageImpl)
-    /////////////////////////////////////////////////////////////////
-  } // namespace detail
-  ///////////////////////////////////////////////////////////////////
-  DEFINE_PTR_TYPE(Message)
-
-  ///////////////////////////////////////////////////////////////////
   //
   //   CLASS NAME : Message
   //
-  /** Class representing the message to be shown during update */
-  class Message : public Resolvable
+  /** Class representing the message to be shown during update.
+  */
+  class Message : public ResObject
   {
   public:
-    /** Default ctor */
-    Message( detail::MessageImplPtr impl_r );
-    /** Dtor */
-    ~Message();
+    typedef Message                         Self;
+    typedef detail::MessageImplIf           Impl;
+    typedef base::intrusive_ptr<Self>       Ptr;
+    typedef base::intrusive_ptr<const Self> constPtr;
+
   public:
     /** Get the text of the message */
     std::string text();
     /** Get the type of the message (YesNo / OK) */
     std::string type();
+
+  protected:
+    /** Ctor */
+    Message( const std::string & name_r,
+             const Edition & edition_r,
+             const Arch & arch_r );
+    /** Dtor */
+    virtual ~Message();
+
   private:
-    /** Pointer to implementation */
-    detail::MessageImplPtr _pimpl;
+    /** Access implementation */
+    virtual Impl & pimpl() = 0;
+    /** Access implementation */
+    virtual const Impl & pimpl() const = 0;
   };
 
   /////////////////////////////////////////////////////////////////
index 865cc7a..bcf77b9 100644 (file)
@@ -9,26 +9,23 @@
 /** \file      zypp/Package.cc
  *
 */
-#include <iostream>
-
 #include "zypp/Package.h"
-#include "zypp/detail/PackageImpl.h"
 
 using namespace std;
 
 ///////////////////////////////////////////////////////////////////
 namespace zypp
 { /////////////////////////////////////////////////////////////////
-  IMPL_PTR_TYPE(Package)
 
   ///////////////////////////////////////////////////////////////////
   //
   //   METHOD NAME : Package::Package
   //   METHOD TYPE : Ctor
   //
-  Package::Package( detail::PackageImplPtr impl_r )
-  :  Resolvable( impl_r )
-  , _pimpl( impl_r )
+  Package::Package( const std::string & name_r,
+                    const Edition & edition_r,
+                    const Arch & arch_r )
+  : ResObject( ResKind("Package"), name_r, edition_r, arch_r )
   {}
 
   ///////////////////////////////////////////////////////////////////
@@ -39,11 +36,13 @@ namespace zypp
   Package::~Package()
   {}
 
-  std::string Package::summary() const
-  { return _pimpl->summary(); }
+  ///////////////////////////////////////////////////////////////////
+  //
+  //   Package interface forwarded to implementation
+  //
+  ///////////////////////////////////////////////////////////////////
+
 
-  std::list<std::string> Package::description() const
-  { return _pimpl->description(); }
 
   /////////////////////////////////////////////////////////////////
 } // namespace zypp
index 048f80e..ff48aa9 100644 (file)
 #ifndef ZYPP_PACKAGE_H
 #define ZYPP_PACKAGE_H
 
-#include <list>
-
-#include "zypp/base/ReferenceCounted.h"
-#include "zypp/base/NonCopyable.h"
-
-#include "zypp/Resolvable.h"
+#include "zypp/ResObject.h"
+#include "zypp/detail/PackageImplIf.h"
 
 ///////////////////////////////////////////////////////////////////
 namespace zypp
 { /////////////////////////////////////////////////////////////////
-  ///////////////////////////////////////////////////////////////////
-  namespace detail
-  { /////////////////////////////////////////////////////////////////
-    DEFINE_PTR_TYPE(PackageImpl)
-    /////////////////////////////////////////////////////////////////
-  } // namespace detail
-  ///////////////////////////////////////////////////////////////////
-  DEFINE_PTR_TYPE(Package)
 
   ///////////////////////////////////////////////////////////////////
   //
   //   CLASS NAME : Package
   //
-  /** */
-  class Package : public Resolvable
+  /** Package interface.
+  */
+  class Package : public ResObject
   {
   public:
-    /** Default ctor */
-    Package( detail::PackageImplPtr impl_r );
-    /** Dtor */
-    virtual ~Package();
+    typedef Package                         Self;
+    typedef detail::PackageImplIf           Impl;
+    typedef base::intrusive_ptr<Self>       Ptr;
+    typedef base::intrusive_ptr<const Self> constPtr;
 
   public:
-
-    /** */
-    std::string summary() const;
     /** */
-    std::list<std::string> description() const;
+    // data here:
+
+  protected:
+    /** Ctor */
+    Package( const std::string & name_r,
+             const Edition & edition_r,
+             const Arch & arch_r );
+    /** Dtor */
+    virtual ~Package();
 
   private:
-    /** Pointer to implementation */
-    detail::PackageImplPtr _pimpl;
+    /** Access implementation */
+    virtual Impl & pimpl() = 0;
+    /** Access implementation */
+    virtual const Impl & pimpl() const = 0;
   };
   ///////////////////////////////////////////////////////////////////
 
index f3df922..a5561bb 100644 (file)
@@ -9,28 +9,24 @@
 /** \file zypp/Patch.cc
  *
 */
-#include <iostream>
-
 #include "zypp/Patch.h"
-#include "zypp/detail/PatchImpl.h"
 
 using namespace std;
 
 ///////////////////////////////////////////////////////////////////
 namespace zypp
 { /////////////////////////////////////////////////////////////////
-  IMPL_PTR_TYPE(Patch)
 
   ///////////////////////////////////////////////////////////////////
   //
   //   METHOD NAME : Patch::Patch
   //   METHOD TYPE : Ctor
   //
-  Patch::Patch( detail::PatchImplPtr impl_r )
-  : Resolvable( impl_r )
-  , _pimpl( impl_r )
-  {
-  }
+  Patch::Patch( const std::string & name_r,
+                const Edition & edition_r,
+                const Arch & arch_r )
+  : ResObject( ResKind("Patch"), name_r, edition_r, arch_r )
+  {}
 
   ///////////////////////////////////////////////////////////////////
   //
@@ -42,117 +38,39 @@ namespace zypp
 
   ///////////////////////////////////////////////////////////////////
   //
-  //   METHOD NAME : Patch::id
-  //   Get the patch id
+  //   Patch interface forwarded to implementation
   //
-  std::string Patch::id() const
-  {
-    return _pimpl->id();
-  }
-
   ///////////////////////////////////////////////////////////////////
-  //
-  //   METHOD NAME : Patch::id
-  //   Get the patch id
-  //
-  unsigned int Patch::timestamp() const
-  {
-    return _pimpl->timestamp();
-  }
 
-  ///////////////////////////////////////////////////////////////////
-  //
-  //   METHOD NAME : Patch::summary
-  //   Get the patch summary
-  //
-  std::string Patch::summary() const
-  {
-    return _pimpl->summary();
-  }
+  std::string Patch::id() const
+  { return pimpl().id(); }
 
-  ///////////////////////////////////////////////////////////////////
-  //
-  //   METHOD NAME : Patch::description
-  //   Get the patch description
-  //
-  std::list<std::string> Patch::description() const
-  {
-    return _pimpl->description();
-  }
+  unsigned int Patch::timestamp() const
+  { return pimpl().timestamp(); }
 
-  ///////////////////////////////////////////////////////////////////
-  //
-  //   METHOD NAME : Patch::category
-  //   Get the category of the patch
-  //
   std::string Patch::category() const
-  {
-    return _pimpl->category();
-  }
+  { return pimpl().category(); }
 
-  ///////////////////////////////////////////////////////////////////
-  //
-  //   METHOD NAME : Patch::reboot_needed
-  //   Check whether reboot is needed to finish the patch installation
-  //
-  bool Patch::reboot_needed() const {
-    return _pimpl->reboot_needed();
-  }
+  bool Patch::reboot_needed() const
+  { return pimpl().reboot_needed(); }
 
-  ///////////////////////////////////////////////////////////////////
-  //
-  //   METHOD NAME : Patch::affects_pkg_manager
-  //   Check whether the patch installation affects package manager
-  //    (and it should be restarted after patch installation)
-  //
-  bool Patch::affects_pkg_manager() const {
-    return _pimpl->affects_pkg_manager();
-  }
+  bool Patch::affects_pkg_manager() const
+  { return pimpl().affects_pkg_manager(); }
+
+  Patch::AtomList Patch::atoms()
+  { return pimpl().all_atoms(); }
 
-  ///////////////////////////////////////////////////////////////////
-  //
-  //   METHOD NAME : Patch::atoms
-  //    Get the list of all atoms building the patch
-  //
-  atom_list Patch::atoms() const {
-    return _pimpl->all_atoms();
-  }
-  ///////////////////////////////////////////////////////////////////
-  //
-  //   METHOD NAME : Patch::interactive
-  //   Check whether patch can be applied only interactivly
-  //
   bool Patch::interactive()
-  {
-    return _pimpl->interactive();
-  }
+  { return pimpl().interactive(); }
 
   void Patch::mark_atoms_to_freshen(bool freshen)
-  {
-    _pimpl->mark_atoms_to_freshen(freshen);
-  }
-  ///////////////////////////////////////////////////////////////////
-  //
-  //   METHOD NAME : Patch::any_atom_selected
-  //   Check whether there is at least one atom of the solution selected
-  //
+  { pimpl().mark_atoms_to_freshen(freshen); }
+
   bool Patch::any_atom_selected()
-  {
-    return _pimpl->any_atom_selected();
-  }
+  { return pimpl().any_atom_selected(); }
 
-  ///////////////////////////////////////////////////////////////////
-  //
-  //   METHOD NAME : Patch::select
-  //   Mark all atoms to be updated (set them as freshen) and mark
-  //    the patch itself as selected for being installed/updated
-  //
-  // FIXME to be changed to inherit Resolvable's method
   void Patch::select()
-//  : Resolvable::select()
-  {
-    mark_atoms_to_freshen(true); // FIXME
-  }
+  { pimpl().mark_atoms_to_freshen(true); }
 
   /////////////////////////////////////////////////////////////////
 } // namespace zypp
index dc54f0e..19ea0e2 100644 (file)
 #ifndef ZYPP_PATCH_H
 #define ZYPP_PATCH_H
 
-#include <list>
-
-#include "zypp/Resolvable.h"
+#include "zypp/ResObject.h"
+#include "zypp/detail/PatchImplIf.h"
 
 ///////////////////////////////////////////////////////////////////
 namespace zypp
 { /////////////////////////////////////////////////////////////////
 
   ///////////////////////////////////////////////////////////////////
-  namespace detail
-  { /////////////////////////////////////////////////////////////////
-    DEFINE_PTR_TYPE(PatchImpl)
-    /////////////////////////////////////////////////////////////////
-  } // namespace detail
-  ///////////////////////////////////////////////////////////////////
-  DEFINE_PTR_TYPE(Patch)
-
-  #define atom_list std::list<ResolvablePtr>
-
-  ///////////////////////////////////////////////////////////////////
   //
   //   CLASS NAME : Patch
   //
-  /** Class representing a patch */
-  class Patch : public Resolvable
+  /** Class representing a patch.
+   * \todo Patch::atoms can't be const, if Impl does not
+   * provide a const method. Check it.
+  */
+  class Patch : public ResObject
   {
   public:
-    /** Default ctor */
-    Patch( detail::PatchImplPtr impl_r );
-    /** Dtor */
-    ~Patch();
+    typedef Patch                           Self;
+    typedef detail::PatchImplIf             Impl;
+    typedef base::intrusive_ptr<Self>       Ptr;
+    typedef base::intrusive_ptr<const Self> constPtr;
+
+  public:
+    typedef Impl::AtomList AtomList;
+
   public:
     /** Patch ID */
     std::string id() const;
     /** Patch time stamp */
     unsigned int timestamp() const;
-    /** Patch summary */
-    std::string summary() const;
-    /** Patch description */
-    std::list<std::string> description() const;
     /** Patch category (recommended, security,...) */
     std::string category() const;
     /** Does the system need to reboot to finish the update process? */
@@ -59,16 +50,27 @@ namespace zypp
     /** Does the patch affect the package manager itself? */
     bool affects_pkg_manager() const;
     /** The list of all atoms building the patch */
-    atom_list atoms() const;
+    AtomList atoms();
     /** Is the patch installation interactive? (does it need user input?) */
     bool interactive();
     // TODO add comments and reevaluate the need for functions below
     void mark_atoms_to_freshen(bool freshen);
     bool any_atom_selected();
     void select(); // TODO parameter to specify select/unselect or another function
+
+  protected:
+    /** Ctor */
+    Patch( const std::string & name_r,
+           const Edition & edition_r,
+           const Arch & arch_r );
+    /** Dtor */
+    virtual ~Patch();
+
   private:
-    /** Pointer to implementation */
-    detail::PatchImplPtr _pimpl;
+    /** Access implementation */
+    virtual Impl & pimpl() = 0;
+    /** Access implementation */
+    virtual const Impl & pimpl() const = 0;
   };
 
   /////////////////////////////////////////////////////////////////
index 50acbb0..5eb0997 100644 (file)
 #include <iostream>
 
 #include "zypp/Product.h"
-#include "zypp/detail/ProductImpl.h"
 
 using namespace std;
 
 ///////////////////////////////////////////////////////////////////
 namespace zypp
 { /////////////////////////////////////////////////////////////////
-  IMPL_PTR_TYPE(Product)
 
   ///////////////////////////////////////////////////////////////////
   //
   //   METHOD NAME : Product::Product
   //   METHOD TYPE : Ctor
   //
-  Product::Product( detail::ProductImplPtr impl_r )
-  : Resolvable( impl_r )
-  , _pimpl( impl_r )
+  Product::Product( const std::string & name_r,
+                    const Edition & edition_r,
+                    const Arch & arch_r )
+  : ResObject( ResKind("Product"), name_r, edition_r, arch_r )
   {}
 
   ///////////////////////////////////////////////////////////////////
@@ -39,19 +38,14 @@ namespace zypp
   Product::~Product()
   {}
 
-  std::list<std::string> Product::description() const
-  {
-    return _pimpl->description();
-  }
   ///////////////////////////////////////////////////////////////////
   //
-  //   METHOD NAME : Product::do_script
-  //   Get the product category
+  //   Package interface forwarded to implementation
   //
-  std::string Product::category()
-  {
-    return _pimpl->category();
-  }
+  ///////////////////////////////////////////////////////////////////
+
+  std::string Product::category() const
+  { return pimpl().category(); }
 
   /////////////////////////////////////////////////////////////////
 } // namespace zypp
index cac4c28..72c0ef5 100644 (file)
 #ifndef ZYPP_PRODUCT_H
 #define ZYPP_PRODUCT_H
 
-#include "zypp/Resolvable.h"
-#include <list>
-#include <string>
+#include "zypp/ResObject.h"
+#include "zypp/detail/ProductImplIf.h"
 
 ///////////////////////////////////////////////////////////////////
 namespace zypp
 { /////////////////////////////////////////////////////////////////
 
   ///////////////////////////////////////////////////////////////////
-  namespace detail
-  { /////////////////////////////////////////////////////////////////
-    DEFINE_PTR_TYPE(ProductImpl)
-    /////////////////////////////////////////////////////////////////
-  } // namespace detail
-  ///////////////////////////////////////////////////////////////////
-  DEFINE_PTR_TYPE(Product)
-
-  ///////////////////////////////////////////////////////////////////
   //
-  //   CLASS NAME : Product
+  //   CLASS NAME : ResObject
   //
-  /** Class representing an update script */
-  class Product : public Resolvable
+  /** Product interface.
+  */
+  class Product : public ResObject
   {
   public:
-    /** Default ctor */
-    Product( detail::ProductImplPtr impl_r );
-    /** Dtor */
-    ~Product();
+    typedef Product                         Self;
+    typedef detail::ProductImplIf           Impl;
+    typedef base::intrusive_ptr<Self>       Ptr;
+    typedef base::intrusive_ptr<const Self> constPtr;
+
   public:
-    /** Get the product description */
-    std::list<std::string> description() const;
     /** Get the product categoty (base, add-on) */
-    std::string category();
+    std::string category() const;
+
+  protected:
+    /** Ctor */
+    Product( const std::string & name_r,
+             const Edition & edition_r,
+             const Arch & arch_r );
+    /** Dtor */
+    virtual ~Product();
+
   private:
-    /** Pointer to implementation */
-    detail::ProductImplPtr _pimpl;
+    /** Access implementation */
+    virtual Impl & pimpl() = 0;
+    /** Access implementation */
+    virtual const Impl & pimpl() const = 0;
   };
 
   /////////////////////////////////////////////////////////////////
diff --git a/zypp/ResObject.cc b/zypp/ResObject.cc
new file mode 100644 (file)
index 0000000..947ee2a
--- /dev/null
@@ -0,0 +1,54 @@
+/*---------------------------------------------------------------------\
+|                          ____ _   __ __ ___                          |
+|                         |__  / \ / / . \ . \                         |
+|                           / / \ V /|  _/  _/                         |
+|                          / /__ | | | | | |                           |
+|                         /_____||_| |_| |_|                           |
+|                                                                      |
+\---------------------------------------------------------------------*/
+/** \file      zypp/ResObject.cc
+ *
+*/
+#include "zypp/ResObject.h"
+
+using namespace std;
+
+///////////////////////////////////////////////////////////////////
+namespace zypp
+{ /////////////////////////////////////////////////////////////////
+
+  ///////////////////////////////////////////////////////////////////
+  //
+  //   METHOD NAME : ResObject::ResObject
+  //   METHOD TYPE : Ctor
+  //
+  ResObject::ResObject( const ResKind & kind_r,
+                        const std::string & name_r,
+                        const Edition & edition_r,
+                        const Arch & arch_r )
+  : Resolvable( kind_r, name_r, edition_r, arch_r )
+  {}
+
+  ///////////////////////////////////////////////////////////////////
+  //
+  //   METHOD NAME : ResObject::~ResObject
+  //   METHOD TYPE : Dtor
+  //
+  ResObject::~ResObject()
+  {}
+
+  ///////////////////////////////////////////////////////////////////
+  //
+  //   ResObject interface forwarded to implementation
+  //
+  ///////////////////////////////////////////////////////////////////
+
+  string ResObject::summary() const
+  { return pimpl().summary(); }
+
+  text ResObject::description() const
+  { return pimpl().description(); }
+
+  /////////////////////////////////////////////////////////////////
+} // namespace zypp
+///////////////////////////////////////////////////////////////////
diff --git a/zypp/ResObject.h b/zypp/ResObject.h
new file mode 100644 (file)
index 0000000..d8ab863
--- /dev/null
@@ -0,0 +1,62 @@
+/*---------------------------------------------------------------------\
+|                          ____ _   __ __ ___                          |
+|                         |__  / \ / / . \ . \                         |
+|                           / / \ V /|  _/  _/                         |
+|                          / /__ | | | | | |                           |
+|                         /_____||_| |_| |_|                           |
+|                                                                      |
+\---------------------------------------------------------------------*/
+/** \file      zypp/ResObject.h
+ *
+*/
+#ifndef ZYPP_RESOBJECT_H
+#define ZYPP_RESOBJECT_H
+
+#include "zypp/Resolvable.h"
+#include "zypp/detail/ResObjectImplIf.h"
+
+///////////////////////////////////////////////////////////////////
+namespace zypp
+{ /////////////////////////////////////////////////////////////////
+
+  ///////////////////////////////////////////////////////////////////
+  //
+  //   CLASS NAME : ResObject
+  //
+  /** Interface base for resolvable objects (common data).
+  */
+  class ResObject : public Resolvable
+  {
+  public:
+    typedef ResObject                       Self;
+    typedef detail::ResObjectImplIf         Impl;
+    typedef base::intrusive_ptr<Self>       Ptr;
+    typedef base::intrusive_ptr<const Self> constPtr;
+
+  public:
+    /** */
+    line summary() const;
+    /** */
+    text description() const;
+
+  protected:
+    /** Ctor */
+    ResObject( const ResKind & kind_r,
+               const std::string & name_r,
+               const Edition & edition_r,
+               const Arch & arch_r );
+    /** Dtor */
+    virtual ~ResObject();
+
+  private:
+    /** Access implementation */
+    virtual Impl & pimpl() = 0;
+    /** Access implementation */
+    virtual const Impl & pimpl() const = 0;
+  };
+  ///////////////////////////////////////////////////////////////////
+
+  /////////////////////////////////////////////////////////////////
+} // namespace zypp
+///////////////////////////////////////////////////////////////////
+#endif // ZYPP_RESOBJECT_H
index a8ffc3b..bd2fc9e 100644 (file)
  *
 */
 
+#include "zypp/ResTraits.h"
+#include "zypp/ResKind.h"
+
 ///////////////////////////////////////////////////////////////////
 namespace zypp
 { /////////////////////////////////////////////////////////////////
 
-
+  const ResKind ResTraits<Package>  ::_kind( "Package" );
+  const ResKind ResTraits<Selection>::_kind( "Selection" );
+  const ResKind ResTraits<Product>  ::_kind( "Product" );
+  const ResKind ResTraits<Patch>    ::_kind( "Patch" );
+  const ResKind ResTraits<Script>   ::_kind( "Script" );
+  const ResKind ResTraits<Message>  ::_kind( "Message" );
 
   /////////////////////////////////////////////////////////////////
 } // namespace zypp
index fcb15d8..4590672 100644 (file)
 #ifndef ZYPP_RESTRAITS_H
 #define ZYPP_RESTRAITS_H
 
-#include "zypp/ResKind.h"
-
 ///////////////////////////////////////////////////////////////////
 namespace zypp
 { /////////////////////////////////////////////////////////////////
 
+  class ResKind;
+
   template<typename _Res>
-    class ResTraits;
+    class ResTraits {};
 
   class Package;
   template<>
index 55d3785..549b9be 100644 (file)
@@ -9,6 +9,8 @@
 /** \file zypp/Resolvable.cc
  *
 */
+#include <iostream>
+
 #include "zypp/Resolvable.h"
 #include "zypp/detail/ResolvableImpl.h"
 
@@ -17,15 +19,17 @@ using namespace std;
 ///////////////////////////////////////////////////////////////////
 namespace zypp
 { /////////////////////////////////////////////////////////////////
-  IMPL_PTR_TYPE(Resolvable)
 
   ///////////////////////////////////////////////////////////////////
   //
   //   METHOD NAME : Resolvable::Resolvable
   //   METHOD TYPE : Ctor
   //
-  Resolvable::Resolvable( detail::ResolvableImplPtr impl_r )
-  : _pimpl( impl_r )
+  Resolvable::Resolvable( const ResKind & kind_r,
+                          const std::string & name_r,
+                          const Edition & edition_r,
+                          const Arch & arch_r )
+  : _pimpl( new Impl( kind_r, name_r, edition_r, arch_r ) )
   {}
 
   ///////////////////////////////////////////////////////////////////
@@ -36,6 +40,23 @@ namespace zypp
   Resolvable::~Resolvable()
   {}
 
+  ///////////////////////////////////////////////////////////////////
+  //
+  //   METHOD NAME : Resolvable::dumpOn
+  //   METHOD TYPE : std::ostream
+  //
+  std::ostream & Resolvable::dumpOn( std::ostream & str ) const
+  {
+    return str << '[' << kind() << ']'
+    << name() << '-' << edition() << '.' << arch();
+  }
+
+  ///////////////////////////////////////////////////////////////////
+  //
+  //   Resolvable interface forwarded to implementation
+  //
+  ///////////////////////////////////////////////////////////////////
+
   const ResKind & Resolvable::kind() const
   { return _pimpl->kind(); }
 
@@ -54,24 +75,6 @@ namespace zypp
   void Resolvable::setDeps( const Dependencies & val_r )
   { _pimpl->setDeps( val_r ); }
 
-  ///////////////////////////////////////////////////////////////////
-  //
-  //   METHOD NAME : Resolvable::~Resolvable
-  //   METHOD TYPE : Dtor
-  //
-  detail::constResolvableImplPtr Resolvable::sayFriend() const
-  { return _pimpl; }
-
-  /******************************************************************
-  **
-  **   FUNCTION NAME : operator<<
-  **   FUNCTION TYPE : std::ostream &
-  */
-  std::ostream & operator<<( std::ostream & str, const Resolvable & obj )
-  {
-    return str << *obj.sayFriend();
-  }
-
   /////////////////////////////////////////////////////////////////
 } // namespace zypp
 ///////////////////////////////////////////////////////////////////
index fa10371..615ef73 100644 (file)
 
 #include "zypp/base/ReferenceCounted.h"
 #include "zypp/base/NonCopyable.h"
+#include <zypp/base/PtrTypes.h>
 
-#include "zypp/ResolvableFwd.h"
+#include "zypp/ResKind.h"
+#include "zypp/Edition.h"
+#include "zypp/Arch.h"
+#include "zypp/Dependencies.h"
 
 ///////////////////////////////////////////////////////////////////
 namespace zypp
 { /////////////////////////////////////////////////////////////////
-  ///////////////////////////////////////////////////////////////////
-  namespace detail
-  { /////////////////////////////////////////////////////////////////
-    DEFINE_PTR_TYPE(ResolvableImpl)
-    /////////////////////////////////////////////////////////////////
-  } // namespace detail
-  ///////////////////////////////////////////////////////////////////
 
   ///////////////////////////////////////////////////////////////////
   //
   //   CLASS NAME : Resolvable
   //
-  /**
+  /** Interface base for resolvable objects (identification and depndencies).
    * \todo Solve ResKind problems via traits template?
   */
   class Resolvable : public base::ReferenceCounted, private base::NonCopyable
   {
   public:
-    /** Ctor */
-    Resolvable( detail::ResolvableImplPtr impl_r );
-    /** Dtor */
-    virtual ~Resolvable();
+    typedef Resolvable                      Self;
+    typedef base::intrusive_ptr<Self>       Ptr;
+    typedef base::intrusive_ptr<const Self> constPtr;
+    friend std::ostream & operator<<( std::ostream & str, const Resolvable & obj );
 
   public:
     /**  */
@@ -60,17 +57,36 @@ namespace zypp
     /** */
     void setDeps( const Dependencies & val_r );
 
+  protected:
+    /** Ctor */
+    Resolvable( const ResKind & kind_r,
+                const std::string & name_r,
+                const Edition & edition_r,
+                const Arch & arch_r );
+    /** Dtor */
+    virtual ~Resolvable();
+    /** Helper for stream output */
+    virtual std::ostream & dumpOn( std::ostream & str ) const;
+
   private:
+    /** Implementation */
+    struct Impl;
     /** Pointer to implementation */
-    detail::ResolvableImplPtr _pimpl;
-  public:
-    /** Avoid a bunch of friend decl. */
-    detail::constResolvableImplPtr sayFriend() const;
+    base::ImplPtr<Impl> _pimpl;
   };
   ///////////////////////////////////////////////////////////////////
 
-  /** \relates Resolvable Stream output */
-  extern std::ostream & operator<<( std::ostream & str, const Resolvable & obj );
+  /** Required by base::intrusive_ptr to add a reference. */
+  inline void intrusive_ptr_add_ref( const Resolvable * ptr_r )
+  { base::ReferenceCounted::add_ref( ptr_r ); }
+
+  /** Required by base::intrusive_ptr to release a reference. */
+  inline void intrusive_ptr_release( const Resolvable * ptr_r )
+  { base::ReferenceCounted::release( ptr_r ); }
+
+  /** \relates Resolvable Stream output via Resolvable::dumpOn */
+  inline std::ostream & operator<<( std::ostream & str, const Resolvable & obj )
+  { return obj.dumpOn( str ); }
 
   /////////////////////////////////////////////////////////////////
 } // namespace zypp
index e7939d1..432f802 100644 (file)
@@ -9,26 +9,23 @@
 /** \file zypp/Script.cc
  *
 */
-#include <iostream>
-
 #include "zypp/Script.h"
-#include "zypp/detail/ScriptImpl.h"
 
 using namespace std;
 
 ///////////////////////////////////////////////////////////////////
 namespace zypp
 { /////////////////////////////////////////////////////////////////
-  IMPL_PTR_TYPE(Script)
 
   ///////////////////////////////////////////////////////////////////
   //
   //   METHOD NAME : Script::Script
   //   METHOD TYPE : Ctor
   //
-  Script::Script( detail::ScriptImplPtr impl_r )
-  : Resolvable( impl_r )
-  , _pimpl( impl_r )
+  Script::Script( const std::string & name_r,
+                  const Edition & edition_r,
+                  const Arch & arch_r )
+  : ResObject( ResKind("Script"), name_r, edition_r, arch_r )
   {}
 
   ///////////////////////////////////////////////////////////////////
@@ -41,33 +38,18 @@ namespace zypp
 
   ///////////////////////////////////////////////////////////////////
   //
-  //   METHOD NAME : Script::do_script
-  //   Get the script to perform the action
+  //   Script interface forwarded to implementation
   //
+  ///////////////////////////////////////////////////////////////////
+
   std::string Script::do_script()
-  {
-    return _pimpl->do_script();
-  }
+  { return pimpl().do_script(); }
 
-  ///////////////////////////////////////////////////////////////////
-  //
-  //   METHOD NAME : Script::undo_script
-  //   Get the script to revert the action
-  //
   std::string Script::undo_script()
-  {
-    return _pimpl->undo_script();
-  }
+  { return pimpl().undo_script(); }
 
-  ///////////////////////////////////////////////////////////////////
-  //
-  //   METHOD NAME : Script::undo_available
-  //   Check whether the action can be reverted
-  //
   bool Script::undo_available()
-  {
-    return _pimpl->undo_available();
-  }
+  { return pimpl().undo_available(); }
 
   /////////////////////////////////////////////////////////////////
 } // namespace zypp
index a52b367..f07dd2b 100644 (file)
 #ifndef ZYPP_SCRIPT_H
 #define ZYPP_SCRIPT_H
 
-#include "zypp/Resolvable.h"
+#include "zypp/ResObject.h"
+#include "zypp/detail/ScriptImplIf.h"
 
 ///////////////////////////////////////////////////////////////////
 namespace zypp
 { /////////////////////////////////////////////////////////////////
 
   ///////////////////////////////////////////////////////////////////
-  namespace detail
-  { /////////////////////////////////////////////////////////////////
-    DEFINE_PTR_TYPE(ScriptImpl)
-    /////////////////////////////////////////////////////////////////
-  } // namespace detail
-  ///////////////////////////////////////////////////////////////////
-  DEFINE_PTR_TYPE(Script)
-
-  ///////////////////////////////////////////////////////////////////
   //
   //   CLASS NAME : Script
   //
-  /** Class representing an update script */
-  class Script : public Resolvable
+  /** Class representing an update script.
+  */
+  class Script : public ResObject
   {
   public:
-    /** Default ctor */
-    Script( detail::ScriptImplPtr impl_r );
-    /** Dtor */
-    ~Script();
+    typedef Script                          Self;
+    typedef detail::ScriptImplIf            Impl;
+    typedef base::intrusive_ptr<Self>       Ptr;
+    typedef base::intrusive_ptr<const Self> constPtr;
+
   public:
     /** Get the script to perform the change */
     std::string do_script();
@@ -46,9 +40,20 @@ namespace zypp
     std::string undo_script();
     /** Check whether script to undo the change is available */
     bool undo_available();
+
+  protected:
+    /** Ctor */
+    Script( const std::string & name_r,
+            const Edition & edition_r,
+            const Arch & arch_r );
+    /** Dtor */
+    virtual ~Script();
+
   private:
-    /** Pointer to implementation */
-    detail::ScriptImplPtr _pimpl;
+    /** Access implementation */
+    virtual Impl & pimpl() = 0;
+    /** Access implementation */
+    virtual const Impl & pimpl() const = 0;
   };
 
   /////////////////////////////////////////////////////////////////
index 0c6f04f..431e165 100644 (file)
 #include <iostream>
 
 #include "zypp/Selection.h"
-#include "zypp/detail/SelectionImpl.h"
 
 using namespace std;
 
 ///////////////////////////////////////////////////////////////////
 namespace zypp
 { /////////////////////////////////////////////////////////////////
-  IMPL_PTR_TYPE(Selection)
 
   ///////////////////////////////////////////////////////////////////
   //
   //   METHOD NAME : Selection::Selection
   //   METHOD TYPE : Ctor
   //
-  Selection::Selection( detail::SelectionImplPtr impl_r )
-  :  Resolvable( impl_r )
-  , _pimpl( impl_r )
+  Selection::Selection( const std::string & name_r,
+                        const Edition & edition_r,
+                        const Arch & arch_r )
+  : ResObject( ResKind("Selection"), name_r, edition_r, arch_r )
   {}
 
   ///////////////////////////////////////////////////////////////////
@@ -39,11 +38,12 @@ namespace zypp
   Selection::~Selection()
   {}
 
-  std::string Selection::summary() const
-  { return _pimpl->summary(); }
+  ///////////////////////////////////////////////////////////////////
+  //
+  //   Selection interface forwarded to implementation
+  //
+  ///////////////////////////////////////////////////////////////////
 
-  std::list<std::string> Selection::description() const
-  { return _pimpl->description(); }
 
   /////////////////////////////////////////////////////////////////
 } // namespace zypp
index 9004804..39c0d64 100644 (file)
 #ifndef ZYPP_SELECTION_H
 #define ZYPP_SELECTION_H
 
-#include <list>
-
-#include "zypp/base/ReferenceCounted.h"
-#include "zypp/base/NonCopyable.h"
-
-#include "zypp/Resolvable.h"
+#include "zypp/ResObject.h"
+#include "zypp/detail/SelectionImplIf.h"
 
 ///////////////////////////////////////////////////////////////////
 namespace zypp
 { /////////////////////////////////////////////////////////////////
-  ///////////////////////////////////////////////////////////////////
-  namespace detail
-  { /////////////////////////////////////////////////////////////////
-    DEFINE_PTR_TYPE(SelectionImpl)
-    /////////////////////////////////////////////////////////////////
-  } // namespace detail
-  ///////////////////////////////////////////////////////////////////
-  DEFINE_PTR_TYPE(Selection)
 
   ///////////////////////////////////////////////////////////////////
   //
   //   CLASS NAME : Selection
   //
-  /** */
-  class Selection : public Resolvable
+  /** Selection interface.
+  */
+  class Selection : public ResObject
   {
   public:
-    /** Default ctor */
-    Selection( detail::SelectionImplPtr impl_r );
-    /** Dtor */
-    virtual ~Selection();
+    typedef Selection                       Self;
+    typedef detail::SelectionImplIf         Impl;
+    typedef base::intrusive_ptr<Self>       Ptr;
+    typedef base::intrusive_ptr<const Self> constPtr;
 
   public:
-
-    /** */
-    std::string summary() const;
     /** */
-    std::list<std::string> description() const;
+    // data here:
+
+  protected:
+    /** Ctor */
+    Selection( const std::string & name_r,
+               const Edition & edition_r,
+               const Arch & arch_r );
+    /** Dtor */
+    virtual ~Selection();
 
   private:
-    /** Pointer to implementation */
-    detail::SelectionImplPtr _pimpl;
+    /** Access implementation */
+    virtual Impl & pimpl() = 0;
+    /** Access implementation */
+    virtual const Impl & pimpl() const = 0;
   };
   ///////////////////////////////////////////////////////////////////
 
index 2cc7f47..ffeb8c5 100644 (file)
@@ -7,11 +7,18 @@ SUBDIRS =
 
 include_HEADERS = \
        ResolvableImpl.h        \
+       ResObjectImplIf.h       \
+       PackageImplIf.h         \
        PackageImpl.h           \
+       SelectionImplIf.h       \
        SelectionImpl.h         \
+       MessageImplIf.h         \
        MessageImpl.h           \
+       ScriptImplIf.h          \
        ScriptImpl.h            \
+       PatchImplIf.h           \
        PatchImpl.h             \
+       ProductImplIf.h         \
        ProductImpl.h
 
 
index 2483cc6..8c53587 100644 (file)
@@ -20,7 +20,6 @@ namespace zypp
   ///////////////////////////////////////////////////////////////////
   namespace detail
   { /////////////////////////////////////////////////////////////////
-    IMPL_PTR_TYPE(MessageImpl)
 
     ///////////////////////////////////////////////////////////////////
     //
@@ -29,19 +28,11 @@ namespace zypp
     ///////////////////////////////////////////////////////////////////
 
     /** Default ctor */
-    MessageImpl::MessageImpl( const std::string & name_r,
-                             const Edition & edition_r,
-                             const Arch & arch_r )
-    : ResolvableImpl( ResKind( "message" ),
-                     name_r,
-                     edition_r,
-                     arch_r )
-    {
-    }
+    MessageImpl::MessageImpl()
+    {}
     /** Dtor */
     MessageImpl::~MessageImpl()
-    {
-    }
+    {}
 
     std::string MessageImpl::type() const {
       return _type;
index a5b57bf..aa48659 100644 (file)
@@ -12,7 +12,7 @@
 #ifndef ZYPP_DETAIL_MESSAGEIMPL_H
 #define ZYPP_DETAIL_MESSAGEIMPL_H
 
-#include "zypp/detail/ResolvableImpl.h"
+#include "zypp/detail/MessageImplIf.h"
 
 ///////////////////////////////////////////////////////////////////
 namespace zypp
@@ -20,22 +20,19 @@ namespace zypp
   ///////////////////////////////////////////////////////////////////
   namespace detail
   { /////////////////////////////////////////////////////////////////
-    DEFINE_PTR_TYPE(MessageImpl)
 
     ///////////////////////////////////////////////////////////////////
     //
     // CLASS NAME : MessageImpl
     //
     /** Class representing the message to be shown during update */
-    class MessageImpl : public ResolvableImpl
+    class MessageImpl : public MessageImplIf
     {
     public:
       /** Default ctor */
-      MessageImpl( const std::string & name_r,
-                  const Edition & edition_r,
-                  const Arch & arch_r );
+      MessageImpl();
       /** Dtor */
-      ~MessageImpl();
+      virtual ~MessageImpl();
 
     public:
       /** Get the text of the message */
diff --git a/zypp/detail/MessageImplIf.h b/zypp/detail/MessageImplIf.h
new file mode 100644 (file)
index 0000000..a724966
--- /dev/null
@@ -0,0 +1,52 @@
+/*---------------------------------------------------------------------\
+|                          ____ _   __ __ ___                          |
+|                         |__  / \ / / . \ . \                         |
+|                           / / \ V /|  _/  _/                         |
+|                          / /__ | | | | | |                           |
+|                         /_____||_| |_| |_|                           |
+|                                                                      |
+\---------------------------------------------------------------------*/
+/** \file zypp/detail/MessageImplIf.h
+ *
+*/
+#ifndef ZYPP_DETAIL_MESSAGEIMPLIF_H
+#define ZYPP_DETAIL_MESSAGEIMPLIF_H
+
+#include "zypp/detail/ResObjectImplIf.h"
+
+///////////////////////////////////////////////////////////////////
+namespace zypp
+{ /////////////////////////////////////////////////////////////////
+
+  class Message;
+
+  ///////////////////////////////////////////////////////////////////
+  namespace detail
+  { /////////////////////////////////////////////////////////////////
+
+    ///////////////////////////////////////////////////////////////////
+    //
+    // CLASS NAME : MessageImplIf
+    //
+    /** Abstact Message implementation interface.
+    */
+    class MessageImplIf : public ResObjectImplIf
+    {
+    public:
+      typedef Message ResType;
+
+    public:
+      /** Get the text of the message */
+      virtual std::string text() const = 0;
+      /** Get the type of the message (YesNo / OK) */
+      virtual std::string type() const = 0;
+    };
+    ///////////////////////////////////////////////////////////////////
+
+    /////////////////////////////////////////////////////////////////
+  } // namespace detail
+  ///////////////////////////////////////////////////////////////////
+  /////////////////////////////////////////////////////////////////
+} // namespace zypp
+///////////////////////////////////////////////////////////////////
+#endif // ZYPP_DETAIL_MESSAGEIMPLIF_H
index 77cfef8..e966eb5 100644 (file)
@@ -9,8 +9,6 @@
 /** \file      zypp/detail/PackageImpl.cc
  *
 */
-#include <iostream>
-
 #include "zypp/detail/PackageImpl.h"
 
 using namespace std;
@@ -21,17 +19,13 @@ namespace zypp
   ///////////////////////////////////////////////////////////////////
   namespace detail
   { /////////////////////////////////////////////////////////////////
-    IMPL_PTR_TYPE(PackageImpl)
 
     ///////////////////////////////////////////////////////////////////
     //
     // METHOD NAME : PackageImpl::PackageImpl
     // METHOD TYPE : Ctor
     //
-    PackageImpl::PackageImpl( const std::string & name_r,
-                              const Edition & edition_r,
-                              const Arch & arch_r )
-    : ResolvableImpl( ResKind("package"), name_r, edition_r, arch_r )
+    PackageImpl::PackageImpl()
     {}
 
     ///////////////////////////////////////////////////////////////////
@@ -42,12 +36,6 @@ namespace zypp
     PackageImpl::~PackageImpl()
     {}
 
-    std::string PackageImpl::summary() const
-    { return std::string(); }
-
-    std::list<std::string> PackageImpl::description() const
-    { return std::list<std::string>(); }
-
     /////////////////////////////////////////////////////////////////
   } // namespace detail
   ///////////////////////////////////////////////////////////////////
index 2ce1368..5ecd58c 100644 (file)
@@ -12,9 +12,7 @@
 #ifndef ZYPP_DETAIL_PACKAGEIMPL_H
 #define ZYPP_DETAIL_PACKAGEIMPL_H
 
-#include <list>
-
-#include "zypp/detail/ResolvableImpl.h"
+#include "zypp/detail/PackageImplIf.h"
 
 ///////////////////////////////////////////////////////////////////
 namespace zypp
@@ -22,126 +20,18 @@ namespace zypp
   ///////////////////////////////////////////////////////////////////
   namespace detail
   { /////////////////////////////////////////////////////////////////
-    DEFINE_PTR_TYPE(PackageImpl)
 
     ///////////////////////////////////////////////////////////////////
     //
     // CLASS NAME : PackageImpl
     //
-    /** */
-    class PackageImpl : public ResolvableImpl
+    /**
+    */
+    class PackageImpl : public PackageImplIf
     {
     public:
-      /** */
-      PackageImpl( const std::string & name_r,
-                   const Edition & edition_r,
-                   const Arch & arch_r );
-      /** Dtor */
+      PackageImpl();
       virtual ~PackageImpl();
-
-    public:
-      /** */
-      virtual std::string summary() const;
-      /** */
-      virtual std::list<std::string> description() const;
-#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;
-      /** */
-      virtual Date buildtime() const;
-      /** */
-      virtual std::string buildhost() const;
-      /** */
-      virtual Date installtime() const;
-      /** */
-      virtual std::string distribution() const;
-      /** */
-      virtual Vendor vendor() const;
-      /** */
-      virtual std::string license() const;
-      /** */
-      virtual std::list<std::string> licenseToConfirm() const;
-      /** */
-      virtual std::string packager() const;
-      /** */
-      virtual std::string group() const;
-      /** */
-      virtual YStringTreeItem * group_ptr() const;
-      /** */
-      virtual std::list<std::string> changelog() const;
-      /** */
-      virtual std::string url() const;
-      /** */
-      virtual std::string os() const;
-      /** */
-      virtual std::list<std::string> prein() const;
-      /** */
-      virtual std::list<std::string> postin() const;
-      /** */
-      virtual std::list<std::string> preun() const;
-      /** */
-      virtual std::list<std::string> postun() const;
-      /** */
-      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::string location() const;
-      /** */
-      virtual unsigned int medianr() const;
-      /** */
-      virtual std::list<std::string> keywords() const;
-      /** */
-      virtual std::string md5sum() const;
-      /** */
-      virtual std::string externalUrl() const;
-      /** */
-      virtual std::list<PkgEdition> patchRpmBaseVersions() const;
-      /** */
-      virtual FSize patchRpmSize() const;
-      /** */
-      virtual bool forceInstall() const;
-      /** */
-      virtual std::string patchRpmMD5() const;
-      /** */
-      virtual bool isRemote() const;
-      /** */
-      virtual PMError providePkgToInstall( Pathname& path_r ) const;
-      /** */
-      virtual PMError provideSrcPkgToInstall( Pathname& path_r ) const;
-      /** */
-      virtual constInstSrcPtr source() const;
-      /** */
-      virtual bool prefererCandidate() const;
-      /** */
-      virtual void du( PkgDu & dudata_r ) const;
-      /** */
-      virtual std::list<PMPackageDelta> deltas() const;
-#endif
     };
     ///////////////////////////////////////////////////////////////////
 
diff --git a/zypp/detail/PackageImplIf.h b/zypp/detail/PackageImplIf.h
new file mode 100644 (file)
index 0000000..68d9c8e
--- /dev/null
@@ -0,0 +1,146 @@
+/*---------------------------------------------------------------------\
+|                          ____ _   __ __ ___                          |
+|                         |__  / \ / / . \ . \                         |
+|                           / / \ V /|  _/  _/                         |
+|                          / /__ | | | | | |                           |
+|                         /_____||_| |_| |_|                           |
+|                                                                      |
+\---------------------------------------------------------------------*/
+/** \file      zypp/detail/PackageImplIf.h
+ *
+*/
+#ifndef ZYPP_DETAIL_PACKAGEIMPLIF_H
+#define ZYPP_DETAIL_PACKAGEIMPLIF_H
+
+#include "zypp/detail/ResObjectImplIf.h"
+
+///////////////////////////////////////////////////////////////////
+namespace zypp
+{ /////////////////////////////////////////////////////////////////
+
+  class Package;
+
+  ///////////////////////////////////////////////////////////////////
+  namespace detail
+  { /////////////////////////////////////////////////////////////////
+
+    ///////////////////////////////////////////////////////////////////
+    //
+    // CLASS NAME : PackageImplIf
+    //
+    /** Abstact Package implementation interface.
+    */
+    class PackageImplIf : public ResObjectImplIf
+    {
+    public:
+      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;
+      /** */
+      virtual Date buildtime() const;
+      /** */
+      virtual std::string buildhost() const;
+      /** */
+      virtual Date installtime() const;
+      /** */
+      virtual std::string distribution() const;
+      /** */
+      virtual Vendor vendor() const;
+      /** */
+      virtual std::string license() const;
+      /** */
+      virtual std::list<std::string> licenseToConfirm() const;
+      /** */
+      virtual std::string packager() const;
+      /** */
+      virtual std::string group() const;
+      /** */
+      virtual YStringTreeItem * group_ptr() const;
+      /** */
+      virtual std::list<std::string> changelog() const;
+      /** */
+      virtual std::string url() const;
+      /** */
+      virtual std::string os() const;
+      /** */
+      virtual std::list<std::string> prein() const;
+      /** */
+      virtual std::list<std::string> postin() const;
+      /** */
+      virtual std::list<std::string> preun() const;
+      /** */
+      virtual std::list<std::string> postun() const;
+      /** */
+      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::string location() const;
+      /** */
+      virtual unsigned int medianr() const;
+      /** */
+      virtual std::list<std::string> keywords() const;
+      /** */
+      virtual std::string md5sum() const;
+      /** */
+      virtual std::string externalUrl() const;
+      /** */
+      virtual std::list<PkgEdition> patchRpmBaseVersions() const;
+      /** */
+      virtual FSize patchRpmSize() const;
+      /** */
+      virtual bool forceInstall() const;
+      /** */
+      virtual std::string patchRpmMD5() const;
+      /** */
+      virtual bool isRemote() const;
+      /** */
+      virtual PMError providePkgToInstall( Pathname& path_r ) const;
+      /** */
+      virtual PMError provideSrcPkgToInstall( Pathname& path_r ) const;
+      /** */
+      virtual constInstSrcPtr source() const;
+      /** */
+      virtual bool prefererCandidate() const;
+      /** */
+      virtual void du( PkgDu & dudata_r ) const;
+      /** */
+      virtual std::list<PMPackageDelta> deltas() const;
+#endif
+    };
+    ///////////////////////////////////////////////////////////////////
+
+    /////////////////////////////////////////////////////////////////
+  } // namespace detail
+  ///////////////////////////////////////////////////////////////////
+  /////////////////////////////////////////////////////////////////
+} // namespace zypp
+///////////////////////////////////////////////////////////////////
+#endif // ZYPP_DETAIL_PACKAGEIMPLIF_H
index f9473d2..69bee79 100644 (file)
@@ -23,7 +23,6 @@ namespace zypp
   ///////////////////////////////////////////////////////////////////
   namespace detail
   { /////////////////////////////////////////////////////////////////
-    IMPL_PTR_TYPE(PatchImpl)
 
     ///////////////////////////////////////////////////////////////////
     //
@@ -32,20 +31,12 @@ namespace zypp
     ///////////////////////////////////////////////////////////////////
 
     /** Default ctor */
-    PatchImpl::PatchImpl( const std::string & name_r,
-                         const Edition & edition_r,
-                         const Arch & arch_r )
-    : ResolvableImpl( ResKind( "patch" ),
-                     name_r,
-                     edition_r,
-                     arch_r )
-    {
-    }
+    PatchImpl::PatchImpl()
+    {}
 
     /** Dtor */
     PatchImpl::~PatchImpl()
-    {
-    }
+    {}
 
     std::string PatchImpl::id() const
     {
@@ -87,8 +78,8 @@ namespace zypp
        DBG << "Patch needs reboot" << endl;
        return true;
       }
-      atom_list not_installed = not_installed_atoms();
-      for (atom_list::iterator it = not_installed.begin();
+      AtomList not_installed = not_installed_atoms();
+      for (AtomList::iterator it = not_installed.begin();
        it != not_installed.end();
        it++)
       {
@@ -102,7 +93,16 @@ namespace zypp
                                 // Resolvable*
                                  // Resolvable
                                   // ResolvablePtr
-         Package* p = (Package*)&**it;
+
+
+          // <ma> never do somthing like this!!!
+//       Package* p = (Package*)&**it;
+          //
+          // (*it) is a ResolvablePtr
+
+
+
+
          // FIXME use the condition
 //       if (p->licenseToConfirm() != "")
          if (false)
@@ -115,13 +115,13 @@ namespace zypp
       return false;
     }
 
-    atom_list PatchImpl::all_atoms() {
+    PatchImpl::AtomList PatchImpl::all_atoms() {
       return _atoms;
     }
 
-    atom_list PatchImpl::not_installed_atoms() {
-      atom_list ret;
-      for (atom_list::iterator it = _atoms.begin();
+    PatchImpl::AtomList PatchImpl::not_installed_atoms() {
+      AtomList ret;
+      for (AtomList::iterator it = _atoms.begin();
        it != _atoms.end();
        it++)
       {
@@ -136,7 +136,7 @@ namespace zypp
 // TODO check necessarity of functions below
 
     bool PatchImpl::any_atom_selected() {
-      for (atom_list::iterator it = _atoms.begin();
+      for (AtomList::iterator it = _atoms.begin();
        it != _atoms.end();
        it++)
       {
@@ -149,7 +149,7 @@ namespace zypp
     }
 
     void PatchImpl::mark_atoms_to_freshen( bool freshen ) {
-      for (atom_list::iterator it = _atoms.begin();
+      for (AtomList::iterator it = _atoms.begin();
        it != _atoms.end();
        it++)
       {
index d90d610..9e7f7ab 100644 (file)
 #ifndef ZYPP_DETAIL_PATCHIMPL_H
 #define ZYPP_DETAIL_PATCHIMPL_H
 
-#include <list>
-#include <string>
-
-#include "zypp/detail/ResolvableImpl.h"
-#include "zypp/Resolvable.h"
-#include "zypp/Patch.h"  // contains atom_list macro
+#include "zypp/detail/PatchImplIf.h"
 
 ///////////////////////////////////////////////////////////////////
 namespace zypp
@@ -25,20 +20,20 @@ namespace zypp
   ///////////////////////////////////////////////////////////////////
   namespace detail
   { /////////////////////////////////////////////////////////////////
-    DEFINE_PTR_TYPE(PatchImpl)
 
     ///////////////////////////////////////////////////////////////////
     //
     // CLASS NAME : PatchImpl
     //
-    /** Class representing a patch */
-    class PatchImpl : public ResolvableImpl
+    /** Class representing a patch
+     * \todo Get rid of string based ResKind detection in e.g.
+     * PatchImpl::interactive. Esp. DO NOT CAST ResKind to std::string.
+    */
+    class PatchImpl : public PatchImplIf
     {
     public:
       /** Default ctor */
-      PatchImpl( const std::string & name_r,
-                const Edition & edition_r,
-                const Arch & arch_r );
+      PatchImpl();
       /** Dtor */
       ~PatchImpl();
 
@@ -61,9 +56,9 @@ namespace zypp
       /** Is the patch installation interactive? (does it need user input?) */
       bool interactive();
       /** The list of all atoms building the patch */
-      atom_list all_atoms();
+      AtomList all_atoms();
       /** The list of those atoms which have not been installed */
-      atom_list not_installed_atoms();
+      AtomList not_installed_atoms();
 
 // TODO check necessarity of functions below
       bool any_atom_selected();
@@ -84,7 +79,7 @@ namespace zypp
       /** Does the patch affect the package manager itself? */
       bool _affects_pkg_manager;
       /** The list of all atoms building the patch */
-      atom_list _atoms;
+      AtomList _atoms;
     };
     ///////////////////////////////////////////////////////////////////
 
diff --git a/zypp/detail/PatchImplIf.h b/zypp/detail/PatchImplIf.h
new file mode 100644 (file)
index 0000000..1d136c4
--- /dev/null
@@ -0,0 +1,73 @@
+/*---------------------------------------------------------------------\
+|                          ____ _   __ __ ___                          |
+|                         |__  / \ / / . \ . \                         |
+|                           / / \ V /|  _/  _/                         |
+|                          / /__ | | | | | |                           |
+|                         /_____||_| |_| |_|                           |
+|                                                                      |
+\---------------------------------------------------------------------*/
+/** \file zypp/detail/PatchImplIf.h
+ *
+*/
+#ifndef ZYPP_DETAIL_PATCHIMPLIF_H
+#define ZYPP_DETAIL_PATCHIMPLIF_H
+
+#include "zypp/detail/ResObjectImplIf.h"
+#include "zypp/Resolvable.h"
+
+///////////////////////////////////////////////////////////////////
+namespace zypp
+{ /////////////////////////////////////////////////////////////////
+
+  class Patch;
+
+  ///////////////////////////////////////////////////////////////////
+  namespace detail
+  { /////////////////////////////////////////////////////////////////
+
+    ///////////////////////////////////////////////////////////////////
+    //
+    // CLASS NAME : PatchImplIf
+    //
+    /** Abstact Patch implementation interface.
+     */
+    class PatchImplIf : public ResObjectImplIf
+    {
+    public:
+      typedef Patch ResType;
+
+    public:
+      typedef std::list<Resolvable::Ptr> AtomList;
+
+    public:
+      /** Patch ID */
+      virtual std::string id() const = 0;
+      /** Patch time stamp */
+      virtual unsigned int timestamp() const = 0;
+      /** Patch category (recommended, security,...) */
+      virtual std::string category() const = 0;
+      /** Does the system need to reboot to finish the update process? */
+      virtual bool reboot_needed() const = 0;
+      /** Does the patch affect the package manager itself? */
+      virtual bool affects_pkg_manager() const = 0;
+
+      /** Is the patch installation interactive? (does it need user input?) */
+      virtual bool interactive() = 0;
+      /** The list of all atoms building the patch */
+      virtual AtomList all_atoms() = 0;
+      /** The list of those atoms which have not been installed */
+      virtual AtomList not_installed_atoms() = 0;
+
+// TODO check necessarity of functions below
+      virtual void mark_atoms_to_freshen(bool freshen) = 0;
+      virtual bool any_atom_selected() = 0;
+    };
+    ///////////////////////////////////////////////////////////////////
+
+    /////////////////////////////////////////////////////////////////
+  } // namespace detail
+  ///////////////////////////////////////////////////////////////////
+  /////////////////////////////////////////////////////////////////
+} // namespace zypp
+///////////////////////////////////////////////////////////////////
+#endif // ZYPP_DETAIL_PATCHIMPLIF_H
index 5ced8ff..10661a6 100644 (file)
@@ -20,7 +20,6 @@ namespace zypp
   ///////////////////////////////////////////////////////////////////
   namespace detail
   { /////////////////////////////////////////////////////////////////
-    IMPL_PTR_TYPE(ProductImpl)
 
     ///////////////////////////////////////////////////////////////////
     //
@@ -29,24 +28,11 @@ namespace zypp
     ///////////////////////////////////////////////////////////////////
 
     /** Default ctor */
-    ProductImpl::ProductImpl( const std::string & name_r,
-                           const Edition & edition_r,
-                           const Arch & arch_r )
-    : ResolvableImpl( ResKind( "script"),
-                     name_r,
-                     edition_r,
-                     arch_r )
-    {
-    }
+    ProductImpl::ProductImpl()
+    {}
     /** Dtor */
     ProductImpl::~ProductImpl()
-    {
-    }
-
-    std::list<std::string> ProductImpl::description() const
-    {
-      return _description;
-    }
+    {}
 
     std::string ProductImpl::category() const {
       return _category;
index a0b9200..4afa8a4 100644 (file)
 #ifndef ZYPP_DETAIL_PRODUCTIMPL_H
 #define ZYPP_DETAIL_PRODUCTIMPL_H
 
-#include <list>
-#include <string>
-
-#include "zypp/detail/ResolvableImpl.h"
+#include "zypp/detail/ProductImplIf.h"
 
 ///////////////////////////////////////////////////////////////////
 namespace zypp
 { /////////////////////////////////////////////////////////////////
+
   ///////////////////////////////////////////////////////////////////
   namespace detail
   { /////////////////////////////////////////////////////////////////
-    DEFINE_PTR_TYPE(ProductImpl)
 
     ///////////////////////////////////////////////////////////////////
     //
     // CLASS NAME : ProductImpl
     //
-    /** Class representing an update script */
-    class ProductImpl : public ResolvableImpl
+    /** */
+    class ProductImpl : public ProductImplIf
     {
     public:
-      /** Default ctor */
-      ProductImpl( const std::string & name_r,
-                 const Edition & edition_r,
-                 const Arch & arch_r );
-      /** Dtor */
+      ProductImpl();
       ~ProductImpl();
-
     public:
-      /** Get the product description */
-      std::list<std::string> description() const;
       /** Get the category of the product */
-      std::string category() const;
+      virtual std::string category() const;
     protected:
-      /** Product description */
-      std::list<std::string> _description;
-      /** The category of the product */
       std::string _category;
     };
     ///////////////////////////////////////////////////////////////////
diff --git a/zypp/detail/ProductImplIf.h b/zypp/detail/ProductImplIf.h
new file mode 100644 (file)
index 0000000..8cb7e44
--- /dev/null
@@ -0,0 +1,51 @@
+/*---------------------------------------------------------------------\
+|                          ____ _   __ __ ___                          |
+|                         |__  / \ / / . \ . \                         |
+|                           / / \ V /|  _/  _/                         |
+|                          / /__ | | | | | |                           |
+|                         /_____||_| |_| |_|                           |
+|                                                                      |
+\---------------------------------------------------------------------*/
+/** \file zypp/detail/ProductImplIf.h
+ *
+*/
+#ifndef ZYPP_DETAIL_PRODUCTIMPLIF_H
+#define ZYPP_DETAIL_PRODUCTIMPLIF_H
+
+#include "zypp/detail/ResObjectImplIf.h"
+
+///////////////////////////////////////////////////////////////////
+namespace zypp
+{ /////////////////////////////////////////////////////////////////
+
+  class Product;
+
+  ///////////////////////////////////////////////////////////////////
+  namespace detail
+  { /////////////////////////////////////////////////////////////////
+
+    ///////////////////////////////////////////////////////////////////
+    //
+    // CLASS NAME : ProductImplIf
+    //
+    /** Abstact Product implementation interface.
+    */
+    class ProductImplIf : public ResObjectImplIf
+    {
+    public:
+      typedef Product ResType;
+
+    public:
+      /** Get the category of the product */
+      virtual std::string category() const
+      { return std::string(); }
+    };
+    ///////////////////////////////////////////////////////////////////
+
+    /////////////////////////////////////////////////////////////////
+  } // namespace detail
+  ///////////////////////////////////////////////////////////////////
+  /////////////////////////////////////////////////////////////////
+} // namespace zypp
+///////////////////////////////////////////////////////////////////
+#endif // ZYPP_DETAIL_PRODUCTIMPLIF_H
diff --git a/zypp/detail/ResObjectImplIf.h b/zypp/detail/ResObjectImplIf.h
new file mode 100644 (file)
index 0000000..f2fd97c
--- /dev/null
@@ -0,0 +1,75 @@
+/*---------------------------------------------------------------------\
+|                          ____ _   __ __ ___                          |
+|                         |__  / \ / / . \ . \                         |
+|                           / / \ V /|  _/  _/                         |
+|                          / /__ | | | | | |                           |
+|                         /_____||_| |_| |_|                           |
+|                                                                      |
+\---------------------------------------------------------------------*/
+/** \file      zypp/detail/ResObjectImplIf.h
+ *
+*/
+#ifndef ZYPP_DETAIL_RESOBJECTIMPLIF_H
+#define ZYPP_DETAIL_RESOBJECTIMPLIF_H
+
+#include<list>
+#include<string>
+
+///////////////////////////////////////////////////////////////////
+namespace zypp
+{ /////////////////////////////////////////////////////////////////
+
+  class Resolvable;
+  typedef std::string            line;
+  typedef std::list<std::string> text;
+
+  ///////////////////////////////////////////////////////////////////
+  namespace detail
+  { /////////////////////////////////////////////////////////////////
+
+    ///////////////////////////////////////////////////////////////////
+    //
+    // CLASS NAME : ResObjectImplIf
+    //
+    /** Abstact ResObject implementation interface.
+    */
+    class ResObjectImplIf
+    {
+    public:
+      /** */
+      const Resolvable * self() const
+      { return _backRef; }
+      /** */
+      Resolvable * self()
+      { return _backRef; }
+      /** */
+      virtual line summary() const
+      { return line(); }
+      /** */
+      virtual text description() const
+      { return text(); }
+
+    public:
+      /** Ctor */
+      ResObjectImplIf()
+      : _backRef( 0 )
+      {}
+      /** Dtor */
+      virtual ~ResObjectImplIf() = 0;
+
+    private:
+      /** */
+      template<class _Res>
+        friend class ResImplConnect;
+      /** */
+      Resolvable * _backRef;
+    };
+    /////////////////////////////////////////////////////////////////
+
+    /////////////////////////////////////////////////////////////////
+  } // namespace detail
+  ///////////////////////////////////////////////////////////////////
+  /////////////////////////////////////////////////////////////////
+} // namespace zypp
+///////////////////////////////////////////////////////////////////
+#endif // ZYPP_DETAIL_RESOBJECTIMPLIF_H
index 934b1ca..0180013 100644 (file)
@@ -18,48 +18,9 @@ using namespace std;
 ///////////////////////////////////////////////////////////////////
 namespace zypp
 { /////////////////////////////////////////////////////////////////
-  ///////////////////////////////////////////////////////////////////
-  namespace detail
-  { /////////////////////////////////////////////////////////////////
-    IMPL_PTR_TYPE(ResolvableImpl)
 
-    ///////////////////////////////////////////////////////////////////
-    //
-    // METHOD NAME : ResolvableImpl::ResolvableImpl
-    // METHOD TYPE : Ctor
-    //
-    ResolvableImpl::ResolvableImpl( const ResKind & kind_r,
-                                    const std::string & name_r,
-                                    const Edition & edition_r,
-                                    const Arch & arch_r )
-    : _kind( kind_r )
-    , _name( name_r )
-    , _edition( edition_r )
-    , _arch( arch_r )
-    {}
 
-    ///////////////////////////////////////////////////////////////////
-    //
-    // METHOD NAME : ResolvableImpl::~ResolvableImpl
-    // METHOD TYPE : Dtor
-    //
-    ResolvableImpl::~ResolvableImpl()
-    {}
 
-    /******************************************************************
-     **
-     **        FUNCTION NAME : operator<<
-     **        FUNCTION TYPE : std::ostream &
-    */
-    std::ostream & operator<<( std::ostream & str, const ResolvableImpl & obj )
-    {
-      str << '[' << obj.kind() << ']' << obj.name() << '-' << obj.edition() << '.' << obj.arch();
-      return str;
-    }
-
-    /////////////////////////////////////////////////////////////////
-  } // namespace detail
-  ///////////////////////////////////////////////////////////////////
   /////////////////////////////////////////////////////////////////
 } // namespace zypp
 ///////////////////////////////////////////////////////////////////
index d133b85..27eb8a2 100644 (file)
 #ifndef ZYPP_DETAIL_RESOLVABLEIMPL_H
 #define ZYPP_DETAIL_RESOLVABLEIMPL_H
 
-#include <string>
-
-#include "zypp/base/ReferenceCounted.h"
-#include "zypp/base/NonCopyable.h"
-
-#include "zypp/ResKind.h"
-#include "zypp/Edition.h"
-#include "zypp/Arch.h"
-#include "zypp/Dependencies.h"
+#include "zypp/Resolvable.h"
 
 ///////////////////////////////////////////////////////////////////
 namespace zypp
 { /////////////////////////////////////////////////////////////////
-  ///////////////////////////////////////////////////////////////////
-  namespace detail
-  { /////////////////////////////////////////////////////////////////
-    DEFINE_PTR_TYPE(ResolvableImpl)
-
-    ///////////////////////////////////////////////////////////////////
-    //
-    // CLASS NAME : ResolvableImpl
-    //
-    /**
-     * \todo Assert \c deps provide 'name=edition'.
-    */
-    class ResolvableImpl : public base::ReferenceCounted, private base::NonCopyable
-    {
-    public:
-      /** Ctor */
-      ResolvableImpl( const ResKind & kind_r,
-                      const std::string & name_r,
-                      const Edition & edition_r,
-                      const Arch & arch_r );
-      /** Dtor */
-      virtual ~ResolvableImpl();
 
-    public:
-      /**  */
-      const ResKind & kind() const
-      { return _kind; }
-      /**  */
-      const std::string & name() const
-      { return _name; }
-      /**  */
-      const Edition & edition() const
-      { return _edition; }
-      /**  */
-      const Arch & arch() const
-      { return _arch; }
-      /**  */
-      const Dependencies & deps() const
-      { return _deps; }
-
-      /** Set Dependencies.
-       * \todo Check whether we can allow changes after final construction
-      */
-      void setDeps( const Dependencies & val_r )
-      { _deps = val_r; }
+  ///////////////////////////////////////////////////////////////////
+  //
+  //   CLASS NAME : Resolvable::Impl
+  //
+  /** Implementation of Resovable
+   * \todo Assert \c deps provide 'name=edition'.
+  */
+  struct Resolvable::Impl
+  {
+    /** Ctor */
+    Impl( const ResKind & kind_r,
+          const std::string & name_r,
+          const Edition & edition_r,
+          const Arch & arch_r )
+    : _kind( kind_r )
+    , _name( name_r )
+    , _edition( edition_r )
+    , _arch( arch_r )
+    {}
 
-    private:
-      /**  */
-      ResKind _kind;
-      /**  */
-      std::string _name;
-      /**  */
-      Edition _edition;
-      /**  */
-      Arch _arch;
-      /**  */
-      Dependencies _deps;
-    };
-    ///////////////////////////////////////////////////////////////////
+  public:
+    /**  */
+    const ResKind & kind() const
+    { return _kind; }
+    /**  */
+    const std::string & name() const
+    { return _name; }
+    /**  */
+    const Edition & edition() const
+    { return _edition; }
+    /**  */
+    const Arch & arch() const
+    { return _arch; }
+    /**  */
+    const Dependencies & deps() const
+    { return _deps; }
 
-    /** \relates ResolvableImpl Stream output */
-    extern std::ostream & operator<<( std::ostream & str, const ResolvableImpl & obj );
+    /** Set Dependencies.
+     * \todo Check whether we can allow changes after final construction
+    */
+    void setDeps( const Dependencies & val_r )
+    { _deps = val_r; }
 
-    /////////////////////////////////////////////////////////////////
-  } // namespace detail
+  private:
+    /**  */
+    ResKind _kind;
+    /**  */
+    std::string _name;
+    /**  */
+    Edition _edition;
+    /**  */
+    Arch _arch;
+    /**  */
+    Dependencies _deps;
+  };
   ///////////////////////////////////////////////////////////////////
+
   /////////////////////////////////////////////////////////////////
 } // namespace zypp
 ///////////////////////////////////////////////////////////////////
index 89e0fb4..da9e346 100644 (file)
@@ -20,7 +20,6 @@ namespace zypp
   ///////////////////////////////////////////////////////////////////
   namespace detail
   { /////////////////////////////////////////////////////////////////
-    IMPL_PTR_TYPE(ScriptImpl)
 
     ///////////////////////////////////////////////////////////////////
     //
@@ -29,19 +28,11 @@ namespace zypp
     ///////////////////////////////////////////////////////////////////
 
     /** Default ctor */
-    ScriptImpl::ScriptImpl( const std::string & name_r,
-                           const Edition & edition_r,
-                           const Arch & arch_r )
-    : ResolvableImpl( ResKind( "script"),
-                     name_r,
-                     edition_r,
-                     arch_r )
-    {
-    }
+    ScriptImpl::ScriptImpl()
+    {}
     /** Dtor */
     ScriptImpl::~ScriptImpl()
-    {
-    }
+    {}
 
     std::string ScriptImpl::do_script() const {
       return _do_script;
index b70db95..501a51e 100644 (file)
@@ -12,7 +12,7 @@
 #ifndef ZYPP_DETAIL_SCRIPTIMPL_H
 #define ZYPP_DETAIL_SCRIPTIMPL_H
 
-#include "zypp/detail/ResolvableImpl.h"
+#include "zypp/detail/ScriptImplIf.h"
 
 ///////////////////////////////////////////////////////////////////
 namespace zypp
@@ -20,20 +20,17 @@ namespace zypp
   ///////////////////////////////////////////////////////////////////
   namespace detail
   { /////////////////////////////////////////////////////////////////
-    DEFINE_PTR_TYPE(ScriptImpl)
 
     ///////////////////////////////////////////////////////////////////
     //
     // CLASS NAME : ScriptImpl
     //
     /** Class representing an update script */
-    class ScriptImpl : public ResolvableImpl
+    class ScriptImpl : public ScriptImplIf
     {
     public:
       /** Default ctor */
-      ScriptImpl( const std::string & name_r,
-                 const Edition & edition_r,
-                 const Arch & arch_r );
+      ScriptImpl();
       /** Dtor */
       ~ScriptImpl();
 
diff --git a/zypp/detail/ScriptImplIf.h b/zypp/detail/ScriptImplIf.h
new file mode 100644 (file)
index 0000000..985ff4d
--- /dev/null
@@ -0,0 +1,54 @@
+/*---------------------------------------------------------------------\
+|                          ____ _   __ __ ___                          |
+|                         |__  / \ / / . \ . \                         |
+|                           / / \ V /|  _/  _/                         |
+|                          / /__ | | | | | |                           |
+|                         /_____||_| |_| |_|                           |
+|                                                                      |
+\---------------------------------------------------------------------*/
+/** \file zypp/detail/ScriptImplIf.h
+ *
+*/
+#ifndef ZYPP_DETAIL_SCRIPTIMPLIF_H
+#define ZYPP_DETAIL_SCRIPTIMPLIF_H
+
+#include "zypp/detail/ResObjectImplIf.h"
+
+///////////////////////////////////////////////////////////////////
+namespace zypp
+{ /////////////////////////////////////////////////////////////////
+
+  class Script;
+
+  ///////////////////////////////////////////////////////////////////
+  namespace detail
+  { /////////////////////////////////////////////////////////////////
+
+    ///////////////////////////////////////////////////////////////////
+    //
+    // CLASS NAME : ScriptImplIf
+    //
+    /** Abstact Script implementation interface.
+    */
+    class ScriptImplIf : public ResObjectImplIf
+    {
+    public:
+      typedef Script ResType;
+
+    public:
+      /** Get the script to perform the change */
+      virtual std::string do_script() const = 0;
+      /** Get the script to undo the change */
+      virtual std::string undo_script() const = 0;
+      /** Check whether script to undo the change is available */
+      virtual bool undo_available() const = 0;
+    };
+    ///////////////////////////////////////////////////////////////////
+
+    /////////////////////////////////////////////////////////////////
+  } // namespace detail
+  ///////////////////////////////////////////////////////////////////
+  /////////////////////////////////////////////////////////////////
+} // namespace zypp
+///////////////////////////////////////////////////////////////////
+#endif // ZYPP_DETAIL_SCRIPTIMPLIF_H
index 1b9edc9..8bc812a 100644 (file)
@@ -9,8 +9,6 @@
 /** \file      zypp/detail/SelectionImpl.cc
  *
 */
-#include <iostream>
-
 #include "zypp/detail/SelectionImpl.h"
 
 using namespace std;
@@ -21,17 +19,13 @@ namespace zypp
   ///////////////////////////////////////////////////////////////////
   namespace detail
   { /////////////////////////////////////////////////////////////////
-    IMPL_PTR_TYPE(SelectionImpl)
 
     ///////////////////////////////////////////////////////////////////
     //
     // METHOD NAME : SelectionImpl::SelectionImpl
     // METHOD TYPE : Ctor
     //
-    SelectionImpl::SelectionImpl( const std::string & name_r,
-                                  const Edition & edition_r,
-                                  const Arch & arch_r )
-    : ResolvableImpl( ResKind("selection"), name_r, edition_r, arch_r )
+    SelectionImpl::SelectionImpl()
     {}
 
     ///////////////////////////////////////////////////////////////////
@@ -42,12 +36,6 @@ namespace zypp
     SelectionImpl::~SelectionImpl()
     {}
 
-    std::string SelectionImpl::summary() const
-    { return std::string(); }
-
-    std::list<std::string> SelectionImpl::description() const
-    { return std::list<std::string>(); }
-
     /////////////////////////////////////////////////////////////////
   } // namespace detail
   ///////////////////////////////////////////////////////////////////
index 2290beb..a9f3af0 100644 (file)
 #ifndef ZYPP_DETAIL_SELECTIONIMPL_H
 #define ZYPP_DETAIL_SELECTIONIMPL_H
 
-#include <list>
-
-#include "zypp/detail/ResolvableImpl.h"
+#include "zypp/detail/SelectionImplIf.h"
 
 ///////////////////////////////////////////////////////////////////
 namespace zypp
 { /////////////////////////////////////////////////////////////////
+
   ///////////////////////////////////////////////////////////////////
   namespace detail
   { /////////////////////////////////////////////////////////////////
-    DEFINE_PTR_TYPE(SelectionImpl)
 
     ///////////////////////////////////////////////////////////////////
     //
     // CLASS NAME : SelectionImpl
     //
-    /** */
-    class SelectionImpl : public ResolvableImpl
+    /**
+    */
+    class SelectionImpl : public SelectionImplIf
     {
     public:
-      /** */
-      SelectionImpl( const std::string & name_r,
-                     const Edition & edition_r,
-                     const Arch & arch_r );
-      /** Dtor */
+      SelectionImpl();
       virtual ~SelectionImpl();
-
-    public:
-      /** */
-      virtual std::string summary() const;
-      /** */
-      virtual std::list<std::string> description() const;
-#if 0
-      virtual std::string summary( const LangCode & lang = LangCode("") ) const;
-      virtual std::list<std::string> description( const LangCode & lang = LangCode("") ) const;
-      virtual std::list<std::string> insnotify( const LangCode & lang = LangCode("") ) const;
-      virtual std::list<std::string> delnotify( const LangCode & lang = LangCode("") ) const;
-      virtual FSize size() const;
-      virtual bool providesSources() const;
-      virtual std::string instSrcLabel() const;
-      virtual Vendor instSrcVendor() const;
-      virtual unsigned instSrcRank() const;
-      virtual std::string category() const;
-      virtual bool visible() const;
-      virtual std::list<std::string> suggests() const;
-      virtual std::list<PMSelectionPtr> suggests_ptrs() const;
-      virtual std::list<std::string> recommends() const;
-      virtual std::list<PMSelectionPtr> recommends_ptrs() const;
-      virtual std::list<std::string> inspacks( const LangCode & lang = LangCode("") ) const;
-      virtual std::list<std::string> delpacks( const LangCode & lang = LangCode("") ) const;
-      virtual PM::LocaleSet supportedLocales() const;
-      virtual std::set<PMSelectablePtr> pureInspacks_ptrs( const LangCode & lang ) const;
-      virtual std::set<PMSelectablePtr> inspacks_ptrs( const LangCode & lang ) const;
-      virtual std::set<PMSelectablePtr> delpacks_ptrs( const LangCode & lang ) const;
-      virtual FSize archivesize() const;
-      virtual std::string order() const;
-      virtual bool isBase() const;
-      virtual PMError provideSelToInstall( Pathname & path_r ) const;
-#endif
     };
     ///////////////////////////////////////////////////////////////////
 
diff --git a/zypp/detail/SelectionImplIf.h b/zypp/detail/SelectionImplIf.h
new file mode 100644 (file)
index 0000000..292799c
--- /dev/null
@@ -0,0 +1,75 @@
+/*---------------------------------------------------------------------\
+|                          ____ _   __ __ ___                          |
+|                         |__  / \ / / . \ . \                         |
+|                           / / \ V /|  _/  _/                         |
+|                          / /__ | | | | | |                           |
+|                         /_____||_| |_| |_|                           |
+|                                                                      |
+\---------------------------------------------------------------------*/
+/** \file      zypp/detail/SelectionImplIf.h
+ *
+*/
+#ifndef ZYPP_DETAIL_SELECTIONIMPLIF_H
+#define ZYPP_DETAIL_SELECTIONIMPLIF_H
+
+#include "zypp/detail/ResObjectImplIf.h"
+
+///////////////////////////////////////////////////////////////////
+namespace zypp
+{ /////////////////////////////////////////////////////////////////
+
+  class Selection;
+
+  ///////////////////////////////////////////////////////////////////
+  namespace detail
+  { /////////////////////////////////////////////////////////////////
+
+    ///////////////////////////////////////////////////////////////////
+    //
+    // CLASS NAME : SelectionImplIf
+    //
+    /** Abstact Selection implementation interface.
+    */
+    class SelectionImplIf : public ResObjectImplIf
+    {
+    public:
+      typedef Selection ResType;
+
+    public:
+#if 0
+      virtual std::string summary( const LangCode & lang = LangCode("") ) const;
+      virtual std::list<std::string> description( const LangCode & lang = LangCode("") ) const;
+      virtual std::list<std::string> insnotify( const LangCode & lang = LangCode("") ) const;
+      virtual std::list<std::string> delnotify( const LangCode & lang = LangCode("") ) const;
+      virtual FSize size() const;
+      virtual bool providesSources() const;
+      virtual std::string instSrcLabel() const;
+      virtual Vendor instSrcVendor() const;
+      virtual unsigned instSrcRank() const;
+      virtual std::string category() const;
+      virtual bool visible() const;
+      virtual std::list<std::string> suggests() const;
+      virtual std::list<PMSelectionPtr> suggests_ptrs() const;
+      virtual std::list<std::string> recommends() const;
+      virtual std::list<PMSelectionPtr> recommends_ptrs() const;
+      virtual std::list<std::string> inspacks( const LangCode & lang = LangCode("") ) const;
+      virtual std::list<std::string> delpacks( const LangCode & lang = LangCode("") ) const;
+      virtual PM::LocaleSet supportedLocales() const;
+      virtual std::set<PMSelectablePtr> pureInspacks_ptrs( const LangCode & lang ) const;
+      virtual std::set<PMSelectablePtr> inspacks_ptrs( const LangCode & lang ) const;
+      virtual std::set<PMSelectablePtr> delpacks_ptrs( const LangCode & lang ) const;
+      virtual FSize archivesize() const;
+      virtual std::string order() const;
+      virtual bool isBase() const;
+      virtual PMError provideSelToInstall( Pathname & path_r ) const;
+#endif
+    };
+    ///////////////////////////////////////////////////////////////////
+
+    /////////////////////////////////////////////////////////////////
+  } // namespace detail
+  ///////////////////////////////////////////////////////////////////
+  /////////////////////////////////////////////////////////////////
+} // namespace zypp
+///////////////////////////////////////////////////////////////////
+#endif // ZYPP_DETAIL_SELECTIONIMPLIF_H
index 1f4f8b9..b9c7c9d 100644 (file)
@@ -23,23 +23,26 @@ namespace zypp
   { /////////////////////////////////////////////////////////////////
     namespace YUM
     {
-      IMPL_PTR_TYPE(YUMScriptImpl)
-  
+
       ///////////////////////////////////////////////////////////////////
       //
       //        CLASS NAME : YUMScriptImpl
       //
       ///////////////////////////////////////////////////////////////////
-  
+
       /** Default ctor */
       YUMScriptImpl::YUMScriptImpl(
        const zypp::parser::YUM::YUMPatchScript & parsed
       )
+#warning MA: CANT BE CONSTUCTED THAT WAY ANYMORE
+#if 0
       : ScriptImpl(
        parsed.name,
        Edition(parsed.ver, parsed.rel, strtol(parsed.epoch.c_str(), NULL, 10)),
        Arch("noarch")
+
       )
+#endif
       {
        _do_script = parsed.do_script;
        _undo_script = parsed.undo_script;
@@ -53,7 +56,7 @@ namespace zypp
 
 */
       }
-    } // namespace YUM 
+    } // namespace YUM
     /////////////////////////////////////////////////////////////////
   } // namespace source
   ///////////////////////////////////////////////////////////////////
index d01eefa..9a911d1 100644 (file)
@@ -24,8 +24,6 @@ namespace zypp
     namespace YUM
     { //////////////////////////////////////////////////////////////
 
-      DEFINE_PTR_TYPE(YUMScriptImpl)
-  
       ///////////////////////////////////////////////////////////////////
       //
       //        CLASS NAME : YUMScriptImpl