capability backup
authorMichael Andres <ma@suse.de>
Mon, 24 Oct 2005 18:59:20 +0000 (18:59 +0000)
committerMichael Andres <ma@suse.de>
Mon, 24 Oct 2005 18:59:20 +0000 (18:59 +0000)
35 files changed:
configure.ac
test/devel.ma/Makefile.am
test/devel.ma/ma_test
test/genclass.in
zypp/Capability.cc [new file with mode: 0644]
zypp/Capability.h [new file with mode: 0644]
zypp/Edition.h
zypp/Makefile.am
zypp/RelOp.h [new file with mode: 0644]
zypp/Resolvable.cc
zypp/ResolvableFwd.h [new file with mode: 0644]
zypp/SolverContext.cc [new file with mode: 0644]
zypp/SolverContext.h [new file with mode: 0644]
zypp/SolverContextFwd.h [new file with mode: 0644]
zypp/base/PtrTypes.h
zypp/base/ReferenceCounted.h
zypp/capability/.cvsignore [new file with mode: 0644]
zypp/capability/CapabilityImpl.cc [new file with mode: 0644]
zypp/capability/CapabilityImpl.h [new file with mode: 0644]
zypp/capability/ConditionalCap.h [new file with mode: 0644]
zypp/capability/FileCap.h [new file with mode: 0644]
zypp/capability/Makefile.am [new file with mode: 0644]
zypp/capability/NamedCap.h [new file with mode: 0644]
zypp/capability/OrCap.h [new file with mode: 0644]
zypp/capability/VersionedCap.h [new file with mode: 0644]
zypp/detail/Makefile.am
zypp/detail/MessageImpl.cc
zypp/detail/MessageImpl.h
zypp/detail/PackageImpl.cc
zypp/detail/PatchImpl.cc
zypp/detail/PatchImpl.h
zypp/detail/ResolvableImpl.cc
zypp/detail/ScriptImpl.cc
zypp/detail/ScriptImpl.h
zypp/detail/SelectionImpl.cc

index ca7f1d2..63de336 100644 (file)
@@ -104,7 +104,8 @@ AC_OUTPUT(  \
        test/devel.ma/Makefile          \
        zypp/Makefile           \
        zypp/base/Makefile      \
-       zypp/detail/Makefile
+       zypp/detail/Makefile    \
+       zypp/capability/Makefile
 )
 dnl ==================================================
 
index 8cd61ee..45abf23 100644 (file)
@@ -1,7 +1,7 @@
 ## Process this file with automake to produce Makefile.in
 ## ##################################################
 
-noinst_PROGRAMS =      Main Main.debug
+noinst_PROGRAMS =      Main Main.debug PtrTest
 
 ## ##################################################
 
@@ -22,6 +22,10 @@ Main_debug_LDFLAGS = -static
 
 ## ##################################################
 
+PtrTest_SOURCES =      PtrTest.cc
+
+## ##################################################
+
 .PHONY:        always
 
 $(noinst_PROGRAMS):    $(top_srcdir)/zypp/lib@PACKAGE@.la
index 41cc3c9..021e155 100755 (executable)
@@ -29,7 +29,7 @@ else
        MAKE="make -j 15"
 fi
 
-$MAKE -C ../zypp || exit 1
+$MAKE -C ../../zypp || exit 1
 $MAKE $PRG || exit 1
 
 ./$PRG "$@" 2> $LPIPE
index 1e41a4e..69b539f 100644 (file)
@@ -104,6 +104,13 @@ $(intro $CLASS_H)
 #include "zypp/base/PtrTypes.h"
 
 $(nsopen)
+${INDENT}///////////////////////////////////////////////////////////////////
+${INDENT}namespace detail
+${INDENT}{ /////////////////////////////////////////////////////////////////
+${INDENT}  DEFINE_PTR_TYPE(${CLASS}Impl)
+${INDENT}  /////////////////////////////////////////////////////////////////
+${INDENT}} // namespace detail
+${INDENT}///////////////////////////////////////////////////////////////////
 
 ${INDENT}///////////////////////////////////////////////////////////////////
 ${INDENT}//
@@ -115,21 +122,24 @@ ${INDENT}{
 ${INDENT}public:
 ${INDENT}  /** Default ctor */
 ${INDENT}  ${CLASS}();
-
+${INDENT}  /** Factory ctor */
+${INDENT}  explicit
+${INDENT}  ${CLASS}( detail::${CLASS}ImplPtr impl_r );
 ${INDENT}  /** Dtor */
 ${INDENT}  ~${CLASS}();
 
-${INDENT}  /** Stream output */
-${INDENT}  friend std::ostream & operator<<( std::ostream & str, const ${CLASS} & obj );
-
 ${INDENT}private:
-${INDENT}  /** Hides implementation */
-${INDENT}  struct Impl;
 ${INDENT}  /** Pointer to implementation */
-${INDENT}  base::shared_ptr<Impl> _pimpl;
+${INDENT}  detail::${CLASS}ImplPtr _pimpl;
+${INDENT}public:
+${INDENT}  /** Avoid a bunch of friend decl. */
+${INDENT}  detail::const${CLASS}ImplPtr sayFriend() const;
 ${INDENT}};
 ${INDENT}///////////////////////////////////////////////////////////////////
 
+${INDENT}/** \relates ${CLASS} Stream output */
+${INDENT}extern std::ostream & operator<<( std::ostream & str, const ${CLASS} & obj );
+
 $(nsclose)
 #endif // $INCLUDE_DEF
 EOF
@@ -142,8 +152,8 @@ cat <<EOF
 $(intro $CLASS_CC)
 #include <iostream>
 
-#include "zypp/base/Logger.h"
-#include "zypp/base/BaseTypes.h"
+#include "zypp/base/ReferenceCounted.h"
+#include "zypp/base/NonCopyable.h"
 #include "${INCLUDE_H}"
 
 using namespace std;
@@ -151,35 +161,33 @@ using namespace std;
 $(nsopen)
 
 ${INDENT}///////////////////////////////////////////////////////////////////
