libzypp 17.37.10

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( const ResKind& kind_r )
29 { return( kind_r == ResKind::patch ); }
30
32 } // namespace traits
33
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 using KindType = ResKind;
82 using PtrType = intrusive_ptr<TRes>;
83 using constPtrType = intrusive_ptr<const TRes>;
84
85 static const ResKind kind ZYPP_API;
86
89 static bool isPseudoInstalled() { return traits::isPseudoInstalled( kind ); }
90 };
91
92 // Defined in ResKind.cc
93 template<> const ResKind ResTraits<Package>::kind ZYPP_API;
94 template<> const ResKind ResTraits<Patch>::kind ZYPP_API;
95 template<> const ResKind ResTraits<Pattern>::kind ZYPP_API;
96 template<> const ResKind ResTraits<Product>::kind ZYPP_API;
97 template<> const ResKind ResTraits<SrcPackage>::kind ZYPP_API;
98 template<> const ResKind ResTraits<Application>::kind ZYPP_API;
99
103 template<>
104 struct ResTraits<Resolvable>
105 {
106 using KindType = ResKind;
107 using PtrType = intrusive_ptr<Resolvable>;
108 using constPtrType = intrusive_ptr<const Resolvable>;
109 };
110
114 template<>
115 struct ResTraits<ResObject>
116 {
117 using KindType = ResKind;
118 using PtrType = intrusive_ptr<ResObject>;
119 using constPtrType = intrusive_ptr<const ResObject>;
120 };
121
128 template<typename TRes>
129 inline ResKind resKind() { return ResTraits<TRes>::kind; }
130
139 template<typename TRes>
140 inline bool isKind( const ResKind & val_r )
141 { return( resKind<TRes>() == val_r ); }
142
143 template<typename TRes>
144 inline bool isKind( const std::string & val_r )
145 { return( resKind<TRes>() == val_r ); }
146
147 template<typename TRes>
148 inline bool isKind( const char * val_r )
149 { return( resKind<TRes>() == val_r ); }
150
151
153} // namespace zypp
155#endif // ZYPP_RESTRAITS_H
ResKind.h
intrusive_ptr
zypp::Application
Class representing an application (appdata.xml)
Definition Application.h:28
zypp::Package
Package interface.
Definition Package.h:34
zypp::Patch
Class representing a patch.
Definition Patch.h:38
zypp::Pattern
Pattern interface.
Definition Pattern.h:32
zypp::PoolItem
Combining sat::Solvable and ResStatus.
Definition PoolItem.h:51
zypp::Product
Product interface.
Definition Product.h:34
zypp::ResKind
Resolvable kinds.
Definition ResKind.h:33
zypp::ResKind::patch
static const ResKind patch
Definition ResKind.h:41
zypp::ResObject
Base for resolvable objects.
Definition ResObject.h:38
zypp::Resolvable
Base for resolvable objects.
Definition Resolvable.h:51
zypp::SrcPackage
SrcPackage interface.
Definition SrcPackage.h:30
zypp::traits
Definition ResTraits.h:24
zypp::traits::isPseudoInstalled
bool isPseudoInstalled(const ResKind &kind_r)
Those are denoted to be installed, if the solver verifies them as being satisfied.
Definition ResTraits.h:28
zypp
Easy-to use interface to the ZYPP dependency resolver.
Definition Application.cc:20
zypp::kind
const ResKind ResTraits< Package >::kind(ResKind::package)
zypp::isKind
bool isKind(const ResKind &val_r)
Convenient test for ResKinds.
Definition ResTraits.h:140
zypp::resKind
ResKind resKind()
Convenient access to well known ResKinds.
Definition ResTraits.h:129
zypp::ResTraits< ResObject >::PtrType
intrusive_ptr< ResObject > PtrType
Definition ResTraits.h:118
zypp::ResTraits< ResObject >::constPtrType
intrusive_ptr< const ResObject > constPtrType
Definition ResTraits.h:119
zypp::ResTraits< ResObject >::KindType
ResKind KindType
Definition ResTraits.h:117
zypp::ResTraits< Resolvable >::PtrType
intrusive_ptr< Resolvable > PtrType
Definition ResTraits.h:107
zypp::ResTraits< Resolvable >::constPtrType
intrusive_ptr< const Resolvable > constPtrType
Definition ResTraits.h:108
zypp::ResTraits< Resolvable >::KindType
ResKind KindType
Definition ResTraits.h:106
zypp::ResTraits
ResTraits.
Definition ResTraits.h:80
zypp::ResTraits< Self >::ZYPP_API
static const ResKind kind ZYPP_API
Definition ResTraits.h:85
zypp::ResTraits< Self >::PtrType
intrusive_ptr< Self > PtrType
Definition ResTraits.h:82
zypp::ResTraits< Self >::KindType
ResKind KindType
Definition ResTraits.h:81
zypp::ResTraits< Self >::constPtrType
intrusive_ptr< const Self > constPtrType
Definition ResTraits.h:83
zypp::ResTraits::isPseudoInstalled
static bool isPseudoInstalled()
Those are denoted to be installed, if the solver verifies them as being satisfied.
Definition ResTraits.h:89
ZYPP_API
#define ZYPP_API
Definition Globals.h:69
DEFINE_PTR_TYPE
#define DEFINE_PTR_TYPE(NAME)
Forward declaration of Ptr types.
Definition PtrTypes.h:639
PtrTypes.h