libzypp: zypp/ng/sat/lookupattr.cc Source File

libzypp 17.38.14

lookupattr.cc
Go to the documentation of this file.
1/*---------------------------------------------------------------------\
2| ____ _ __ __ ___ |
3| |__ / \ / / . \ . \ |
4| / / \ V /| _/ _/ |
5| / /__ | | | | | | |
6| /_____||_| |_| |_| |
7| |
8\---------------------------------------------------------------------*/
12#include <iostream>
13#include <sstream>
14#include <utility>
15
16#include <zypp-core/base/LogTools.h>
17#include <zypp-core/base/String.h>
18
19#include <zypp/ng/sat/pool.h>
20#include <zypp/ng/idstringtype.h>
21#include <zypp/ng/sat/lookupattr.h>
22#include <zypp/base/StrMatcher.h>
23#include <zypp/ng/sat/capability.h>
24
25#include <zypp-core/CheckSum.h>
26
27using std::endl;
28
29namespace zyppng::sat
30{
31 using detail::noSolvableId;
32
46 class LookupAttr::Impl
47 {
48 public:
49 Impl()
50 : _pool( nullptr )
51 , _parent( SolvAttr::noAttr )
52 {}
53 Impl( detail::CPool * pool_r, const SolvAttr& attr_r, Location loc_r )
54 : _pool( pool_r ), _attr( attr_r ), _parent( attr_r.parent() ), _solv( loc_r == REPO_ATTR ? SOLVID_META : noSolvableId )
55 {}
56 Impl( detail::CPool * pool_r, const SolvAttr& attr_r, Repository repo_r, Location loc_r )
57 : _pool( pool_r ), _attr( attr_r ), _parent( attr_r.parent() ), _repo( repo_r ), _solv( loc_r == REPO_ATTR ? SOLVID_META : noSolvableId )
58 {}
59 Impl( detail::CPool * pool_r, const SolvAttr& attr_r, Solvable solv_r )
60 : _pool( pool_r ), _attr( attr_r ), _parent( attr_r.parent() ), _solv( solv_r )
61 {}
62
63 public:
64 SolvAttr attr() const
65 { return _attr; }
66
67 void setAttr( SolvAttr attr_r )
68 {
69 _attr = std::move(attr_r);
70 SolvAttr p( _attr.parent() );
71 if ( p != SolvAttr::noAttr )
72 _parent = p;
73 }
74
75 const StrMatcher & strMatcher() const
76 { return _strMatcher; }
77
78 void setStrMatcher( const StrMatcher & matcher_r )
79 {
80 matcher_r.compile();
81 _strMatcher = matcher_r;
82 }
83
84 public:
85 bool pool() const
86 { return ! (_repo || _solv); }
87
88 void setPool( Location loc_r )
89 {
90 _repo = Repository::noRepository;
91 _solv = Solvable( loc_r == REPO_ATTR ? SOLVID_META : noSolvableId );
92 }
93
94 Repository repo() const
95 { return _repo; }
96
97 void setRepo( Repository repo_r, Location loc_r )
98 {
99 _repo = repo_r;
100 _solv = Solvable( loc_r == REPO_ATTR ? SOLVID_META : noSolvableId );
101 // Extract pool from repo
102 if ( _repo )
103 _pool = _repo.pool().get();
104 }
105
106 Solvable solvable() const
107 { return _solv; }
108
109 void setSolvable( Solvable solv_r )
110 {
111 _repo = Repository::noRepository;
112 _solv = solv_r;
113 // Extract pool from solvable
114 if ( _solv )
115 _pool = _solv.pool().get();
116 }
117
118 SolvAttr parent() const
119 { return _parent; }
120
121 void setParent( SolvAttr attr_r )
122 { _parent = std::move(attr_r); }
123
124 public:
125 LookupAttr::iterator begin() const
126 {
127 if ( _attr == SolvAttr::noAttr || ! _pool || ! _pool->nrepos )
128 return end();
129
130 detail::RepoIdType whichRepo = detail::noRepoId; // all repos
131 if ( _solv )
132 whichRepo = _solv.repository();
133 else if ( _repo )
134 whichRepo = _repo.id();
135
136 detail::DIWrap dip( _pool, whichRepo, _solv.id(), _attr.id(), _strMatcher.searchstring(), _strMatcher.flags().get() );
137 if ( _parent != SolvAttr::noAttr )
138 ::dataiterator_prepend_keyname( dip.get(), _parent.id() );
139
140 return iterator( dip ); // iterator takes over ownership!
141 }
142
143 LookupAttr::iterator end() const
144 { return iterator(); }
145
146 private:
147 detail::CPool * _pool;
148 SolvAttr _attr;
149 SolvAttr _parent;
150 Repository _repo;
151 Solvable _solv;
152 StrMatcher _strMatcher;
153
154 private:
155 friend Impl * zypp::rwcowClone<Impl>( const Impl * rhs );
157 Impl * clone() const
158 { return new Impl( *this ); }
159 };
160
164
165 LookupAttr::LookupAttr()
166 : _pimpl( new Impl )
167 {}
168
169 LookupAttr::LookupAttr( Pool & pool, SolvAttr attr_r, Location loc_r )
170 : _pimpl( new Impl( pool.get(), std::move(attr_r), std::move(loc_r) ) )
171 {}
172
173 LookupAttr::LookupAttr( Pool & pool, SolvAttr attr_r, SolvAttr parent_r, Location loc_r )
174 : _pimpl( new Impl( pool.get(), std::move(attr_r), std::move(loc_r) ) )
175 { _pimpl->setParent( std::move(parent_r) ); }
176
177 LookupAttr::LookupAttr( SolvAttr attr_r, Repository repo_r, Location loc_r )
178 {
179 detail::CPool * cp = repo_r.pool().get();
180 _pimpl.reset( new Impl( cp, std::move(attr_r), std::move(repo_r), std::move(loc_r) ) );
181 }
182
183 LookupAttr::LookupAttr( SolvAttr attr_r, SolvAttr parent_r, Repository repo_r, Location loc_r )
184 {
185 detail::CPool * cp = repo_r.pool().get();
186 _pimpl.reset( new Impl( cp, std::move(attr_r), std::move(repo_r), std::move(loc_r) ) );
187 _pimpl->setParent( std::move(parent_r) );
188 }
189
190 LookupAttr::LookupAttr( SolvAttr attr_r, Solvable solv_r )
191 {
192 detail::CPool * cp = solv_r.pool().get();
193 _pimpl.reset( new Impl( cp, std::move(attr_r), std::move(solv_r) ) );
194 }
195
196 LookupAttr::LookupAttr( SolvAttr attr_r, SolvAttr parent_r, Solvable solv_r )
197 {
198 detail::CPool * cp = solv_r.pool().get();
199 _pimpl.reset( new Impl( cp, std::move(attr_r), std::move(solv_r) ) );
200 _pimpl->setParent( std::move(parent_r) );
201 }
202
203
204 SolvAttr LookupAttr::attr() const
205 { return _pimpl->attr(); }
206
207 void LookupAttr::setAttr( SolvAttr attr_r )
208 { _pimpl->setAttr( std::move(attr_r) ); }
209
210 const StrMatcher & LookupAttr::strMatcher() const
211 { return _pimpl->strMatcher(); }
212
213 void LookupAttr::setStrMatcher( const StrMatcher & matcher_r )
214 { _pimpl->setStrMatcher( matcher_r ); }
215
216 bool LookupAttr::pool() const
217 { return _pimpl->pool(); }
218
219 void LookupAttr::setPool(Location loc_r )
220 { _pimpl->setPool( loc_r ); }
221
222 Repository LookupAttr::repo() const
223 { return _pimpl->repo(); }
224
225 void LookupAttr::setRepo( Repository repo_r, Location loc_r )
226 { _pimpl->setRepo( repo_r, loc_r ); }
227
228 Solvable LookupAttr::solvable() const
229 { return _pimpl->solvable(); }
230
231 void LookupAttr::setSolvable( Solvable solv_r )
232 { _pimpl->setSolvable( solv_r ); }
233
234 SolvAttr LookupAttr::parent() const
235 { return _pimpl->parent(); }
236
237 void LookupAttr::setParent( SolvAttr attr_r )
238 { _pimpl->setParent( std::move(attr_r) ); }
239
240 LookupAttr::iterator LookupAttr::begin() const
241 { return _pimpl->begin(); }
242
243 LookupAttr::iterator LookupAttr::end() const
244 { return _pimpl->end(); }
245
246 bool LookupAttr::empty() const
247 { return begin() == end(); }
248
249 LookupAttr::size_type LookupAttr::size() const
250 {
251 size_type c = 0;
252 for ( auto it = begin(); it != end(); ++it )
253 ++c;
254 return c;
255 }
256
260
261 LookupRepoAttr::LookupRepoAttr( SolvAttr attr_r, Repository repo_r )
262 : LookupAttr( std::move(attr_r), repo_r, REPO_ATTR )
263 {}
264
265 void LookupRepoAttr::setRepo( Repository repo_r )
266 { LookupAttr::setRepo( repo_r, REPO_ATTR ); }
267
271
272 namespace detail
273 {
274 DIWrap::DIWrap( detail::CPool * pool, RepoIdType repoId_r, SolvableIdType solvId_r, IdType attrId_r,
275 std::string mstring_r, int flags_r )
276 : _dip( new ::Dataiterator )
277 , _pool( pool )
278 , _mstring(std::move( mstring_r ))
279 {
280 ::dataiterator_init( _dip, _pool, repoId_r, solvId_r, attrId_r,
281 _mstring.empty() ? 0 : _mstring.c_str(), flags_r );
282 }
283
284 DIWrap::DIWrap( detail::CPool * pool, RepoIdType repoId_r, SolvableIdType solvId_r, IdType attrId_r,
285 const char * mstring_r, int flags_r )
286 : _dip( new ::Dataiterator )
287 , _pool( pool )
288 , _mstring( mstring_r ? mstring_r : "" )
289 {
290 ::dataiterator_init( _dip, _pool, repoId_r, solvId_r, attrId_r,
291 _mstring.empty() ? 0 : _mstring.c_str(), flags_r );
292 }
293
294 DIWrap::DIWrap( const DIWrap & rhs )
295 : _dip( 0 )
296 , _pool( rhs._pool )
297 , _mstring( rhs._mstring )
298 {
299 if ( rhs._dip )
300 {
301 _dip = new ::Dataiterator;
302 ::dataiterator_init_clone( _dip, rhs._dip );
303 ::dataiterator_strdup( _dip );
304 }
305 }
306
307 DIWrap::~DIWrap()
308 {
309 if ( _dip )
310 {
311 ::dataiterator_free( _dip );
312 delete _dip;
313 }
314 }
315 }
316
320
321 Repository LookupAttrValue::inRepo() const
322 { return _dip ? Repository( _dip->repo ) : Repository::noRepository; }
323
324 Solvable LookupAttrValue::inSolvable() const
325 { return _dip ? Solvable( _dip->solvid ) : Solvable::noSolvable; }
326
327 SolvAttr LookupAttrValue::inSolvAttr() const
328 { return _dip ? SolvAttr( _dip->key->name ) : SolvAttr::noAttr; }
329
330 void LookupAttr::iterator::nextSkipSolvAttr()
331 { if ( _dip ) ::dataiterator_skip_attribute( _dip.get() ); }
332
333 void LookupAttr::iterator::nextSkipSolvable()
334 { if ( _dip ) ::dataiterator_skip_solvable( _dip.get() ); }
335
336 void LookupAttr::iterator::nextSkipRepo()
337 { if ( _dip ) ::dataiterator_skip_repo( _dip.get() ); }
338
339 void LookupAttr::iterator::stayInThisSolvable()
340 { if ( _dip ) { _dip.get()->repoid = -1; _dip.get()->flags |= SEARCH_THISSOLVID; } }
341
342 void LookupAttr::iterator::stayInThisRepo()
343 { if ( _dip ) { _dip.get()->repoid = -1; } }
344
345 detail::IdType LookupAttrValue::solvAttrType() const
346 { return _dip ? _dip->key->type : detail::noId; }
347
348 bool LookupAttrValue::solvAttrNumeric() const
349 {
350 switch ( solvAttrType() )
351 {
352 case REPOKEY_TYPE_NUM:
353 case REPOKEY_TYPE_CONSTANT:
354 return true;
355 break;
356 }
357 return false;
358 }
359
360 bool LookupAttrValue::solvAttrString() const
361 {
362 switch ( solvAttrType() )
363 {
364 case REPOKEY_TYPE_ID:
365 case REPOKEY_TYPE_IDARRAY:
366 case REPOKEY_TYPE_CONSTANTID:
367 case REPOKEY_TYPE_STR:
368 case REPOKEY_TYPE_DIRSTRARRAY:
369 return true;
370 break;
371 }
372 return false;
373 }
374
375 bool LookupAttrValue::solvAttrIdString() const
376 {
377 switch ( solvAttrType() )
378 {
379 case REPOKEY_TYPE_ID:
380 case REPOKEY_TYPE_IDARRAY:
381 case REPOKEY_TYPE_CONSTANTID:
382 return true;
383 break;
384 }
385 return false;
386 }
387
388 bool LookupAttrValue::solvAttrCheckSum() const
389 {
390 switch ( solvAttrType() )
391 {
392 case REPOKEY_TYPE_MD5:
393 case REPOKEY_TYPE_SHA1:
394 case REPOKEY_TYPE_SHA256:
395 return true;
396 break;
397 }
398 return false;
399 }
400
401 namespace
402 {
403 enum SubType { ST_NONE, // no sub-structure
404 ST_FLEX, // flexarray
405 ST_SUB }; // inside sub-structure
406 SubType subType( const detail::DIWrap & dip )
407 {
408 if ( ! dip )
409 return ST_NONE;
410 if ( dip.get()->key->type == REPOKEY_TYPE_FLEXARRAY )
411 return ST_FLEX;
412 return dip.get()->kv.parent ? ST_SUB : ST_NONE;
413 }
415 SubType subType( const detail::CDataiterator * dip )
416 {
417 if ( ! dip )
418 return ST_NONE;
419 if ( dip->key->type == REPOKEY_TYPE_FLEXARRAY )
420 return ST_FLEX;
421 return dip->kv.parent ? ST_SUB : ST_NONE;
422 }
423 }
424
425 bool LookupAttrValue::solvAttrSubEntry() const
426 { return subType( _dip ) != ST_NONE; }
427
428 bool LookupAttrValue::subEmpty() const
429 { return subBegin() == subEnd(); }
430
431 LookupAttr::size_type LookupAttrValue::subSize() const
432 {
433 size_type c = 0;
434 for ( auto it = subBegin(); it != subEnd(); ++it )
435 ++c;
436 return c;
437 }
438
439 LookupAttr::iterator LookupAttrValue::subBegin() const
440 {
441 SubType subtype( subType( _dip ) );
442 if ( subtype == ST_NONE )
443 return subEnd();
444 // Clone the current position into a new DIWrap using the pool stored on us.
445 detail::DIWrap dip( _pool, 0, 0, 0 );
446 ::dataiterator_clonepos( dip.get(), _dip );
447 switch ( subtype )
448 {
449 case ST_NONE: // not reached
450 break;
451 case ST_FLEX:
452 ::dataiterator_seek( dip.get(), DI_SEEK_CHILD|DI_SEEK_STAY );
453 break;
454 case ST_SUB:
455 ::dataiterator_seek( dip.get(), DI_SEEK_REWIND|DI_SEEK_STAY );
456 break;
457 }
458 return LookupAttr::iterator( dip ); // iterator takes over ownership!
459 }
460
461 LookupAttr::iterator LookupAttrValue::subEnd() const
462 {
463 return LookupAttr::iterator();
464 }
465
466 LookupAttr::iterator LookupAttrValue::subFind( const SolvAttr & attr_r ) const
467 {
468 LookupAttr::iterator it = subBegin();
469 if ( attr_r != SolvAttr::allAttr )
470 {
471 while ( it != subEnd() && (*it).inSolvAttr() != attr_r )
472 ++it;
473 }
474 return it;
475 }
476
477 LookupAttr::iterator LookupAttrValue::subFind( const zypp::C_Str & attrname_r ) const
478 {
479 if ( attrname_r.empty() )
480 return subBegin();
481
482 SubType subtype( subType( _dip ) );
483 if ( subtype == ST_NONE )
484 return subBegin();
485
486 std::string subattr( inSolvAttr().asString() );
487 if ( subtype == ST_FLEX )
488 {
489 // append ":attrname"
490 subattr += ":";
491 subattr += attrname_r;
492 }
493 else
494 {
495 // replace "oldname" after ':' with "attrname"
496 std::string::size_type pos( subattr.rfind( ':' ) );
497 if ( pos != std::string::npos )
498 {
499 subattr.erase( pos+1 );
500 subattr += attrname_r;
501 }
502 else
503 subattr = attrname_r; // no ':' so replace all.
504 }
505 return subFind( SolvAttr( subattr ) );
506 }
507
508 int LookupAttrValue::asInt() const
509 {
510 if ( _dip )
511 {
512 switch ( solvAttrType() )
513 {
514 case REPOKEY_TYPE_NUM:
515 case REPOKEY_TYPE_CONSTANT:
516 return _dip->kv.num;
517 break;
518 }
519 }
520 return 0;
521 }
522
523 unsigned LookupAttrValue::asUnsigned() const
524 { return asInt(); }
525
526 unsigned long long LookupAttrValue::asUnsignedLL() const
527 {
528 if ( _dip )
529 {
530 switch ( solvAttrType() )
531 {
532 case REPOKEY_TYPE_NUM:
533 case REPOKEY_TYPE_CONSTANT:
534 return SOLV_KV_NUM64(&_dip->kv);
535 break;
536 }
537 }
538 return 0;
539 }
540
541 bool LookupAttrValue::asBool() const
542 { return asInt(); }
543
544
545 const char * LookupAttrValue::c_str() const
546 {
547 if ( _dip )
548 {
549 switch ( solvAttrType() )
550 {
551 case REPOKEY_TYPE_ID:
552 case REPOKEY_TYPE_IDARRAY:
553 case REPOKEY_TYPE_CONSTANTID:
554 if ( _dip->data && _dip->data->localpool )
555 return ::stringpool_id2str( &_dip->data->spool, _dip->kv.id ); // in local pool
556 else
557 return IdString( _dip->kv.id ).c_str(); // in global pool
558 break;
559
560 case REPOKEY_TYPE_STR:
561 return _dip->kv.str;
562 break;
563
564 case REPOKEY_TYPE_DIRSTRARRAY:
565 // may or may not be stringified depending on SEARCH_FILES flag
566 return( _dip->flags & SEARCH_FILES
567 ? _dip->kv.str
568 : ::repodata_dir2str( _dip->data, _dip->kv.id, _dip->kv.str ) );
569 break;
570 }
571 }
572 return 0;
573 }
574
575 std::string LookupAttrValue::asString() const
576 {
577 if ( _dip )
578 {
579 switch ( solvAttrType() )
580 {
581 case REPOKEY_TYPE_ID:
582 case REPOKEY_TYPE_IDARRAY:
583 case REPOKEY_TYPE_CONSTANTID:
584 {
585 detail::IdType id = ::repodata_globalize_id( _dip->data, _dip->kv.id, 1 );
586 return ISRELDEP(id) ? Capability( id ).asString()
587 : IdString( id ).asString();
588 }
589 break;
590
591 case REPOKEY_TYPE_STR:
592 case REPOKEY_TYPE_DIRSTRARRAY:
593 {
594 const char * ret( c_str() );
595 return ret ? ret : "";
596 }
597 break;
598
599 case REPOKEY_TYPE_NUM:
600 case REPOKEY_TYPE_CONSTANT:
601 return zypp::str::numstring( asInt() );
602 break;
603
604 case REPOKEY_TYPE_MD5:
605 case REPOKEY_TYPE_SHA1:
606 case REPOKEY_TYPE_SHA256:
607 {
608 return asCheckSum().asString();
609 }
610 break;
611
612 case REPOKEY_TYPE_FLEXARRAY:
613 {
614 std::ostringstream str;
615 str << "{" << endl;
616 for ( auto it = subBegin(); it != subEnd(); ++it )
617 {
618 str << " " << (*it).inSolvAttr() << " = " << (*it).asString() << endl;
619 }
620 str << "}";
621 return str.str();
622 }
623 break;
624 }
625 }
626 return std::string();
627 }
628
629 IdString LookupAttrValue::idStr() const
630 {
631 if ( _dip )
632 {
633 switch ( solvAttrType() )
634 {
635 case REPOKEY_TYPE_ID:
636 case REPOKEY_TYPE_IDARRAY:
637 case REPOKEY_TYPE_CONSTANTID:
638 return IdString( ::repodata_globalize_id( _dip->data, _dip->kv.id, 1 ) );
639 break;
640 }
641 }
642 return IdString();
643 }
644
645 CheckSum LookupAttrValue::asCheckSum() const
646 {
647 if ( _dip )
648 {
649 switch ( solvAttrType() )
650 {
651 case REPOKEY_TYPE_MD5:
652 return CheckSum::md5( ::repodata_chk2str( _dip->data, solvAttrType(), (unsigned char *)_dip->kv.str ) );
653 break;
654
655 case REPOKEY_TYPE_SHA1:
656 return CheckSum::sha1( ::repodata_chk2str( _dip->data, solvAttrType(), (unsigned char *)_dip->kv.str ) );
657 break;
658
659 case REPOKEY_TYPE_SHA224:
660 return CheckSum::sha224( ::repodata_chk2str( _dip->data, solvAttrType(), (unsigned char *)_dip->kv.str ) );
661 break;
662
663 case REPOKEY_TYPE_SHA256:
664 return CheckSum::sha256( ::repodata_chk2str( _dip->data, solvAttrType(), (unsigned char *)_dip->kv.str ) );
665 break;
666
667 case REPOKEY_TYPE_SHA384:
668 return CheckSum::sha384( ::repodata_chk2str( _dip->data, solvAttrType(), (unsigned char *)_dip->kv.str ) );
669 break;
670
671 case REPOKEY_TYPE_SHA512:
672 return CheckSum::sha512( ::repodata_chk2str( _dip->data, solvAttrType(), (unsigned char *)_dip->kv.str ) );
673 break;
674 }
675 }
676 return CheckSum();
677 }
678
679 LookupAttr::iterator::iterator()
680 {}
681
682 LookupAttr::iterator::iterator( const iterator & rhs )
683 : _dip( rhs._dip )
684 {}
685
686 LookupAttr::iterator::iterator( detail::DIWrap & dip_r )
687 {
688 _dip.swap( dip_r ); // take ownership!
689 increment();
690 }
691
692 LookupAttr::iterator::~iterator()
693 {}
694
695 LookupAttr::iterator & LookupAttr::iterator::operator=( const iterator & rhs )
696 {
697 if ( &rhs != this )
698 {
699 _dip = rhs._dip;
700 }
701 return *this;
702 }
703
704 bool LookupAttr::iterator::dip_equal( const detail::CDataiterator & lhs, const detail::CDataiterator & rhs ) const
705 {
706 // Iterator equal is same position in same container.
707 // Here: same attribute in same solvable.
708 return( lhs.solvid == rhs.solvid && lhs.key->name == rhs.key->name );
709 }
710
711 LookupAttrValue LookupAttr::iterator::operator*() const
712 {
713 return LookupAttrValue( _dip.get(), _dip.pool() );
714 }
715
716 LookupAttr::iterator& LookupAttr::iterator::operator++()
717 {
718 increment();
719 return *this;
720 }
721
722 LookupAttr::iterator LookupAttr::iterator::operator++(int)
723 {
724 iterator tmp = *this;
725 increment();
726 return tmp;
727 }
728
729 bool LookupAttr::iterator::operator==( const iterator & rhs ) const
730 {
731 return ( bool(_dip) == bool(rhs._dip) )
732 && ( ! _dip || dip_equal( *_dip.get(), *rhs._dip.get() ) );
733 }
734
735 void LookupAttr::iterator::increment()
736 {
737 if ( _dip )
738 {
739 if ( ! ::dataiterator_step( _dip.get() ) )
740 {
741 _dip.reset();
742 }
743 else
744 {
745 ::dataiterator_strdup( _dip.get() );
746 }
747 }
748 }
749
750 template<> CheckSum LookupAttrValue::asType<CheckSum>() const
751 { return asCheckSum(); }
752
753} // namespace zyppng::sat
LogTools.h
StrMatcher.h
String.h
zypp::C_Str
Convenience char* constructible from std::string and char*, it maps (char*)0 to an empty string.
Definition String.h:92
zypp::C_Str::empty
bool empty() const
Definition String.h:108
zypp::CheckSum
Definition CheckSum.h:34
zypp::IdString
Access to the sat-pools string space.
Definition IdString.h:55
zypp::IdString::IdString
constexpr IdString()
Default ctor, empty string.
Definition IdString.h:61
zypp::Match::get
int get() const
Return the integer representation.
Definition StrMatcher.h:150
zypp::StrMatcher
String matching (STRING|SUBSTRING|GLOB|REGEX).
Definition StrMatcher.h:298
zypp::StrMatcher::searchstring
const std::string & searchstring() const
The current searchstring.
Definition StrMatcher.cc:306
zypp::StrMatcher::flags
const Match & flags() const
The current search flags.
Definition StrMatcher.cc:325
zypp::StrMatcher::compile
void compile() const
Compile the pattern e.g.
Definition StrMatcher.cc:297
zypp::sat::LookupAttr::iterator::nextSkipSolvAttr
void nextSkipSolvAttr()
On the next call to operator++ advance to the next SolvAttr.
Definition LookupAttr.cc:361
zypp::sat::LookupAttr::end
iterator end() const
Iterator behind the end of query results.
Definition LookupAttr.cc:240
zypp::sat::LookupAttr::strMatcher
const StrMatcher & strMatcher() const
The pattern to match.
Definition LookupAttr.cc:203
zypp::sat::LookupAttr::empty
bool empty() const
Whether the query is empty.
Definition LookupAttr.cc:243
zypp::sat::LookupAttr::setStrMatcher
void setStrMatcher(const StrMatcher &matcher_r)
Set the pattern to match.
Definition LookupAttr.cc:206
zypp::sat::LookupAttr::repo
Repository repo() const
Whether to search in one Repository.
Definition LookupAttr.cc:217
zypp::sat::LookupAttr::attr
SolvAttr attr() const
The SolvAttr to search.
Definition LookupAttr.cc:197
zypp::sat::LookupAttr::parent
SolvAttr parent() const
Whether to search within a sub-structure (SolvAttr::noAttr if not).
Definition LookupAttr.cc:229
zypp::sat::LookupAttr::setAttr
void setAttr(SolvAttr attr_r)
Set the SolvAttr to search.
Definition LookupAttr.cc:200
zypp::sat::LookupAttr::setRepo
void setRepo(Repository repo_r, Location=SOLV_ATTR)
Set search in one Repository.
Definition LookupAttr.cc:220
zypp::sat::LookupAttr::pool
bool pool() const
Whether to search in Pool.
Definition LookupAttr.cc:211
zypp::sat::LookupAttr::size
size_type size() const
Ammount of results.
Definition LookupAttr.cc:246
zypp::sat::LookupAttr::begin
iterator begin() const
Iterator to the begin of query results.
Definition LookupAttr.cc:237
zypp::sat::LookupAttr::setSolvable
void setSolvable(Solvable solv_r)
Set search in one Solvable.
Definition LookupAttr.cc:226
zypp::sat::LookupAttr::solvable
Solvable solvable() const
Whether to search in one Solvable.
Definition LookupAttr.cc:223
zypp::sat::LookupAttr::LookupAttr
LookupAttr()
Default ctor finds nothing.
Definition LookupAttr.cc:169
zypp::sat::LookupAttr::setPool
void setPool(Location=SOLV_ATTR)
Set search in Pool (all repositories).
Definition LookupAttr.cc:214
zypp::sat::LookupAttr::setParent
void setParent(SolvAttr attr_r)
Set search within a sub-structure (SolvAttr::noAttr for none).
Definition LookupAttr.cc:232
zypp::sat::LookupRepoAttr::setRepo
void setRepo(Repository repo_r)
Set search in one Repository.
Definition LookupAttr.cc:288
zypp::sat::LookupRepoAttr::LookupRepoAttr
LookupRepoAttr()
Default ctor finds nothing.
Definition LookupAttr.h:268
zypp::sat::SolvAttr
Solvable attribute keys.
Definition SolvAttr.h:41
zypp::sat::SolvAttr::parent
SolvAttr parent() const
Return the parent of well know sub-structure attributes (SolvAttr::noAttr if none).
Definition SolvAttr.cc:163
zyppng::IdStringType::id
IdType id() const
Definition IdStringType.h:123
zyppng::sat::Capability::Capability
Capability()
Default ctor, Empty capability.
Definition capability.h:80
zyppng::sat::CheckSum::md5
static CheckSum md5(const std::string &checksum)
Definition CheckSum.h:73
zyppng::sat::CheckSum::sha384
static CheckSum sha384(const std::string &checksum)
Definition CheckSum.h:78
zyppng::sat::CheckSum::sha1
static CheckSum sha1(const std::string &checksum)
Definition CheckSum.h:75
zyppng::sat::CheckSum::sha512
static CheckSum sha512(const std::string &checksum)
Definition CheckSum.h:79
zyppng::sat::CheckSum::sha256
static CheckSum sha256(const std::string &checksum)
Definition CheckSum.h:77
zyppng::sat::CheckSum::CheckSum
CheckSum()
Default Ctor: empty checksum.
Definition CheckSum.h:37
zyppng::sat::CheckSum::sha224
static CheckSum sha224(const std::string &checksum)
Definition CheckSum.h:76
zyppng::sat::LookupAttrValue
Value proxy returned by LookupAttr::iterator::operator*().
Definition lookupattr.h:454
zyppng::sat::LookupAttrValue::asString
std::string asString() const
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition lookupattr.cc:575
zyppng::sat::LookupAttrValue::inSolvAttr
SolvAttr inSolvAttr() const
The current SolvAttr.
Definition lookupattr.cc:327
zyppng::sat::LookupAttrValue::subEnd
LookupAttr::iterator subEnd() const
Iterator behind the end of a sub-structure.
Definition lookupattr.cc:461
zyppng::sat::LookupAttrValue::subFind
LookupAttr::iterator subFind(const SolvAttr &attr_r) const
Iterator pointing to the first occurrence of SolvAttr attr_r in the sub-structure.
Definition lookupattr.cc:466
zyppng::sat::LookupAttrValue::subEmpty
bool subEmpty() const
Whether the sub-structure is empty.
Definition lookupattr.cc:428
zyppng::sat::LookupAttrValue::asUnsigned
unsigned asUnsigned() const
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition lookupattr.cc:523
zyppng::sat::LookupAttrValue::solvAttrString
bool solvAttrString() const
Whether this is a string attribute.
Definition lookupattr.cc:360
zyppng::sat::LookupAttrValue::solvAttrNumeric
bool solvAttrNumeric() const
Whether this is a numeric attribute (incl.
Definition lookupattr.cc:348
zyppng::sat::LookupAttrValue::LookupAttrValue
LookupAttrValue(detail::CDataiterator *dip, detail::CPool *pool)
Definition lookupattr.h:459
zyppng::sat::LookupAttrValue::asInt
int asInt() const
Conversion to numeric types.
Definition lookupattr.cc:508
zyppng::sat::LookupAttrValue::size_type
LookupAttr::size_type size_type
Definition lookupattr.h:456
zyppng::sat::LookupAttrValue::solvAttrType
detail::IdType solvAttrType() const
The current SolvAttr type.
Definition lookupattr.cc:345
zyppng::sat::LookupAttrValue::_dip
detail::CDataiterator * _dip
non-owning — current iterator position
Definition lookupattr.h:591
zyppng::sat::LookupAttrValue::idStr
IdString idStr() const
As IdString.
Definition lookupattr.cc:629
zyppng::sat::LookupAttrValue::asType
Tp asType() const
Templated return type.
Definition lookupattr.h:587
zyppng::sat::LookupAttrValue::subBegin
LookupAttr::iterator subBegin() const
Iterator to the begin of a sub-structure.
Definition lookupattr.cc:439
zyppng::sat::LookupAttrValue::solvAttrIdString
bool solvAttrIdString() const
Whether this string attribute is available as IdString.
Definition lookupattr.cc:375
zyppng::sat::LookupAttrValue::solvAttrCheckSum
bool solvAttrCheckSum() const
Whether this is a CheckSum attribute.
Definition lookupattr.cc:388
zyppng::sat::LookupAttrValue::solvAttrSubEntry
bool solvAttrSubEntry() const
Whether this is the entry to a sub-structure (flexarray).
Definition lookupattr.cc:425
zyppng::sat::LookupAttrValue::inSolvable
Solvable inSolvable() const
The current Solvable.
Definition lookupattr.cc:324
zyppng::sat::LookupAttrValue::asBool
bool asBool() const
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition lookupattr.cc:541
zyppng::sat::LookupAttrValue::asUnsignedLL
unsigned long long asUnsignedLL() const
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition lookupattr.cc:526
zyppng::sat::LookupAttrValue::_pool
detail::CPool * _pool
non-owning — needed for sub-structure DIWrap construction
Definition lookupattr.h:592
zyppng::sat::LookupAttrValue::asCheckSum
CheckSum asCheckSum() const
As CheckSum.
Definition lookupattr.cc:645
zyppng::sat::LookupAttrValue::inRepo
Repository inRepo() const
The current Repository.
Definition lookupattr.cc:321
zyppng::sat::LookupAttrValue::c_str
const char * c_str() const
Conversion to string types.
Definition lookupattr.cc:545
zyppng::sat::LookupAttrValue::subSize
size_type subSize() const
Amount of attributes in the sub-structure.
Definition lookupattr.cc:431
zyppng::sat::LookupAttr::Impl
LookupAttr implementation.
Definition lookupattr.cc:47
zyppng::sat::LookupAttr::Impl::Impl
Impl(detail::CPool *pool_r, const SolvAttr &attr_r, Location loc_r)
Definition lookupattr.cc:53
zyppng::sat::LookupAttr::Impl::setSolvable
void setSolvable(Solvable solv_r)
Definition lookupattr.cc:109
zyppng::sat::LookupAttr::Impl::_strMatcher
StrMatcher _strMatcher
Definition lookupattr.cc:152
zyppng::sat::LookupAttr::Impl::begin
LookupAttr::iterator begin() const
Definition lookupattr.cc:125
zyppng::sat::LookupAttr::Impl::repo
Repository repo() const
Definition lookupattr.cc:94
zyppng::sat::LookupAttr::Impl::strMatcher
const StrMatcher & strMatcher() const
Definition lookupattr.cc:75
zyppng::sat::LookupAttr::Impl::setStrMatcher
void setStrMatcher(const StrMatcher &matcher_r)
Definition lookupattr.cc:78
zyppng::sat::LookupAttr::Impl::Impl
Impl(detail::CPool *pool_r, const SolvAttr &attr_r, Solvable solv_r)
Definition lookupattr.cc:59
zyppng::sat::LookupAttr::Impl::_pool
detail::CPool * _pool
Definition lookupattr.cc:147
zyppng::sat::LookupAttr::Impl::_parent
SolvAttr _parent
Definition lookupattr.cc:149
zyppng::sat::LookupAttr::Impl::Impl
Impl()
Definition lookupattr.cc:49
zyppng::sat::LookupAttr::Impl::Impl
Impl(detail::CPool *pool_r, const SolvAttr &attr_r, Repository repo_r, Location loc_r)
Definition lookupattr.cc:56
zyppng::sat::LookupAttr::Impl::_solv
Solvable _solv
Definition lookupattr.cc:151
zyppng::sat::LookupAttr::Impl::setAttr
void setAttr(SolvAttr attr_r)
Definition lookupattr.cc:67
zyppng::sat::LookupAttr::Impl::end
LookupAttr::iterator end() const
Definition lookupattr.cc:143
zyppng::sat::LookupAttr::Impl::_repo
Repository _repo
Definition lookupattr.cc:150
zyppng::sat::LookupAttr::Impl::pool
bool pool() const
Definition lookupattr.cc:85
zyppng::sat::LookupAttr::Impl::setRepo
void setRepo(Repository repo_r, Location loc_r)
Definition lookupattr.cc:97
zyppng::sat::LookupAttr::Impl::parent
SolvAttr parent() const
Definition lookupattr.cc:118
zyppng::sat::LookupAttr::Impl::solvable
Solvable solvable() const
Definition lookupattr.cc:106
zyppng::sat::LookupAttr::Impl::attr
SolvAttr attr() const
Definition lookupattr.cc:64
zyppng::sat::LookupAttr::Impl::_attr
SolvAttr _attr
Definition lookupattr.cc:148
zyppng::sat::LookupAttr::Impl::setPool
void setPool(Location loc_r)
Definition lookupattr.cc:88
zyppng::sat::LookupAttr::Impl::clone
Impl * clone() const
clone for RWCOW_pointer
Definition lookupattr.cc:157
zyppng::sat::LookupAttr::Impl::setParent
void setParent(SolvAttr attr_r)
Definition lookupattr.cc:121
zyppng::sat::LookupAttr::iterator
Result iterator.
Definition lookupattr.h:350
zyppng::sat::LookupAttr::iterator::nextSkipRepo
void nextSkipRepo()
On the next call to operator++ advance to the next Repository.
Definition lookupattr.cc:336
zyppng::sat::LookupAttr::iterator::operator==
bool operator==(const iterator &rhs) const
Definition lookupattr.cc:729
zyppng::sat::LookupAttr::iterator::dip_equal
bool dip_equal(const detail::CDataiterator &lhs, const detail::CDataiterator &rhs) const
Definition lookupattr.cc:704
zyppng::sat::LookupAttr::iterator::iterator
iterator()
Definition lookupattr.cc:679
zyppng::sat::LookupAttr::iterator::operator=
iterator & operator=(const iterator &rhs)
Definition lookupattr.cc:695
zyppng::sat::LookupAttr::iterator::operator++
iterator & operator++()
Definition lookupattr.cc:716
zyppng::sat::LookupAttr::iterator::stayInThisRepo
void stayInThisRepo()
Stop after all matches in the current Repository are processed.
Definition lookupattr.cc:342
zyppng::sat::LookupAttr::iterator::_dip
detail::DIWrap _dip
Definition lookupattr.h:425
zyppng::sat::LookupAttr::iterator::stayInThisSolvable
void stayInThisSolvable()
Stop after all matches in the current Solvable are processed.
Definition lookupattr.cc:339
zyppng::sat::LookupAttr::iterator::nextSkipSolvable
void nextSkipSolvable()
On the next call to operator++ advance to the next Solvable.
Definition lookupattr.cc:333
zyppng::sat::LookupAttr::iterator::operator*
reference operator*() const
Definition lookupattr.cc:711
zyppng::sat::LookupAttr::iterator::increment
void increment()
Definition lookupattr.cc:735
zyppng::sat::LookupAttr::iterator::~iterator
~iterator()
Definition lookupattr.cc:692
zyppng::sat::LookupAttr::end
iterator end() const
Iterator behind the end of query results.
Definition lookupattr.cc:243
zyppng::sat::LookupAttr::pool
bool pool() const
Whether to search in Pool.
Definition lookupattr.cc:216
zyppng::sat::LookupAttr::begin
iterator begin() const
Iterator to the begin of query results.
Definition lookupattr.cc:240
zyppng::sat::LookupAttr::size_type
unsigned int size_type
Definition lookupattr.h:119
zyppng::sat::LookupAttr::Location
Location
Specify the where to look for the attribule.
Definition lookupattr.h:122
zyppng::sat::LookupAttr::REPO_ATTR
@ REPO_ATTR
Search for repository attributes.
Definition lookupattr.h:124
zyppng::sat::LookupAttr::LookupAttr
LookupAttr()
Default ctor finds nothing.
Definition lookupattr.cc:165
zyppng::sat::LookupAttr::setRepo
void setRepo(Repository repo_r, Location=SOLV_ATTR)
Set search in one Repository.
Definition lookupattr.cc:225
zyppng::sat::LookupAttr::_pimpl
zypp::RWCOW_pointer< Impl > _pimpl
Definition lookupattr.h:238
zyppng::sat::PoolMember::pool
Pool & pool()
Definition poolmember.h:30
zyppng::sat::Pool
Orchestrator for a libsolv pool instance.
Definition pool.h:37
zyppng::sat::Pool::get
detail::CPool * get() const
Expert backdoor.
Definition pool.h:59
zyppng::sat::Repository
Definition repository.h:51
zyppng::sat::Repository::Repository
Repository()
Default ctor creates noRepository.
Definition repository.h:65
zyppng::sat::Repository::noRepository
static const Repository noRepository
Represents no Repository.
Definition repository.h:79
zyppng::sat::Repository::id
IdType id() const
Expert backdoor.
Definition repository.h:327
zyppng::sat::SolvAttr::noAttr
static const SolvAttr noAttr
Value representing noAttr ("").
Definition SolvAttr.h:48
zyppng::sat::SolvAttr::SolvAttr
static const SolvAttr
Definition SolvAttr.h:68
zyppng::sat::SolvAttr::allAttr
static const SolvAttr allAttr
Value to request searching all Attributes (0).
Definition SolvAttr.h:46
zyppng::sat::Solvable
A Solvable object within the sat Pool.
Definition solvable.h:66
zyppng::sat::Solvable::Solvable
Solvable()
Default ctor creates noSolvable.
Definition solvable.h:79
zyppng::sat::Solvable::id
IdType id() const
Expert backdoor.
Definition solvable.h:342
zyppng::sat::Solvable::noSolvable
static const Solvable noSolvable
Represents no Solvable.
Definition solvable.h:95
zyppng::sat::Solvable::repository
detail::RepoIdType repository() const
The repo id this Solvable belongs to.
Definition solvable.cc:273
zyppng::sat::detail::DIWrap
Wrapper around sat detail::CDataiterator.
Definition lookupattr.h:294
zyppng::sat::detail::DIWrap::get
detail::CDataiterator * get() const
Definition lookupattr.h:334
zyppng::sat::detail::DIWrap::pool
detail::CPool * pool() const
Definition lookupattr.h:335
zyppng::sat::detail::DIWrap::DIWrap
DIWrap()
NULL detail::CDataiterator
Definition lookupattr.h:297
zyppng::sat::detail::DIWrap::~DIWrap
~DIWrap()
Definition lookupattr.cc:307
zyppng::sat::detail::DIWrap::_mstring
std::string _mstring
Definition lookupattr.h:341
zyppng::sat::detail::DIWrap::_pool
detail::CPool * _pool
Definition lookupattr.h:340
zyppng::sat::detail::DIWrap::_dip
detail::CDataiterator * _dip
Definition lookupattr.h:339
idstringtype.h
std
Definition ansi.h:855
str
String related utilities and Regular expression matching.
zypp::str::numstring
std::string numstring(char n, int w=0)
Definition String.h:290
zypp::rwcowClone
D * rwcowClone(const D *rhs)
relates: RWCOW_pointer Clone the underlying object.
Definition PtrTypes.h:453
zyppng::sat::detail
CLASS NAME : detail::DIWrap.
Definition cap2str.cc:14
zyppng::sat::detail::CDataiterator
zypp::sat::detail::CDataiterator CDataiterator
Definition poolconstants.h:33
zyppng::sat::detail::RepoIdType
zypp::sat::detail::RepoIdType RepoIdType
Definition poolconstants.h:45
zyppng::sat::detail::CPool
zypp::sat::detail::CPool CPool
Definition poolconstants.h:36
zyppng::sat::detail::SolvableIdType
zypp::sat::detail::SolvableIdType SolvableIdType
Definition poolconstants.h:44
zyppng::sat::detail::IdType
zypp::sat::detail::IdType IdType
Definition poolconstants.h:43
zyppng::sat
This file contains private API, this might break at any time between releases.
Definition capabilities.h:22
pool.h
capability.h
lookupattr.h
zypp::RWCOW_pointer::reset
void reset()
Definition PtrTypes.h:498
CheckSum.h