-${INDENT}//
-${INDENT}//    CLASS NAME : ${CLASS}::Impl
-${INDENT}//
-${INDENT}/** ${CLASS} implementation */
-${INDENT}struct ${CLASS}::Impl : private zypp::base::noncopyable
-${INDENT}{
-${INDENT}  /** Default ctor*/
-${INDENT}  Impl();
-
-${INDENT}  /** Dtor */
-${INDENT}  ~Impl();
-
-${INDENT}  /** Stream output */
-${INDENT}  friend std::ostream & operator<<( std::ostream & str, const Impl & obj );
-
-${INDENT}};
+${INDENT}namespace detail
+${INDENT}{ /////////////////////////////////////////////////////////////////
+
+${INDENT}  ///////////////////////////////////////////////////////////////////
+${INDENT}  //
+${INDENT}  //  CLASS NAME : ${CLASS}Impl
+${INDENT}  //
+${INDENT}  /** ${CLASS} implementation */
+${INDENT}  struct ${CLASS}Impl : public base::ReferenceCounted, private base::NonCopyable
+${INDENT}  {
+${INDENT}    /** Default ctor*/
+${INDENT}    ${CLASS}Impl();
+${INDENT}    /** Dtor */
+${INDENT}    ~${CLASS}Impl();
+${INDENT}  };
+${INDENT}  ///////////////////////////////////////////////////////////////////
+
+${INDENT}  /** \relates ${CLASS}Impl Stream output */
+${INDENT}  inline std::ostream & operator<<( std::ostream & str, const ${CLASS}Impl & obj )
+${INDENT}  {
+${INDENT}    return str << "${CLASS}Impl";
+${INDENT}  }
+
+${INDENT}  /////////////////////////////////////////////////////////////////
+${INDENT}} // namespace detail
 ${INDENT}///////////////////////////////////////////////////////////////////
 
-${INDENT}/******************************************************************
-${INDENT}**
-${INDENT}**    FUNCTION NAME : operator<<
-${INDENT}**    FUNCTION TYPE : std::ostream &
-${INDENT}*/
-${INDENT}std::ostream & operator<<( std::ostream & str, const ${CLASS}::Impl & obj )
-${INDENT}{
-${INDENT}  return str << "${CLASS}::Impl";
-${INDENT}}
-
-
 ${INDENT}///////////////////////////////////////////////////////////////////
 ${INDENT}//
 ${INDENT}//    CLASS NAME : ${CLASS}
@@ -196,12 +204,29 @@ ${INDENT}{}
 
 ${INDENT}///////////////////////////////////////////////////////////////////
 ${INDENT}//
+${INDENT}//    METHOD NAME : ${CLASS}::${CLASS}
+${INDENT}//    METHOD TYPE : Ctor
+${INDENT}//
+${INDENT}${CLASS}::${CLASS}( detail::${CLASS}ImplPtr impl_r )
+${INDENT}: _pimpl( impl_r )
+${INDENT}{}
+
+${INDENT}///////////////////////////////////////////////////////////////////
+${INDENT}//
 ${INDENT}//    METHOD NAME : ${CLASS}::~${CLASS}
 ${INDENT}//    METHOD TYPE : Dtor
 ${INDENT}//
 ${INDENT}${CLASS}::~${CLASS}()
 ${INDENT}{}
 
+${INDENT}///////////////////////////////////////////////////////////////////
+${INDENT}//
+${INDENT}//    METHOD NAME : ${CLASS}::sayFriend
+${INDENT}//    METHOD TYPE : detail::const${CLASS}ImplPtr
+${INDENT}//
+${INDENT}detail::const${CLASS}ImplPtr ${CLASS}::sayFriend() const
+${INDENT}{ return _pimpl; }
+
 ${INDENT}/******************************************************************
 ${INDENT}**
 ${INDENT}**    FUNCTION NAME : operator<<
@@ -209,7 +234,7 @@ ${INDENT}** FUNCTION TYPE : std::ostream &
 ${INDENT}*/
 ${INDENT}std::ostream & operator<<( std::ostream & str, const ${CLASS} & obj )
 ${INDENT}{
-${INDENT}  return str << obj._pimpl;
+${INDENT}  return str << *obj.sayFriend();
 ${INDENT}}
 
 $(nsclose)
