libzypp  13.10.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 || kind_r == ResKind::pattern ); }
30 
32  } // namespace traits
34 
62  DEFINE_PTR_TYPE( Resolvable );
63  DEFINE_PTR_TYPE( ResObject );
64 
65  DEFINE_PTR_TYPE( Package );
66  DEFINE_PTR_TYPE( SrcPackage );
67  DEFINE_PTR_TYPE( Pattern );
68  DEFINE_PTR_TYPE( Product );
69  DEFINE_PTR_TYPE( Patch );
71 
73  class PoolItem;
74 
76  template<typename _Res>
77  struct ResTraits
78  {
79  typedef ResKind KindType;
80  typedef intrusive_ptr<_Res> PtrType;
81  typedef intrusive_ptr<const _Res> constPtrType;
82 
83  static const ResKind kind;
84 
87  static bool isPseudoInstalled() { return traits::isPseudoInstalled( kind ); }
88  };
89 
93  template<>
95  {
96  typedef ResKind KindType;
97  typedef intrusive_ptr<Resolvable> PtrType;
98  typedef intrusive_ptr<const Resolvable> constPtrType;
99  };
100 
104  template<>
106  {
107  typedef ResKind KindType;
108  typedef intrusive_ptr<ResObject> PtrType;
109  typedef intrusive_ptr<const ResObject> constPtrType;
110  };
111 
118  template<typename _Res>
119  inline ResKind resKind() { return ResTraits<_Res>::kind; }
120 
129  template<typename _Res>
130  inline bool isKind( const ResKind & val_r )
131  { return( resKind<_Res>() == val_r ); }
133  template<typename _Res>
134  inline bool isKind( const std::string & val_r )
135  { return( resKind<_Res>() == val_r ); }
137  template<typename _Res>
138  inline bool isKind( const char * val_r )
139  { return( resKind<_Res>() == val_r ); }
140 
141 
143 } // namespace zypp
145 #endif // ZYPP_RESTRAITS_H
bool isKind(const ResKind &val_r)
Convenient test for ResKinds.
Definition: ResTraits.h:130
static const ResKind kind
Definition: ResTraits.h:83
intrusive_ptr< const ResObject > constPtrType
Definition: ResTraits.h:109
Interface base for resolvable objects (identification and dependencies).
Definition: Resolvable.h:39
ResTraits.
Definition: ResTraits.h:77
static bool isPseudoInstalled()
Those are denoted to be installed, if the solver verifies them as being satisfied.
Definition: ResTraits.h:87
intrusive_ptr< Resolvable > PtrType
Definition: ResTraits.h:97
DEFINE_PTR_TYPE(KeyRing)
intrusive_ptr< ResObject > PtrType
Definition: ResTraits.h:108
ResKind KindType
Definition: ResTraits.h:79
static const ResKind pattern
Definition: ResKind.h:45
ResKind resKind()
Convenient access to well known ResKinds.
Definition: ResTraits.h:119
Interface base for resolvable objects (common data).
Definition: ResObject.h:44
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< _Res > PtrType
Definition: ResTraits.h:80
intrusive_ptr< const Resolvable > constPtrType
Definition: ResTraits.h:98
Resolvable kinds.
Definition: ResKind.h:35
static const ResKind patch
Definition: ResKind.h:44
intrusive_ptr< const _Res > constPtrType
Definition: ResTraits.h:81