Imported Upstream version 16.3.2
[platform/upstream/libzypp.git] / zypp / ResTraits.h
index 1fd3a7f..33097a4 100644 (file)
 #define ZYPP_RESTRAITS_H
 
 #include "zypp/base/PtrTypes.h"
-#include "zypp/base/KindOf.h"
 #include "zypp/ResKind.h"
 
 ///////////////////////////////////////////////////////////////////
 namespace zypp
 { /////////////////////////////////////////////////////////////////
 
-  /** \defgroup ZYPP_RESOLVABLE_SMART_POINTER_TYPES
+  ///////////////////////////////////////////////////////////////////
+  namespace traits
+  { /////////////////////////////////////////////////////////////////
+
+    /** Those are denoted to be installed, if the
+     *  solver verifies them as being satisfied. */
+    inline bool isPseudoInstalled( ResKind kind_r )
+    { return( kind_r == ResKind::patch ); }
+
+    /////////////////////////////////////////////////////////////////
+  } // namespace traits
+  ///////////////////////////////////////////////////////////////////
+
+   /** \defgroup ZYPP_RESOLVABLE_SMART_POINTER_TYPES
    * Resolvable smart pointer types.
    *
    * Forward declaration of all Resolvable smart pointer
    * types provided in \c ResTraits.h (recommended in header files):
    * \code
-   * #include<zypp/ResTraits.h>
+   * #include "zypp/ResTraits.h"
    *
    * Resolvable_Ptr                      // Resolvable *
    * ResTraits<Resolvable>::PtrType      // same as above
@@ -37,7 +49,7 @@ namespace zypp
    *
    * Synonym, but requires \c Resolvable.h being included:
    * \code
-   * #include<zypp/Resolvable.h>
+   * #include "zypp/Resolvable.h"
    *
    * Resolvable::Ptr        // same as Resolvable_Ptr but requires Resolvable.h
    * Resolvable::constPtr   // same as Resolvable_constPtr but requires Resolvable.h
@@ -45,30 +57,36 @@ namespace zypp
    *
    * \note When adding a \c NewResolvable type here, dont forgett to
    * put <tt>IMPL_PTR_TYPE(NewResolvable);</tt> into the \c NewResolvable.cc.
+   * Also check class \ref ResKind, ResKind.cc, ResObject.cc(makeResObject)
    */
   //@{
   DEFINE_PTR_TYPE( Resolvable );
   DEFINE_PTR_TYPE( ResObject );
 
-  DEFINE_PTR_TYPE( Atom );
   DEFINE_PTR_TYPE( Package );
   DEFINE_PTR_TYPE( SrcPackage );
   DEFINE_PTR_TYPE( Pattern );
   DEFINE_PTR_TYPE( Product );
   DEFINE_PTR_TYPE( Patch );
-  DEFINE_PTR_TYPE( Script );
-  DEFINE_PTR_TYPE( Message );
+  DEFINE_PTR_TYPE( Application );
   //@}
 
+  /** Frequently associated. */
+  class PoolItem;
+
   /** ResTraits. Defines common types and the ResKind value. */
-  template<typename _Res>
+  template<typename TRes>
     struct ResTraits
     {
       typedef ResKind                   KindType;
-      typedef intrusive_ptr<_Res>       PtrType;
-      typedef intrusive_ptr<const _Res> constPtrType;
+      typedef intrusive_ptr<TRes>       PtrType;
+      typedef intrusive_ptr<const TRes> constPtrType;
+
+      static const ResKind              kind;  ///< Defined in ResKind.cc
 
-      static const ResKind              kind;
+      /** Those are denoted to be installed, if the
+       *  solver verifies them as being satisfied. */
+      static bool isPseudoInstalled()   { return traits::isPseudoInstalled( kind ); }
     };
 
   /** ResTraits specialisation for Resolvable.
@@ -95,32 +113,32 @@ namespace zypp
 
   /** Convenient access to well known ResKinds.
    * \code
-   * ResKind packagekind = ResTraits<Package>::kind;
+   * ResKind packagekind = ResKind::package;
    * ResKind packagekind = resKind<Package>();
    * \endcode
   */
-  template<typename _Res>
-    inline ResKind resKind() { return ResTraits<_Res>::kind; }
+  template<typename TRes>
+    inline ResKind resKind() { return ResTraits<TRes>::kind; }
 
   /** Convenient test for ResKinds.
    * \code
    * ResKind value;
-   * if ( ResTraits<Package>::kind == value )
+   * if ( ResKind::package == value )
    * if ( resKind<Package>() == value )
    * if ( isKind<Package>( value ) )
    * \endcode
    */
-  template<typename _Res>
+  template<typename TRes>
     inline bool isKind( const ResKind & val_r )
-    { return( resKind<_Res>() == val_r ); }
+    { return( resKind<TRes>() == val_r ); }
   /** \overload */
-  template<typename _Res>
+  template<typename TRes>
     inline bool isKind( const std::string & val_r )
-    { return( resKind<_Res>() == val_r ); }
+    { return( resKind<TRes>() == val_r ); }
   /** \overload */
-  template<typename _Res>
+  template<typename TRes>
     inline bool isKind( const char * val_r )
-    { return( resKind<_Res>() == val_r ); }
+    { return( resKind<TRes>() == val_r ); }
 
 
   /////////////////////////////////////////////////////////////////