diff --git a/zypp/Capability.cc b/zypp/Capability.cc
new file mode 100644 (file)
index 0000000..7b44072
--- /dev/null
@@ -0,0 +1,69 @@
+/*---------------------------------------------------------------------\
+|                          ____ _   __ __ ___                          |
+|                         |__  / \ / / . \ . \                         |
+|                           / / \ V /|  _/  _/                         |
+|                          / /__ | | | | | |                           |
+|                         /_____||_| |_| |_|                           |
+|                                                                      |
+\---------------------------------------------------------------------*/
+/** \file zypp/Capability.cc
+ *
+*/
+#include <iostream>
+
+#include "zypp/Capability.h"
+#include "zypp/capability/CapabilityImpl.h"
+
+#include "zypp/SolverContext.h"
+
+using namespace std;
+
+///////////////////////////////////////////////////////////////////
+namespace zypp
+{ /////////////////////////////////////////////////////////////////
+
+  ///////////////////////////////////////////////////////////////////
+  //
+  //   METHOD NAME : Capability::Capability
+  //   METHOD TYPE : Ctor
+  //
+  Capability::Capability( ImplPtr impl_r )
+  : _pimpl( impl_r )
+  {}
+
+  ///////////////////////////////////////////////////////////////////
+  //
+  //   METHOD NAME : Capability::~Capability
+  //   METHOD TYPE : Dtor
+  //
+  Capability::~Capability()
+  {}
+
+  ///////////////////////////////////////////////////////////////////
+  //
+  //   METHOD NAME : Capability::sayFriend
+  //   METHOD TYPE : capability::constCapabilityImplPtr
+  //
+  Capability::constImplPtr Capability::sayFriend() const
+  { return _pimpl; }
+
+  bool Capability::matches( constResolvablePtr resolvable_r,
+                            const SolverContext & solverContext_r )
+  { return _pimpl->matches( resolvable_r, solverContext_r ); }
+
+  bool Capability::matches( constResolvablePtr resolvable_r )
+  { return _pimpl->matches( resolvable_r, SolverContext() ); }
+
+  /******************************************************************
+  **
+  **   FUNCTION NAME : operator<<
+  **   FUNCTION TYPE : std::ostream &
+  */
+  std::ostream & operator<<( std::ostream & str, const Capability & obj )
+  {
+    return str << *obj.sayFriend();
+  }
+
+  /////////////////////////////////////////////////////////////////
+} // namespace zypp
+///////////////////////////////////////////////////////////////////
diff --git a/zypp/Capability.h b/zypp/Capability.h
new file mode 100644 (file)
index 0000000..f958259
--- /dev/null
@@ -0,0 +1,72 @@
+/*---------------------------------------------------------------------\
+|                          ____ _   __ __ ___                          |
+|                         |__  / \ / / . \ . \                         |
+|                           / / \ V /|  _/  _/                         |
+|                          / /__ | | | | | |                           |
+|                         /_____||_| |_| |_|                           |
+|                                                                      |
+\---------------------------------------------------------------------*/
+/** \file zypp/Capability.h
+ *
+*/
+#ifndef ZYPP_CAPABILITY_H
+#define ZYPP_CAPABILITY_H
+
+#include <iosfwd>
+
+#include "zypp/base/PtrTypes.h"
+
+#include "zypp/ResolvableFwd.h"
+#include "zypp/SolverContextFwd.h"
+
+///////////////////////////////////////////////////////////////////
+namespace zypp
+{ /////////////////////////////////////////////////////////////////
+  ///////////////////////////////////////////////////////////////////
+  namespace capability
+  { /////////////////////////////////////////////////////////////////
+    DEFINE_PTR_TYPE(CapabilityImpl);
+    /////////////////////////////////////////////////////////////////
+  } // namespace capability
+  ///////////////////////////////////////////////////////////////////
+
+  ///////////////////////////////////////////////////////////////////
+  //
+  //   CLASS NAME : Capability
+  //
+  /** */
+  class Capability
+  {
+    typedef capability::CapabilityImplPtr      ImplPtr;
+    typedef capability::constCapabilityImplPtr constImplPtr;
+
+  public:
+    /** Factory ctor */
+    explicit
+    Capability( ImplPtr impl_r );
+    /** Dtor */
+    virtual ~Capability();
+
+  public:
+    /**  */
+    bool matches( constResolvablePtr resolvable_r,
+                  const SolverContext & colverContext_r );
+    /**  */
+    bool matches( constResolvablePtr resolvable_r );
+
+  private:
+    /** Pointer to implementation */
+    ImplPtr _pimpl;
+  public:
+    /** Avoid a bunch of friend decl. */
+    constImplPtr sayFriend() const;
+  };
+  ///////////////////////////////////////////////////////////////////
+
+  /** \relates Capability Stream output */
+  extern std::ostream & operator<<( std::ostream & str, const Capability & obj );
+
+  /////////////////////////////////////////////////////////////////
+} // namespace zypp
+///////////////////////////////////////////////////////////////////
+#endif // ZYPP_CAPABILITY_H
index 57fb66f..1ba5894 100644 (file)
@@ -16,6 +16,7 @@
 #include <string>
 
 #include "zypp/base/PtrTypes.h"
+#include "zypp/RelOp.h"
 
 ///////////////////////////////////////////////////////////////////
 namespace zypp
@@ -29,7 +30,9 @@ namespace zypp
   class Edition
   {
   public:
+    /** */
     typedef unsigned epoch_t;
+
   public:
     /** Default ctor */
     Edition();
@@ -39,6 +42,7 @@ namespace zypp
              epoch_t epoch = 0 );
     /** Dtor */
     ~Edition();
+
   public:
     /** */
     epoch_t epoch() const;
@@ -46,6 +50,7 @@ namespace zypp
     const std::string & version() const;
     /** */
     const std::string & release() const;
+
   private:
     /** Hides implementation */
     struct Impl;
@@ -54,7 +59,7 @@ namespace zypp
   };
   ///////////////////////////////////////////////////////////////////
 
-  /** \relates ResEdition Stream output */
+  /** \relates Edition Stream output */
   extern std::ostream & operator<<( std::ostream & str, const Edition & obj );
 
   /////////////////////////////////////////////////////////////////
index c39e7a0..3e813c3 100644 (file)
@@ -1,12 +1,13 @@
 ## Process this file with automake to produce Makefile.in
 ## ##################################################
 
-SUBDIRS = base detail
+SUBDIRS = base detail capability
 
 ## ##################################################
 
 include_HEADERS = \
        Arch.h          \
+       Capability.h    \
        Edition.h       \
        ResKind.h       \
        Resolvable.h    \
@@ -14,6 +15,7 @@ include_HEADERS = \
        Selection.h     \
        Message.h       \
        Script.h        \
+       SolverContext.h \
        Patch.h
 
 ## ##################################################
@@ -24,6 +26,7 @@ lib_LTLIBRARIES =     lib@PACKAGE@.la
 
 lib@PACKAGE@_la_SOURCES = \
        Arch.cc         \
+       Capability.cc   \
        Edition.cc      \
        ResKind.cc      \
        Resolvable.cc   \
@@ -31,11 +34,13 @@ lib@PACKAGE@_la_SOURCES = \
        Selection.cc    \
        Message.cc      \
        Script.cc       \
+       SolverContext.cc\
        Patch.cc
 
 lib@PACKAGE@_la_LDFLAGS =      @LIB_VERSION_INFO@
 
 lib@PACKAGE@_la_LIBADD =        base/lib@PACKAGE@_base.la      \
-                               detail/lib@PACKAGE@_detail.la
+                               detail/lib@PACKAGE@_detail.la   \
+                               capability/lib@PACKAGE@_capability.la
 
 ## ##################################################
