libzypp  17.36.1
SolvAttr.cc
Go to the documentation of this file.
1 /*---------------------------------------------------------------------\
2 | ____ _ __ __ ___ |
3 | |__ / \ / / . \ . \ |
4 | / / \ V /| _/ _/ |
5 | / /__ | | | | | | |
6 | /_____||_| |_| |_| |
7 | |
8 \---------------------------------------------------------------------*/
12 extern "C"
13 {
14 #include <solv/knownid.h>
15 }
16 
17 #include <iostream>
18 
19 #include <zypp/base/String.h>
20 #include <zypp/sat/SolvAttr.h>
21 
22 using std::endl;
23 
25 namespace zypp
26 {
27 namespace sat
28 {
29 
30  const SolvAttr SolvAttr::allAttr( detail::noId );
31  const SolvAttr SolvAttr::noAttr;
32 
33 // There are some attributes here which are not provided by solv files.
34 // At least the ones that do nat have a solv/knownid.
35 
36  const SolvAttr SolvAttr::name ( SOLVABLE_NAME );
37  const SolvAttr SolvAttr::edition ( SOLVABLE_EVR );
38  const SolvAttr SolvAttr::arch ( SOLVABLE_ARCH );
39  const SolvAttr SolvAttr::vendor ( SOLVABLE_VENDOR );
40 
41 #if __cplusplus < 202002L
42  const SolvAttr SolvAttr::provides ( SOLVABLE_PROVIDES );
43  const SolvAttr SolvAttr::obsoletes ( SOLVABLE_OBSOLETES );
44  const SolvAttr SolvAttr::conflicts ( SOLVABLE_CONFLICTS );
45  const SolvAttr SolvAttr::requires ( SOLVABLE_REQUIRES );
46  const SolvAttr SolvAttr::recommends ( SOLVABLE_RECOMMENDS );
47  const SolvAttr SolvAttr::suggests ( SOLVABLE_SUGGESTS );
48  const SolvAttr SolvAttr::supplements ( SOLVABLE_SUPPLEMENTS );
49  const SolvAttr SolvAttr::enhances ( SOLVABLE_ENHANCES );
50 #endif
51 
52  const SolvAttr SolvAttr::dep_provides ( SOLVABLE_PROVIDES );
53  const SolvAttr SolvAttr::dep_obsoletes ( SOLVABLE_OBSOLETES );
54  const SolvAttr SolvAttr::dep_conflicts ( SOLVABLE_CONFLICTS );
55  const SolvAttr SolvAttr::dep_requires ( SOLVABLE_REQUIRES );
56  const SolvAttr SolvAttr::dep_recommends ( SOLVABLE_RECOMMENDS );
57  const SolvAttr SolvAttr::dep_suggests ( SOLVABLE_SUGGESTS );
58  const SolvAttr SolvAttr::dep_supplements( SOLVABLE_SUPPLEMENTS );
59  const SolvAttr SolvAttr::dep_enhances ( SOLVABLE_ENHANCES );
60 
61  const SolvAttr SolvAttr::summary ( SOLVABLE_SUMMARY ); // translated
62  const SolvAttr SolvAttr::description ( SOLVABLE_DESCRIPTION ); // translated
63  const SolvAttr SolvAttr::insnotify ( SOLVABLE_MESSAGEINS ); // translated
64  const SolvAttr SolvAttr::delnotify ( SOLVABLE_MESSAGEDEL ); // translated
65  const SolvAttr SolvAttr::eula ( SOLVABLE_EULA ); // translated
66  const SolvAttr SolvAttr::cpeid ( SOLVABLE_CPEID );
67  const SolvAttr SolvAttr::installtime ( SOLVABLE_INSTALLTIME );
68  const SolvAttr SolvAttr::buildtime ( SOLVABLE_BUILDTIME );
69  const SolvAttr SolvAttr::installsize ( SOLVABLE_INSTALLSIZE );
70  const SolvAttr SolvAttr::downloadsize ( SOLVABLE_DOWNLOADSIZE );
71  const SolvAttr SolvAttr::diskusage ( SOLVABLE_DISKUSAGE );
72 
73  //package
74  const SolvAttr SolvAttr::checksum ( SOLVABLE_CHECKSUM );
75  const SolvAttr SolvAttr::medianr ( SOLVABLE_MEDIANR );
76  const SolvAttr SolvAttr::mediafile ( SOLVABLE_MEDIAFILE );
77  const SolvAttr SolvAttr::mediadir ( SOLVABLE_MEDIADIR );
78  const SolvAttr SolvAttr::changelog ( "changelog" );
79  const SolvAttr SolvAttr::buildhost ( SOLVABLE_BUILDHOST );
80  const SolvAttr SolvAttr::distribution ( SOLVABLE_DISTRIBUTION );
81  const SolvAttr SolvAttr::license ( SOLVABLE_LICENSE );
82  const SolvAttr SolvAttr::packager ( SOLVABLE_PACKAGER );
83  const SolvAttr SolvAttr::group ( SOLVABLE_GROUP );
84  const SolvAttr SolvAttr::keywords ( SOLVABLE_KEYWORDS );
85  const SolvAttr SolvAttr::sourcesize ( "sourcesize" );
86  const SolvAttr SolvAttr::authors ( SOLVABLE_AUTHORS );
87  const SolvAttr SolvAttr::filelist ( SOLVABLE_FILELIST );
88  const SolvAttr SolvAttr::sourcearch ( SOLVABLE_SOURCEARCH );
89  const SolvAttr SolvAttr::sourcename ( SOLVABLE_SOURCENAME );
90  const SolvAttr SolvAttr::sourceevr ( SOLVABLE_SOURCEEVR );
91  const SolvAttr SolvAttr::headerend ( SOLVABLE_HEADEREND );
92  const SolvAttr SolvAttr::url ( SOLVABLE_URL );
93 
94  // patch
95  const SolvAttr SolvAttr::patchcategory ( SOLVABLE_PATCHCATEGORY );
96  const SolvAttr SolvAttr::rebootSuggested ( UPDATE_REBOOT );
97  const SolvAttr SolvAttr::restartSuggested ( UPDATE_RESTART );
98  const SolvAttr SolvAttr::reloginSuggested ( UPDATE_RELOGIN );
99  const SolvAttr SolvAttr::message ( UPDATE_MESSAGE );
100  const SolvAttr SolvAttr::severity ( UPDATE_SEVERITY );
101  const SolvAttr SolvAttr::updateStatus ( UPDATE_STATUS );
102  const SolvAttr SolvAttr::updateCollection ( UPDATE_COLLECTION );
103  const SolvAttr SolvAttr::updateCollectionName ( UPDATE_COLLECTION_NAME );
104  const SolvAttr SolvAttr::updateCollectionEvr ( UPDATE_COLLECTION_EVR );
105  const SolvAttr SolvAttr::updateCollectionArch ( UPDATE_COLLECTION_ARCH );
106  const SolvAttr SolvAttr::updateCollectionFilename ( UPDATE_COLLECTION_FILENAME );
107  const SolvAttr SolvAttr::updateCollectionFlags ( UPDATE_COLLECTION_FLAGS );
108  const SolvAttr SolvAttr::updateReference ( UPDATE_REFERENCE );
109  const SolvAttr SolvAttr::updateReferenceType ( UPDATE_REFERENCE_TYPE );
110  const SolvAttr SolvAttr::updateReferenceHref ( UPDATE_REFERENCE_HREF );
111  const SolvAttr SolvAttr::updateReferenceId ( UPDATE_REFERENCE_ID );
112  const SolvAttr SolvAttr::updateReferenceTitle ( UPDATE_REFERENCE_TITLE );
113 
114  //pattern
115  const SolvAttr SolvAttr::isvisible ( SOLVABLE_ISVISIBLE );
116  const SolvAttr SolvAttr::icon ( SOLVABLE_ICON );
117  const SolvAttr SolvAttr::order ( SOLVABLE_ORDER );
118  const SolvAttr SolvAttr::isdefault ( "isdefault" );
119  const SolvAttr SolvAttr::category ( SOLVABLE_CATEGORY ); // translated
120  const SolvAttr SolvAttr::script ( "script" );
121  const SolvAttr SolvAttr::includes ( SOLVABLE_INCLUDES );
122  const SolvAttr SolvAttr::extends ( SOLVABLE_EXTENDS );
123 
124  // product
125  const SolvAttr SolvAttr::productReferenceFile ( PRODUCT_REFERENCEFILE );
126  const SolvAttr SolvAttr::productProductLine ( PRODUCT_PRODUCTLINE );
127  const SolvAttr SolvAttr::productShortlabel ( PRODUCT_SHORTLABEL );
128  const SolvAttr SolvAttr::productDistproduct ( PRODUCT_DISTPRODUCT );
129  const SolvAttr SolvAttr::productDistversion ( PRODUCT_DISTVERSION );
130  const SolvAttr SolvAttr::productType ( PRODUCT_TYPE );
131  const SolvAttr SolvAttr::productFlags ( PRODUCT_FLAGS );
132  const SolvAttr SolvAttr::productEndOfLife ( PRODUCT_ENDOFLIFE );
133  const SolvAttr SolvAttr::productRegisterTarget ( PRODUCT_REGISTER_TARGET );
134  const SolvAttr SolvAttr::productRegisterRelease( PRODUCT_REGISTER_RELEASE );
135  const SolvAttr SolvAttr::productRegisterFlavor ( PRODUCT_REGISTER_FLAVOR );
136  const SolvAttr SolvAttr::productUrl ( PRODUCT_URL );
137  const SolvAttr SolvAttr::productUrlType ( PRODUCT_URL_TYPE );
139  const SolvAttr SolvAttr::productUpdates ( PRODUCT_UPDATES );
140  const SolvAttr SolvAttr::productUpdatesRepoid ( PRODUCT_UPDATES_REPOID );
141 
142  // repository
143  const SolvAttr SolvAttr::repositoryDeltaInfo ( REPOSITORY_DELTAINFO );
144  const SolvAttr SolvAttr::repositoryAddedFileProvides ( REPOSITORY_ADDEDFILEPROVIDES );
145  const SolvAttr SolvAttr::repositoryRpmDbCookie ( REPOSITORY_RPMDBCOOKIE );
146  const SolvAttr SolvAttr::repositoryTimestamp ( REPOSITORY_TIMESTAMP );
147  const SolvAttr SolvAttr::repositoryExpire ( REPOSITORY_EXPIRE );
149  const SolvAttr SolvAttr::repositoryUpdates ( REPOSITORY_UPDATES );
151  const SolvAttr SolvAttr::repositoryDistros ( REPOSITORY_DISTROS );
152  const SolvAttr SolvAttr::repositoryProductLabel ( REPOSITORY_PRODUCT_LABEL );
153  const SolvAttr SolvAttr::repositoryProductCpeid ( REPOSITORY_PRODUCT_CPEID );
154  const SolvAttr SolvAttr::repositoryRepoid ( REPOSITORY_REPOID );
155  const SolvAttr SolvAttr::repositoryKeywords ( REPOSITORY_KEYWORDS );
156  const SolvAttr SolvAttr::repositoryRevision ( REPOSITORY_REVISION );
157  const SolvAttr SolvAttr::repositoryToolVersion ( REPOSITORY_TOOLVERSION );
158 
159 
160 
162 
164  {
165  switch( id() )
166  {
167  case UPDATE_COLLECTION_NAME:
168  case UPDATE_COLLECTION_EVR:
169  case UPDATE_COLLECTION_ARCH:
170  case UPDATE_COLLECTION_FILENAME:
171  case UPDATE_COLLECTION_FLAGS:
172  return updateCollection;
173  break;
174 
175  case UPDATE_REFERENCE_TYPE:
176  case UPDATE_REFERENCE_HREF:
177  case UPDATE_REFERENCE_ID:
178  case UPDATE_REFERENCE_TITLE:
179  return updateReference;
180  break;
181  }
182  return noAttr;
183  }
184 
185 } // namespace sat
187 } // namespace zypp
static const SolvAttr productFlags
Definition: SolvAttr.h:168
static const SolvAttr productUpdates
array of repoids, hopefully label s too
Definition: SolvAttr.h:175
static const SolvAttr dep_provides
Definition: SolvAttr.h:79
SolvAttr parent() const
Return the parent of well know sub-structure attributes (SolvAttr::noAttr if none).
Definition: SolvAttr.cc:163
static const SolvAttr updateReferenceHref
Definition: SolvAttr.h:143
static const SolvAttr order
Definition: SolvAttr.h:152
static const SolvAttr repositoryExpire
Definition: SolvAttr.h:185
static const SolvAttr isvisible
Definition: SolvAttr.h:150
static const SolvAttr isdefault
Definition: SolvAttr.h:153
static const SolvAttr repositoryProductLabel
Definition: SolvAttr.h:188
static const SolvAttr dep_obsoletes
Definition: SolvAttr.h:80
static const SolvAttr productDistversion
Definition: SolvAttr.h:166
static const SolvAttr allAttr
Value to request searching all Attributes (0).
Definition: SolvAttr.h:46
static const SolvAttr repositoryDeltaInfo
Definition: SolvAttr.h:181
static const SolvAttr updateReference
Definition: SolvAttr.h:141
static const SolvAttr arch
Definition: SolvAttr.h:54
static const SolvAttr installtime
Definition: SolvAttr.h:95
static const SolvAttr changelog
Definition: SolvAttr.h:109
static const SolvAttr productRegisterRelease
Definition: SolvAttr.h:171
static const SolvAttr productEndOfLife
Definition: SolvAttr.h:169
static const SolvAttr repositoryTimestamp
Definition: SolvAttr.h:184
static const SolvAttr productProductLine
Definition: SolvAttr.h:163
static const SolvAttr productUrlType
Definition: SolvAttr.h:174
static const SolvAttr dep_recommends
Definition: SolvAttr.h:83
static const SolvAttr packager
Definition: SolvAttr.h:113
static const SolvAttr sourcearch
Definition: SolvAttr.h:119
static const SolvAttr updateReferenceTitle
Definition: SolvAttr.h:145
static const SolvAttr insnotify
Definition: SolvAttr.h:92
static const SolvAttr icon
Definition: SolvAttr.h:151
static const SolvAttr repositoryAddedFileProvides
Definition: SolvAttr.h:182
static const SolvAttr repositoryRevision
Definition: SolvAttr.h:192
static const SolvAttr productRegisterTarget
Definition: SolvAttr.h:170
static const SolvAttr diskusage
Definition: SolvAttr.h:99
static const SolvAttr mediafile
Definition: SolvAttr.h:108
static const SolvAttr updateReferenceId
Definition: SolvAttr.h:144
static const SolvAttr sourceevr
Definition: SolvAttr.h:121
Solvable attribute keys.
Definition: SolvAttr.h:40
static const SolvAttr url
Definition: SolvAttr.h:123
static const SolvAttr dep_supplements
Definition: SolvAttr.h:85
static const SolvAttr productDistproduct
Definition: SolvAttr.h:165
static const SolvAttr updateCollection
Definition: SolvAttr.h:135
static const SolvAttr updateCollectionEvr
Definition: SolvAttr.h:137
static const SolvAttr repositoryToolVersion
Definition: SolvAttr.h:193
static const SolvAttr headerend
Definition: SolvAttr.h:122
static const SolvAttr productRegisterFlavor
Definition: SolvAttr.h:172
static const SolvAttr license
Definition: SolvAttr.h:112
static const SolvAttr vendor
Definition: SolvAttr.h:55
static const SolvAttr category
Definition: SolvAttr.h:154
static const SolvAttr severity
Definition: SolvAttr.h:133
static const SolvAttr productType
Definition: SolvAttr.h:167
static const SolvAttr dep_enhances
Definition: SolvAttr.h:86
static const SolvAttr authors
Definition: SolvAttr.h:117
static const SolvAttr name
Definition: SolvAttr.h:52
static const SolvAttr updateStatus
Definition: SolvAttr.h:134
static const SolvAttr buildhost
Definition: SolvAttr.h:110
static const SolvAttr checksum
Definition: SolvAttr.h:105
static const SolvAttr downloadsize
Definition: SolvAttr.h:98
static const SolvAttr message
Definition: SolvAttr.h:132
static const SolvAttr productUrl
Definition: SolvAttr.h:173
static const SolvAttr updateCollectionFilename
Definition: SolvAttr.h:139
static const SolvAttr includes
Definition: SolvAttr.h:156
static const SolvAttr delnotify
Definition: SolvAttr.h:93
static const SolvAttr noAttr
Value representing noAttr ("")
Definition: SolvAttr.h:48
static const SolvAttr sourcename
Definition: SolvAttr.h:120
static const SolvAttr installsize
Definition: SolvAttr.h:97
static const SolvAttr dep_suggests
Definition: SolvAttr.h:84
static const SolvAttr buildtime
Definition: SolvAttr.h:96
static const SolvAttr patchcategory
Definition: SolvAttr.h:128
static const SolvAttr cpeid
Definition: SolvAttr.h:100
static const SolvAttr productUpdatesRepoid
Definition: SolvAttr.h:176
static const SolvAttr updateReferenceType
Definition: SolvAttr.h:142
static const SolvAttr repositoryRepoid
Definition: SolvAttr.h:190
static const SolvAttr description
Definition: SolvAttr.h:91
static const SolvAttr restartSuggested
Definition: SolvAttr.h:130
static const SolvAttr dep_requires
Definition: SolvAttr.h:82
static const SolvAttr sourcesize
Definition: SolvAttr.h:116
static const IdType noId(0)
static const SolvAttr keywords
Definition: SolvAttr.h:115
static const SolvAttr reloginSuggested
Definition: SolvAttr.h:131
static const SolvAttr repositoryKeywords
Definition: SolvAttr.h:191
static const SolvAttr repositoryProductCpeid
Definition: SolvAttr.h:189
static const SolvAttr group
Definition: SolvAttr.h:114
static const SolvAttr dep_conflicts
Definition: SolvAttr.h:81
static const SolvAttr edition
Definition: SolvAttr.h:53
static const SolvAttr filelist
Definition: SolvAttr.h:118
static const SolvAttr updateCollectionName
Definition: SolvAttr.h:136
static const SolvAttr eula
Definition: SolvAttr.h:94
static const SolvAttr summary
Definition: SolvAttr.h:90
static const SolvAttr repositoryRpmDbCookie
Definition: SolvAttr.h:183
static const SolvAttr repositoryDistros
array of repositoryProductLabel repositoryProductCpeid pairs
Definition: SolvAttr.h:187
static const SolvAttr distribution
Definition: SolvAttr.h:111
static const SolvAttr repositoryUpdates
array of repositoryProductLabel repositoryProductCpeid pairs
Definition: SolvAttr.h:186
static const SolvAttr updateCollectionArch
Definition: SolvAttr.h:138
Easy-to use interface to the ZYPP dependency resolver.
Definition: Application.cc:19
static const SolvAttr extends
Definition: SolvAttr.h:157
static const SolvAttr productReferenceFile
Definition: SolvAttr.h:162
static const SolvAttr script
Definition: SolvAttr.h:155
static const SolvAttr rebootSuggested
Definition: SolvAttr.h:129
static const SolvAttr productShortlabel
Definition: SolvAttr.h:164
static const SolvAttr mediadir
Definition: SolvAttr.h:106
static const SolvAttr medianr
Definition: SolvAttr.h:107
static const SolvAttr updateCollectionFlags
Definition: SolvAttr.h:140