libzypp  15.28.6
ResTraits.h
Go to the documentation of this file.
1 /*---------------------------------------------------------------------\
2 | ____ _ __ __ ___ |
3 | |__ / \ / / . \ . \ |
4 | / / \ V /| _/ _/ |
5 | / /__ | | | | | | |
6 | /_____||_| |_| |_| |
7 | |
8 \---------------------------------------------------------------------*/
12 #ifndef ZYPP_RESTRAITS_H
13 #define ZYPP_RESTRAITS_H
14 
15 #include "zypp/base/PtrTypes.h"
16 #include "zypp/ResKind.h"
17 
19 namespace zypp
20 {
21 
23  namespace traits
24  {
25 
28  inline bool isPseudoInstalled( ResKind kind_r )
29  { return( kind_r == ResKind::patch ); }
30 
32  } // namespace traits
34 
63  DEFINE_PTR_TYPE( Resolvable );
64  DEFINE_PTR_TYPE( ResObject );
65 
66  DEFINE_PTR_TYPE( Package );
67  DEFINE_PTR_TYPE( SrcPackage );
68  DEFINE_PTR_TYPE( Pattern );
69  DEFINE_PTR_TYPE( Product );
70  DEFINE_PTR_TYPE( Patch );
71  DEFINE_PTR_TYPE( Application );
73 
75  class PoolItem;
76 
78  template<typename TRes>
79  struct ResTraits
80  {
81  typedef ResKind KindType;
82  typedef intrusive_ptr<TRes> PtrType;
83  typedef intrusive_ptr<const TRes> constPtrType;
84 
85  static const ResKind kind;
86 
89  static bool isPseudoInstalled() { return traits::isPseudoInstalled( kind ); }
90  };
91 
95  template<>
97  {
98  typedef ResKind KindType;
99  typedef intrusive_ptr<Resolvable> PtrType;
100  typedef intrusive_ptr<const Resolvable> constPtrType;
101  };
102 
106  template<>
108  {
109  typedef ResKind KindType;
110  typedef intrusive_ptr<ResObject> PtrType;
111  typedef intrusive_ptr<const ResObject> constPtrType;
112  };
113 
120  template<typename TRes>
121  inline ResKind resKind() { return ResTraits<TRes>::kind; }
122 
131  template<typename TRes>
132  inline bool isKind( const ResKind & val_r )
133  { return( resKind<TRes>() == val_r ); }
135  template<typename TRes>
136  inline bool isKind( const std::string & val_r )
137  { return( resKind<TRes>() == val_r ); }
139  template<typename TRes>
140  inline bool isKind( const char * val_r )
141  { return( resKind<TRes>() == val_r ); }
142 
143 
145 } // namespace zypp
147 #endif // ZYPP_RESTRAITS_H
bool isKind(const ResKind &val_r)
Convenient test for ResKinds.
Definition: ResTraits.h:132
intrusive_ptr< const TRes > constPtrType
Definition: ResTraits.h:83
intrusive_ptr< const ResObject > constPtrType
Definition: ResTraits.h:111
Base for resolvable objects.
Definition: Resolvable.h:49
ResTraits.
Definition: ResTraits.h:79
intrusive_ptr< Resolvable > PtrType
Definition: ResTraits.h:99
intrusive_ptr< ResObject > PtrType
Definition: ResTraits.h:110
DEFINE_PTR_TYPE(Application)
ResKind resKind()
Convenient access to well known ResKinds.
Definition: ResTraits.h:121
Base for resolvable objects.
Definition: ResObject.h:38
bool isPseudoInstalled(ResKind kind_r)
Those are denoted to be installed, if the solver verifies them as being satisfied.
Definition: ResTraits.h:28
intrusive_ptr< TRes > PtrType
Definition: ResTraits.h:82
ResKind KindType
Definition: ResTraits.h:81
static bool isPseudoInstalled()
Those are denoted to be installed, if the solver verifies them as being satisfied.
Definition: ResTraits.h:89
intrusive_ptr< const Resolvable > constPtrType
Definition: ResTraits.h:100
Resolvable kinds.
Definition: ResKind.h:32
static const ResKind patch
Definition: ResKind.h:41
static const ResKind kind
Defined in ResKind.cc.
Definition: ResTraits.h:85