diff --git a/zypp/RelOp.h b/zypp/RelOp.h
new file mode 100644 (file)
index 0000000..daae2ff
--- /dev/null
@@ -0,0 +1,24 @@
+/*---------------------------------------------------------------------\
+|                          ____ _   __ __ ___                          |
+|                         |__  / \ / / . \ . \                         |
+|                           / / \ V /|  _/  _/                         |
+|                          / /__ | | | | | |                           |
+|                         /_____||_| |_| |_|                           |
+|                                                                      |
+\---------------------------------------------------------------------*/
+/** \file zypp/RelOp.h
+ *
+*/
+#ifndef ZYPP_RELOP_H
+#define ZYPP_RELOP_H
+
+///////////////////////////////////////////////////////////////////
+namespace zypp
+{ /////////////////////////////////////////////////////////////////
+
+  enum RelOp { ANY, EQ, NE, LT, LE, GT, GE, NONE };
+
+  /////////////////////////////////////////////////////////////////
+} // namespace zypp
+///////////////////////////////////////////////////////////////////
+#endif // ZYPP_RELOP_H
index e7271d6..a2eaf8f 100644 (file)
@@ -17,6 +17,7 @@ using namespace std;
 ///////////////////////////////////////////////////////////////////
 namespace zypp
 { /////////////////////////////////////////////////////////////////
+  IMPL_PTR_TYPE(Resolvable)
 
   ///////////////////////////////////////////////////////////////////
   //
diff --git a/zypp/ResolvableFwd.h b/zypp/ResolvableFwd.h
new file mode 100644 (file)
index 0000000..c1ad9f9
--- /dev/null
@@ -0,0 +1,26 @@
+/*---------------------------------------------------------------------\
+|                          ____ _   __ __ ___                          |
+|                         |__  / \ / / . \ . \                         |
+|                           / / \ V /|  _/  _/                         |
+|                          / /__ | | | | | |                           |
+|                         /_____||_| |_| |_|                           |
+|                                                                      |
+\---------------------------------------------------------------------*/
+/** \file zypp/ResolvableFwd.h
+ *
+*/
+#ifndef ZYPP_RESOLVABLEFWD_H
+#define ZYPP_RESOLVABLEFWD_H
+
+#include "zypp/base/PtrTypes.h"
+
+///////////////////////////////////////////////////////////////////
+namespace zypp
+{ /////////////////////////////////////////////////////////////////
+
+  DEFINE_PTR_TYPE(Resolvable)
+
+  /////////////////////////////////////////////////////////////////
+} // namespace zypp
+///////////////////////////////////////////////////////////////////
+#endif // ZYPP_RESOLVABLEFWD_H
diff --git a/zypp/SolverContext.cc b/zypp/SolverContext.cc
new file mode 100644 (file)
index 0000000..7d97df8
--- /dev/null
@@ -0,0 +1,105 @@
+/*---------------------------------------------------------------------\
+|                          ____ _   __ __ ___                          |
+|                         |__  / \ / / . \ . \                         |
+|                           / / \ V /|  _/  _/                         |
+|                          / /__ | | | | | |                           |
+|                         /_____||_| |_| |_|                           |
+|                                                                      |
+\---------------------------------------------------------------------*/
+/** \file      zypp/SolverContext.cc
+ *
+*/
+#include <iostream>
+
+#include "zypp/base/ReferenceCounted.h"
+#include "zypp/base/NonCopyable.h"
+#include "zypp/SolverContext.h"
+
+using namespace std;
+
+///////////////////////////////////////////////////////////////////
+namespace zypp
+{ /////////////////////////////////////////////////////////////////
+
+  ///////////////////////////////////////////////////////////////////
+  namespace detail
+  { /////////////////////////////////////////////////////////////////
+
+    ///////////////////////////////////////////////////////////////////
+    //
+    // CLASS NAME : SolverContextImpl
+    //
+    /** SolverContext implementation */
+    struct SolverContextImpl : public base::ReferenceCounted, private base::NonCopyable
+    {
+      /** Default ctor*/
+      SolverContextImpl();
+      /** Dtor */
+      ~SolverContextImpl();
+    };
+    ///////////////////////////////////////////////////////////////////
+
+    IMPL_PTR_TYPE(SolverContextImpl)
+
+    /** \relates SolverContextImpl Stream output */
+    inline std::ostream & operator<<( std::ostream & str, const SolverContextImpl & obj )
+    {
+      return str << "SolverContextImpl";
+    }
+
+    /////////////////////////////////////////////////////////////////
+  } // namespace detail
+  ///////////////////////////////////////////////////////////////////
+
+  ///////////////////////////////////////////////////////////////////
+  //
+  //   CLASS NAME : SolverContext
+  //
+  ///////////////////////////////////////////////////////////////////
+
+  ///////////////////////////////////////////////////////////////////
+  //
+  //   METHOD NAME : SolverContext::SolverContext
+  //   METHOD TYPE : Ctor
+  //
+  SolverContext::SolverContext()
+  {}
+
+  ///////////////////////////////////////////////////////////////////
+  //
+  //   METHOD NAME : SolverContext::SolverContext
+  //   METHOD TYPE : Ctor
+  //
+  SolverContext::SolverContext( detail::SolverContextImplPtr impl_r )
+  : _pimpl( impl_r )
+  {}
+
+  ///////////////////////////////////////////////////////////////////
+  //
+  //   METHOD NAME : SolverContext::~SolverContext
+  //   METHOD TYPE : Dtor
+  //
+  SolverContext::~SolverContext()
+  {}
+
+  ///////////////////////////////////////////////////////////////////
+  //
+  //   METHOD NAME : SolverContext::sayFriend
+  //   METHOD TYPE : detail::constSolverContextImplPtr
+  //
+  detail::constSolverContextImplPtr SolverContext::sayFriend() const
+  { return _pimpl; }
+
+  /******************************************************************
+  **
+  **   FUNCTION NAME : operator<<
+  **   FUNCTION TYPE : std::ostream &
+  */
+  std::ostream & operator<<( std::ostream & str, const SolverContext & obj )
+  {
+    return str << *obj.sayFriend();
+  }
+
+  /////////////////////////////////////////////////////////////////
+} // namespace zypp
+///////////////////////////////////////////////////////////////////
diff --git a/zypp/SolverContext.h b/zypp/SolverContext.h
new file mode 100644 (file)
index 0000000..36a5bba
--- /dev/null
@@ -0,0 +1,61 @@
+/*---------------------------------------------------------------------\
+|                          ____ _   __ __ ___                          |
+|                         |__  / \ / / . \ . \                         |
+|                           / / \ V /|  _/  _/                         |
+|                          / /__ | | | | | |                           |
+|                         /_____||_| |_| |_|                           |
+|                                                                      |
+\---------------------------------------------------------------------*/
+/** \file      zypp/SolverContext.h
+ *
+*/
+#ifndef ZYPP_SOLVERCONTEXT_H
+#define ZYPP_SOLVERCONTEXT_H
+
+#include <iosfwd>
+
+#include "zypp/base/PtrTypes.h"
+
+///////////////////////////////////////////////////////////////////
+namespace zypp
+{ /////////////////////////////////////////////////////////////////
+  ///////////////////////////////////////////////////////////////////
+  namespace detail
+  { /////////////////////////////////////////////////////////////////
+    DEFINE_PTR_TYPE(SolverContextImpl)
+    /////////////////////////////////////////////////////////////////
+  } // namespace detail
+  ///////////////////////////////////////////////////////////////////
+
+  ///////////////////////////////////////////////////////////////////
+  //
+  //   CLASS NAME : SolverContext
+  //
+  /** */
+  class SolverContext
+  {
+  public:
+    /** Default ctor */
+    SolverContext();
+    /** Factory ctor */
+    explicit
+    SolverContext( detail::SolverContextImplPtr impl_r );
+    /** Dtor */
+    ~SolverContext();
+
+  private:
+    /** Pointer to implementation */
+    detail::SolverContextImplPtr _pimpl;
+  public:
+    /** Avoid a bunch of friend decl. */
+    detail::constSolverContextImplPtr sayFriend() const;
+  };
+  ///////////////////////////////////////////////////////////////////
+
+  /** \relates SolverContext Stream output */
+  extern std::ostream & operator<<( std::ostream & str, const SolverContext & obj );
+
+  /////////////////////////////////////////////////////////////////
+} // namespace zypp
+///////////////////////////////////////////////////////////////////
+#endif // ZYPP_SOLVERCONTEXT_H
diff --git a/zypp/SolverContextFwd.h b/zypp/SolverContextFwd.h
new file mode 100644 (file)
index 0000000..aaa9c91
--- /dev/null
@@ -0,0 +1,24 @@
+/*---------------------------------------------------------------------\
+|                          ____ _   __ __ ___                          |
+|                         |__  / \ / / . \ . \                         |
+|                           / / \ V /|  _/  _/                         |
+|                          / /__ | | | | | |                           |
+|                         /_____||_| |_| |_|                           |
+|                                                                      |
+\---------------------------------------------------------------------*/
+/** \file      zypp/SolverContextFwd.h
+ *
+*/
+#ifndef ZYPP_SOLVERCONTEXTFWD_H
+#define ZYPP_SOLVERCONTEXTFWD_H
+
+///////////////////////////////////////////////////////////////////
+namespace zypp
+{ /////////////////////////////////////////////////////////////////
+
+  class SolverContext;
+
+  /////////////////////////////////////////////////////////////////
+} // namespace zypp
+///////////////////////////////////////////////////////////////////
+#endif // ZYPP_SOLVERCONTEXTFWD_H
index 8f339ec..1e526f2 100644 (file)
@@ -16,6 +16,7 @@
 #include <boost/scoped_ptr.hpp>
 #include <boost/shared_ptr.hpp>
 #include <boost/weak_ptr.hpp>
+#include <boost/intrusive_ptr.hpp>
 
 ///////////////////////////////////////////////////////////////////
 namespace zypp
@@ -47,6 +48,12 @@ namespace zypp
     /** */
     using boost::weak_ptr;
 
+    /** Use boost::intrusive_ptr as Ptr type*/
+    using boost::intrusive_ptr;
+    using boost::static_pointer_cast;
+    using boost::const_pointer_cast;
+    using boost::dynamic_pointer_cast;
+
     /*@}*/
 
     /////////////////////////////////////////////////////////////////
@@ -55,4 +62,14 @@ namespace zypp
   /////////////////////////////////////////////////////////////////
 } // namespace zypp
 ///////////////////////////////////////////////////////////////////
