Imported Upstream version 17.8.1
[platform/upstream/libzypp.git] / zypp / sat / detail / PoolMember.h
index f2a6a3d..ecb28a9 100644 (file)
 #ifndef ZYPP_SAT_DETAIL_POOLMEMBER_H
 #define ZYPP_SAT_DETAIL_POOLMEMBER_H
 
+#include <solv/solvversion.h>
+
+#include "zypp/base/Hash.h"
 #include "zypp/base/Iterator.h"
+#include "zypp/base/String.h"
+#include "zypp/base/Easy.h"
 
 extern "C"
 {
-struct _Solvable;
-struct _Repo;
-struct _Pool;
+  // Those _Type names are exposed as sat::detail::CType below!
+#if ( LIBSOLV_VERSION >= 700 )
+  struct s_Dataiterator;
+  struct s_Datamatcher;
+  struct s_Map;
+  struct s_Pool;
+  struct s_Queue;
+  struct s_Repo;
+  struct s_Solvable;
+  struct s_Solver;
+  struct s_Transaction;
+#else
+  struct _Dataiterator;
+  struct _Datamatcher;
+  struct _Map;
+  struct _Pool;
+  struct _Queue;
+  struct _Repo;
+  struct _Solvable;
+  struct _Solver;
+  struct _Transaction;
+#endif
 }
 
 ///////////////////////////////////////////////////////////////////
 namespace zypp
 { /////////////////////////////////////////////////////////////////
+
+  class IdString;
+  class Capability;
+  class Capabilities;
+  class Repository;
+  class RepoInfo;
+
+  ///////////////////////////////////////////////////////////////////
+  namespace detail
+  {
+    class RepoIterator;
+    class ByRepository;
+  }
+
   ///////////////////////////////////////////////////////////////////
   namespace sat
   { /////////////////////////////////////////////////////////////////
 
-    class Solvable;
-    class Repo;
+    ///////////////////////////////////////////////////////////////////
+    namespace detail
+    {
+#if ( LIBSOLV_VERSION >= 700 )
+      typedef ::s_Dataiterator CDataiterator;  ///< Wrapped libsolv C data type exposed as backdoor
+      typedef ::s_Datamatcher  CDatamatcher;   ///< Wrapped libsolv C data type exposed as backdoor
+      typedef ::s_Map          CMap;           ///< Wrapped libsolv C data type exposed as backdoor
+      typedef ::s_Pool         CPool;          ///< Wrapped libsolv C data type exposed as backdoor
+      typedef ::s_Queue                CQueue;         ///< Wrapped libsolv C data type exposed as backdoor
+      typedef ::s_Repo         CRepo;          ///< Wrapped libsolv C data type exposed as backdoor
+      typedef ::s_Solvable     CSolvable;      ///< Wrapped libsolv C data type exposed as backdoor
+      typedef ::s_Solver       CSolver;        ///< Wrapped libsolv C data type exposed as backdoor
+      typedef ::s_Transaction  CTransaction;   ///< Wrapped libsolv C data type exposed as backdoor
+#else
+      typedef ::_Dataiterator  CDataiterator;  ///< Wrapped libsolv C data type exposed as backdoor
+      typedef ::_Datamatcher   CDatamatcher;   ///< Wrapped libsolv C data type exposed as backdoor
+      typedef ::_Map           CMap;           ///< Wrapped libsolv C data type exposed as backdoor
+      typedef ::_Pool          CPool;          ///< Wrapped libsolv C data type exposed as backdoor
+      typedef ::_Queue         CQueue;         ///< Wrapped libsolv C data type exposed as backdoor
+      typedef ::_Repo          CRepo;          ///< Wrapped libsolv C data type exposed as backdoor
+      typedef ::_Solvable      CSolvable;      ///< Wrapped libsolv C data type exposed as backdoor
+      typedef ::_Solver                CSolver;        ///< Wrapped libsolv C data type exposed as backdoor
+      typedef ::_Transaction   CTransaction;   ///< Wrapped libsolv C data type exposed as backdoor
+#endif
+    } // namespace detail
+    ///////////////////////////////////////////////////////////////////
+
     class Pool;
+    class Solvable;
 
     ///////////////////////////////////////////////////////////////////
     namespace detail
@@ -62,14 +126,38 @@ namespace zypp
     namespace detail
     { /////////////////////////////////////////////////////////////////
 
-      /** Id type to connect \ref Solvable and sat-solvable. */
+      /** Generic Id type. */
+      typedef int IdType;
+      static const IdType noId( 0 );
+      static const IdType emptyId( 1 );
+
+      /** Internal ids satlib includes in dependencies.
+       * MPL check in PoolImpl.cc
+      */
+      static const IdType solvablePrereqMarker( 15 );
+      static const IdType solvableFileMarker  ( 16 );
+
+      static const IdType namespaceModalias    ( 18 );
+      static const IdType namespaceLanguage    ( 20 );
+      static const IdType namespaceFilesystem  ( 21 );
+
+      /** Test for internal ids satlib includes in dependencies. */
+      inline bool isDepMarkerId( IdType id_r )
+      { return( id_r == solvablePrereqMarker || id_r == solvableFileMarker ); }
+
+      /** Id type to connect \ref Solvable and sat-solvable.
+       * Indext into solvable array.
+      */
       typedef unsigned SolvableIdType;
-      /** Id to denote \ref Solvable::nosolvable. */
+      typedef SolvableIdType size_type;
+      /** Id to denote \ref Solvable::noSolvable. */
       static const SolvableIdType noSolvableId( 0 );
+      /** Id to denote the usually hidden \ref Solvable::systemSolvable. */
+      static const SolvableIdType systemSolvableId( 1 );
 
       /** Id type to connect \ref Repo and sat-repo. */
-      typedef ::_Repo * RepoIdType;
-      /** Id to denote \ref Repo::nosolvable. */
+      typedef CRepo * RepoIdType;
+      /** Id to denote \ref Repo::noRepository. */
       static const RepoIdType noRepoId( 0 );
 
       /////////////////////////////////////////////////////////////////
@@ -82,8 +170,6 @@ namespace zypp
     { /////////////////////////////////////////////////////////////////
 
       class SolvableIterator;
-      class RepoIterator;
-      class ByRepo;
 
       /////////////////////////////////////////////////////////////////
     } // namespace detail