+
+/** Forward declaration of Ptr types */
+#define DEFINE_PTR_TYPE(NAME) \
+class NAME;                                                      \
+extern void intrusive_ptr_add_ref( const NAME * );               \
+extern void intrusive_ptr_release( const NAME * );               \
+typedef zypp::base::intrusive_ptr<NAME>       NAME##Ptr;         \
+typedef zypp::base::intrusive_ptr<const NAME> const##NAME##Ptr;
+
+///////////////////////////////////////////////////////////////////
 #endif // ZYPP_BASE_PTRTYPES_H
index 6eec4b5..210db2c 100644 (file)
@@ -13,7 +13,8 @@
 #define ZYPP_BASE_REFERENCECOUNTED_H
 
 #include <iosfwd>
-#include <boost/intrusive_ptr.hpp>
+
+#include "zypp/base/PtrTypes.h"
 
 ///////////////////////////////////////////////////////////////////
 namespace zypp
@@ -77,32 +78,24 @@ namespace zypp
           delete this;
       }
 
+      /** Called by zypp::base::intrusive_ptr to add a reference.
+       * \see ZYPP_BASE_SMART_PTR
+      */
+      static void add_ref( const ReferenceCounted * ptr_r )
+      { if( ptr_r ) ptr_r->ref(); }
+
+      /** Called by zypp::base::intrusive_ptr to add a reference.
+       * \see ZYPP_BASE_SMART_PTR
+      */
+      static void release( const ReferenceCounted * ptr_r )
+      { if( ptr_r ) ptr_r->unref(); }
+
     private:
       /** The reference counter. */
       mutable unsigned _counter;
     };
     ///////////////////////////////////////////////////////////////////
 
-    /** Use boost::intrusive_ptr as Ptr type*/
-    using boost::intrusive_ptr;
-    using boost::static_pointer_cast;
-    using boost::const_pointer_cast;
-    using boost::dynamic_pointer_cast;
-
-    /** Called by zypp::base::intrusive_ptr to add a reference.
-     * \relates ReferenceCounted
-     * \see ZYPP_BASE_SMART_PTR
-    */
-    inline void intrusive_ptr_add_ref( const ReferenceCounted * ptr_r )
-    { if( ptr_r ) ptr_r->ref(); }
-
-    /** Called by zypp::base::intrusive_ptr to add a reference.
-     * \relates ReferenceCounted
-     * \see ZYPP_BASE_SMART_PTR
-    */
-    inline void intrusive_ptr_release( const ReferenceCounted * ptr_r  )
-    { if( ptr_r ) ptr_r->unref(); }
-
     /////////////////////////////////////////////////////////////////
   } // namespace base
   ///////////////////////////////////////////////////////////////////
@@ -110,11 +103,11 @@ namespace zypp
 } // namespace zypp
 ///////////////////////////////////////////////////////////////////
 
-/** Forward declaration of Ptr types */
-#define DEFINE_PTR_TYPE(NAME) \
-class NAME;                                                      \
-typedef zypp::base::intrusive_ptr<NAME>       NAME##Ptr;         \
-typedef zypp::base::intrusive_ptr<const NAME> const##NAME##Ptr;
+#define IMPL_PTR_TYPE(NAME) \
+void intrusive_ptr_add_ref( const NAME * ptr_r )               \
+{ zypp::base::ReferenceCounted::add_ref( ptr_r ); }                  \
+void intrusive_ptr_release( const NAME * ptr_r )               \
+{ zypp::base::ReferenceCounted::release( ptr_r ); }
 
 ///////////////////////////////////////////////////////////////////
 #endif // ZYPP_BASE_REFERENCECOUNTED_H
diff --git a/zypp/capability/.cvsignore b/zypp/capability/.cvsignore
new file mode 100644 (file)
index 0000000..5c94a2f
--- /dev/null
@@ -0,0 +1,8 @@
+Makefile.in
+Makefile
+.deps
+.libs
+*.o
+*.lo
+*.a
+*.la
diff --git a/zypp/capability/CapabilityImpl.cc b/zypp/capability/CapabilityImpl.cc
new file mode 100644 (file)
index 0000000..717579d
--- /dev/null
@@ -0,0 +1,49 @@
+/*---------------------------------------------------------------------\
+|                          ____ _   __ __ ___                          |
+|                         |__  / \ / / . \ . \                         |
+|                           / / \ V /|  _/  _/                         |
+|                          / /__ | | | | | |                           |
+|                         /_____||_| |_| |_|                           |
+|                                                                      |
+\---------------------------------------------------------------------*/
+/** \file zypp/capability/CapabilityImpl.cc
+ *
+*/
+#include <iostream>
+
+#include "zypp/capability/CapabilityImpl.h"
+
+using namespace std;
+
+///////////////////////////////////////////////////////////////////
+namespace zypp
+{ /////////////////////////////////////////////////////////////////
+  ///////////////////////////////////////////////////////////////////
+  namespace capability
+  { /////////////////////////////////////////////////////////////////
+    IMPL_PTR_TYPE(CapabilityImpl)
+
+    ///////////////////////////////////////////////////////////////////
+    //
+    // METHOD NAME : CapabilityImpl::~CapabilityImpl
+    // METHOD TYPE : Dtor
+    //
+    CapabilityImpl::~CapabilityImpl()
+    {}
+
+    /******************************************************************
+     **
+     **        FUNCTION NAME : operator<<
+     **        FUNCTION TYPE : std::ostream &
+    */
+    std::ostream & operator<<( std::ostream & str, const CapabilityImpl & obj )
+    {
+      return str << "CapabilityImpl";
+    }
+
+    /////////////////////////////////////////////////////////////////
+  } // namespace capability
+  ///////////////////////////////////////////////////////////////////
+  /////////////////////////////////////////////////////////////////
+} // namespace zypp
+///////////////////////////////////////////////////////////////////
diff --git a/zypp/capability/CapabilityImpl.h b/zypp/capability/CapabilityImpl.h
new file mode 100644 (file)
index 0000000..4ce5207
--- /dev/null
@@ -0,0 +1,56 @@
+/*---------------------------------------------------------------------\
+|                          ____ _   __ __ ___                          |
+|                         |__  / \ / / . \ . \                         |
+|                           / / \ V /|  _/  _/                         |
+|                          / /__ | | | | | |                           |
+|                         /_____||_| |_| |_|                           |
+|                                                                      |
+\---------------------------------------------------------------------*/
+/** \file zypp/capability/CapabilityImpl.h
+ *
+*/
+#ifndef ZYPP_CAPABILITY_CAPABILITYIMPL_H
+#define ZYPP_CAPABILITY_CAPABILITYIMPL_H
+
+#include "zypp/base/ReferenceCounted.h"
+#include "zypp/base/NonCopyable.h"
+
+#include "zypp/ResolvableFwd.h"
+#include "zypp/SolverContextFwd.h"
+
+///////////////////////////////////////////////////////////////////
+namespace zypp
+{ /////////////////////////////////////////////////////////////////
+  ///////////////////////////////////////////////////////////////////
+  namespace capability
+  { /////////////////////////////////////////////////////////////////
+    DEFINE_PTR_TYPE(CapabilityImpl)
+
+    ///////////////////////////////////////////////////////////////////
+    //
+    // CLASS NAME : CapabilityImpl
+    //
+    /** */
+    class CapabilityImpl : public base::ReferenceCounted, private base::NonCopyable
+    {
+    public:
+      /** Dtor */
+      virtual ~CapabilityImpl();
+
+    public:
+      /**  */
+      virtual bool matches( constResolvablePtr resolvable_r,
+                            const SolverContext & colverContext_r ) = 0;
+    };
+    ///////////////////////////////////////////////////////////////////
+
+    /** \relates CapabilityImpl Stream output */
+    extern std::ostream & operator<<( std::ostream & str, const CapabilityImpl & obj );
+
+    /////////////////////////////////////////////////////////////////
+  } // namespace capability
+  ///////////////////////////////////////////////////////////////////
+  /////////////////////////////////////////////////////////////////
+} // namespace zypp
+///////////////////////////////////////////////////////////////////
+#endif // ZYPP_CAPABILITY_CAPABILITYIMPL_H
diff --git a/zypp/capability/ConditionalCap.h b/zypp/capability/ConditionalCap.h
new file mode 100644 (file)
index 0000000..fd2c5d3
--- /dev/null
@@ -0,0 +1,45 @@
+/*---------------------------------------------------------------------\
+|                          ____ _   __ __ ___                          |
+|                         |__  / \ / / . \ . \                         |
+|                           / / \ V /|  _/  _/                         |
+|                          / /__ | | | | | |                           |
+|                         /_____||_| |_| |_|                           |
+|                                                                      |
+\---------------------------------------------------------------------*/
+/** \file zypp/capability/ConditionalCap.h
+ *
+*/
+#ifndef ZYPP_CAPABILITY_CONDITIONALCAP_H
+#define ZYPP_CAPABILITY_CONDITIONALCAP_H
+
+#include "zypp/capability/CapabilityImpl.h"
+
+///////////////////////////////////////////////////////////////////
+namespace zypp
+{ /////////////////////////////////////////////////////////////////
+  ///////////////////////////////////////////////////////////////////
+  namespace capability
+  { /////////////////////////////////////////////////////////////////
+
+    ///////////////////////////////////////////////////////////////////
+    //
+    // CLASS NAME : ConditionalCap
+    //
+    /** */
+    class ConditionalCap : public CapabilityImpl
+    {
+    public:
+      /**  */
+      bool matches( constResolvablePtr resolvable_r,
+                    const SolverContext & colverContext_r )
+      { return false; }
+    };
+    ///////////////////////////////////////////////////////////////////
+
+    /////////////////////////////////////////////////////////////////
+  } // namespace capability
+  ///////////////////////////////////////////////////////////////////
+  /////////////////////////////////////////////////////////////////
+} // namespace zypp
+///////////////////////////////////////////////////////////////////
+#endif // ZYPP_CAPABILITY_CONDITIONALCAP_H
diff --git a/zypp/capability/FileCap.h b/zypp/capability/FileCap.h
new file mode 100644 (file)
index 0000000..d93ef24
--- /dev/null
@@ -0,0 +1,45 @@
+/*---------------------------------------------------------------------\
+|                          ____ _   __ __ ___                          |
+|                         |__  / \ / / . \ . \                         |
+|                           / / \ V /|  _/  _/                         |
+|                          / /__ | | | | | |                           |
+|                         /_____||_| |_| |_|                           |
+|                                                                      |
+\---------------------------------------------------------------------*/
+/** \file zypp/capability/FileCap.h
+ *
+*/
+#ifndef ZYPP_CAPABILITY_FILECAP_H
+#define ZYPP_CAPABILITY_FILECAP_H
+
+#include "zypp/capability/CapabilityImpl.h"
+
+///////////////////////////////////////////////////////////////////
+namespace zypp
+{ /////////////////////////////////////////////////////////////////
+  ///////////////////////////////////////////////////////////////////
+  namespace capability
+  { /////////////////////////////////////////////////////////////////
+
+    ///////////////////////////////////////////////////////////////////
+    //
+    // CLASS NAME : FileCap
+    //
+    /** */
+    class FileCap : public CapabilityImpl
+    {
+    public:
+      /**  */
+      bool matches( constResolvablePtr resolvable_r,
+                    const SolverContext & colverContext_r )
+      { return false; }
+    };
+    ///////////////////////////////////////////////////////////////////
+
+    /////////////////////////////////////////////////////////////////
+  } // namespace capability
+  ///////////////////////////////////////////////////////////////////
+  /////////////////////////////////////////////////////////////////
+} // namespace zypp
+///////////////////////////////////////////////////////////////////
+#endif // ZYPP_CAPABILITY_FILECAP_H
diff --git a/zypp/capability/Makefile.am b/zypp/capability/Makefile.am
new file mode 100644 (file)
index 0000000..1c32124
--- /dev/null
@@ -0,0 +1,23 @@
+## Process this file with automake to produce Makefile.in
+## ##################################################
+
+SUBDIRS =
+
+## ##################################################
+
+include_HEADERS = CapabilityImpl.h \
+       \
+       ConditionalCap.h\
+       FileCap.h       \
+       NamedCap.h      \
+       OrCap.h         \
+       VersionedCap.h
+
+noinst_LTLIBRARIES =   lib@PACKAGE@_capability.la
+
+## ##################################################
+
+lib@PACKAGE@_capability_la_SOURCES = \
+       CapabilityImpl.cc
+
+## ##################################################
diff --git a/zypp/capability/NamedCap.h b/zypp/capability/NamedCap.h
new file mode 100644 (file)
index 0000000..69bb109
--- /dev/null
@@ -0,0 +1,45 @@
+/*---------------------------------------------------------------------\
+|                          ____ _   __ __ ___                          |
+|                         |__  / \ / / . \ . \                         |
+|                           / / \ V /|  _/  _/                         |
+|                          / /__ | | | | | |                           |
+|                         /_____||_| |_| |_|                           |
+|                                                                      |
+\---------------------------------------------------------------------*/
+/** \file zypp/capability/NamedCap.h
+ *
+*/
+#ifndef ZYPP_CAPABILITY_NAMEDCAP_H
+#define ZYPP_CAPABILITY_NAMEDCAP_H
+
+#include "zypp/capability/CapabilityImpl.h"
+
+///////////////////////////////////////////////////////////////////
+namespace zypp
+{ /////////////////////////////////////////////////////////////////
+  ///////////////////////////////////////////////////////////////////
+  namespace capability
+  { /////////////////////////////////////////////////////////////////
+
+    ///////////////////////////////////////////////////////////////////
+    //
+    // CLASS NAME : NamedCap
+    //
+    /** */
+    class NamedCap : public CapabilityImpl
+    {
+    public:
+      /**  */
+      bool matches( constResolvablePtr resolvable_r,
+                    const SolverContext & colverContext_r )
+      { return false; }
+    };
+    ///////////////////////////////////////////////////////////////////
+
+    /////////////////////////////////////////////////////////////////
+  } // namespace capability
+  ///////////////////////////////////////////////////////////////////
+  /////////////////////////////////////////////////////////////////
+} // namespace zypp
+///////////////////////////////////////////////////////////////////
+#endif // ZYPP_CAPABILITY_NAMEDCAP_H
diff --git a/zypp/capability/OrCap.h b/zypp/capability/OrCap.h
new file mode 100644 (file)
index 0000000..c7c72f1
--- /dev/null
@@ -0,0 +1,45 @@
+/*---------------------------------------------------------------------\
+|                          ____ _   __ __ ___                          |
+|                         |__  / \ / / . \ . \                         |
+|                           / / \ V /|  _/  _/                         |
+|                          / /__ | | | | | |                           |
+|                         /_____||_| |_| |_|                           |
+|                                                                      |
+\---------------------------------------------------------------------*/
+/** \file zypp/capability/OrCap.h
+ *
+*/
+#ifndef ZYPP_CAPABILITY_ORCAP_H
+#define ZYPP_CAPABILITY_ORCAP_H
+
+#include "zypp/capability/CapabilityImpl.h"
+
+///////////////////////////////////////////////////////////////////
+namespace zypp
+{ /////////////////////////////////////////////////////////////////
+  ///////////////////////////////////////////////////////////////////
+  namespace capability
+  { /////////////////////////////////////////////////////////////////
+
+    ///////////////////////////////////////////////////////////////////
+    //
+    // CLASS NAME : OrCap
+    //
+    /** */
+    class OrCap : public CapabilityImpl
+    {
+    public:
+      /**  */
+      bool matches( constResolvablePtr resolvable_r,
+                    const SolverContext & colverContext_r )
+      { return false; }
+    };
+    ///////////////////////////////////////////////////////////////////
+
+    /////////////////////////////////////////////////////////////////
+  } // namespace capability
+  ///////////////////////////////////////////////////////////////////
+  /////////////////////////////////////////////////////////////////
+} // namespace zypp
+///////////////////////////////////////////////////////////////////
+#endif // ZYPP_CAPABILITY_ORCAP_H
diff --git a/zypp/capability/VersionedCap.h b/zypp/capability/VersionedCap.h
new file mode 100644 (file)
index 0000000..689fe7c
--- /dev/null
@@ -0,0 +1,45 @@
+/*---------------------------------------------------------------------\
+|                          ____ _   __ __ ___                          |
+|                         |__  / \ / / . \ . \                         |
+|                           / / \ V /|  _/  _/                         |
+|                          / /__ | | | | | |                           |
+|                         /_____||_| |_| |_|                           |
+|                                                                      |
+\---------------------------------------------------------------------*/
+/** \file zypp/capability/VersionedCap.h
+ *
+*/
+#ifndef ZYPP_CAPABILITY_VERSIONEDCAP_H
+#define ZYPP_CAPABILITY_VERSIONEDCAP_H
+
+#include "zypp/capability/CapabilityImpl.h"
+
+///////////////////////////////////////////////////////////////////
+namespace zypp
+{ /////////////////////////////////////////////////////////////////
+  ///////////////////////////////////////////////////////////////////
+  namespace capability
+  { /////////////////////////////////////////////////////////////////
+
+    ///////////////////////////////////////////////////////////////////
+    //
+    // CLASS NAME : VersionedCap
+    //
+    /** */
+    class VersionedCap : public CapabilityImpl
+    {
+    public:
+      /**  */
+      bool matches( constResolvablePtr resolvable_r,
+                    const SolverContext & colverContext_r )
+      { return false; }
+    };
+    ///////////////////////////////////////////////////////////////////
+
+    /////////////////////////////////////////////////////////////////
+  } // namespace capability
+  ///////////////////////////////////////////////////////////////////
+  /////////////////////////////////////////////////////////////////
+} // namespace zypp
+///////////////////////////////////////////////////////////////////
+#endif // ZYPP_CAPABILITY_VERSIONEDCAP_H
index c831963..3175dd9 100644 (file)
@@ -5,7 +5,7 @@ SUBDIRS =
 
 ## ##################################################
 
-include_HEADERS =              \
+include_HEADERS = \
        ResolvableImpl.h        \
        PackageImpl.h           \
        SelectionImpl.h         \
@@ -18,12 +18,12 @@ noinst_LTLIBRARIES =        lib@PACKAGE@_detail.la
 
 ## ##################################################
 
-lib@PACKAGE@_detail_la_SOURCES =       \
-       ResolvableImpl.cc               \
-       PackageImpl.cc                  \
-       SelectionImpl.cc                \
-       MessageImpl.cc                  \
-       ScriptImpl.cc                   \
+lib@PACKAGE@_detail_la_SOURCES = \
+       ResolvableImpl.cc       \
+       PackageImpl.cc          \
+       SelectionImpl.cc        \
+       MessageImpl.cc          \
+       ScriptImpl.cc           \
        PatchImpl.cc
 
 ## ##################################################
index 5c3c44a..60097f8 100644 (file)
@@ -23,6 +23,7 @@ namespace zypp
   ///////////////////////////////////////////////////////////////////
   namespace detail
   { /////////////////////////////////////////////////////////////////
+    IMPL_PTR_TYPE(MessageImpl)
 
     ///////////////////////////////////////////////////////////////////
     //
index 54ef739..8b3d39f 100644 (file)
@@ -24,7 +24,7 @@ namespace zypp
   ///////////////////////////////////////////////////////////////////
   namespace detail
   { /////////////////////////////////////////////////////////////////
-
+    DEFINE_PTR_TYPE(MessageImpl)
 
     ///////////////////////////////////////////////////////////////////
     //
index 43e0fb1..77cfef8 100644 (file)
@@ -21,6 +21,7 @@ namespace zypp
   ///////////////////////////////////////////////////////////////////
   namespace detail
   { /////////////////////////////////////////////////////////////////
+    IMPL_PTR_TYPE(PackageImpl)
 
     ///////////////////////////////////////////////////////////////////
     //
index 38e25e3..c0881d2 100644 (file)
@@ -24,6 +24,7 @@ namespace zypp
   ///////////////////////////////////////////////////////////////////
   namespace detail
   { /////////////////////////////////////////////////////////////////
+    IMPL_PTR_TYPE(PatchImpl)
 
     ///////////////////////////////////////////////////////////////////
     //
index a25786b..5afe5de 100644 (file)
@@ -25,6 +25,7 @@ namespace zypp
   ///////////////////////////////////////////////////////////////////
   namespace detail
   { /////////////////////////////////////////////////////////////////
+    DEFINE_PTR_TYPE(PatchImpl)
 
     ///////////////////////////////////////////////////////////////////
     //
index a63590f..934b1ca 100644 (file)
@@ -21,6 +21,7 @@ namespace zypp
   ///////////////////////////////////////////////////////////////////
   namespace detail
   { /////////////////////////////////////////////////////////////////
+    IMPL_PTR_TYPE(ResolvableImpl)
 
     ///////////////////////////////////////////////////////////////////
     //
index e65425b..6912786 100644 (file)
@@ -23,6 +23,7 @@ namespace zypp
   ///////////////////////////////////////////////////////////////////
   namespace detail
   { /////////////////////////////////////////////////////////////////
+    IMPL_PTR_TYPE(ScriptImpl)
 
     ///////////////////////////////////////////////////////////////////
     //
index d127eb3..74d8d67 100644 (file)
@@ -24,7 +24,7 @@ namespace zypp
   ///////////////////////////////////////////////////////////////////
   namespace detail
   { /////////////////////////////////////////////////////////////////
-
+    DEFINE_PTR_TYPE(ScriptImpl)
 
     ///////////////////////////////////////////////////////////////////
     //
index 3bc3a2c..1b9edc9 100644 (file)
@@ -21,6 +21,7 @@ namespace zypp
   ///////////////////////////////////////////////////////////////////
   namespace detail
   { /////////////////////////////////////////////////////////////////
+    IMPL_PTR_TYPE(SelectionImpl)
 
     ///////////////////////////////////////////////////////////////////
     //