libzypp 17.37.17
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/base/LogTools.h>
17#include <zypp/base/String.h>
18
20
21#include <zypp/sat/Pool.h>
22#include <zypp/sat/LookupAttr.h>
24
25#include <zypp/CheckSum.h>
26
27using std::endl;
28
30namespace zypp
31{
33 namespace sat
34 {
35
37
39 //
40 // CLASS NAME : LookupAttr::Impl
41 //
43
57 {
58 public:
60 : _parent( SolvAttr::noAttr )
61 {}
62 Impl( const SolvAttr& attr_r, Location loc_r )
63 : _attr( attr_r ), _parent( attr_r.parent() ), _solv( loc_r == REPO_ATTR ? SOLVID_META : noSolvableId )
64 {}
65 Impl( const SolvAttr& attr_r, Repository repo_r, Location loc_r )
66 : _attr( attr_r ), _parent( attr_r.parent() ), _repo( repo_r ), _solv( loc_r == REPO_ATTR ? SOLVID_META : noSolvableId )
67 {}
68 Impl( const SolvAttr& attr_r, Solvable solv_r )
69 : _attr( attr_r ), _parent( attr_r.parent() ), _solv( solv_r )
70 {}
71
72 public:
73 SolvAttr attr() const
74 { return _attr; }
75
76 void setAttr( SolvAttr attr_r )
77 {
78 _attr = std::move(attr_r);
79 SolvAttr p( _attr.parent() );
80 if ( p != SolvAttr::noAttr )
81 _parent = p;
82 }
83
84 const StrMatcher & strMatcher() const
85 { return _strMatcher; }
86
87 void setStrMatcher( const StrMatcher & matcher_r )
88 {
89 matcher_r.compile();
90 _strMatcher = matcher_r;
91 }
92
93 public:
94 bool pool() const
95 { return ! (_repo || _solv); }
96
97 void setPool( Location loc_r )
98 {
100 _solv = Solvable( loc_r == REPO_ATTR ? SOLVID_META : noSolvableId );
101 }
102
104 { return _repo; }
105
106 void setRepo( Repository repo_r, Location loc_r )
107 {
108 _repo = repo_r;
109 _solv = Solvable( loc_r == REPO_ATTR ? SOLVID_META : noSolvableId );
110 }
111
113 { return _solv; }
114
115 void setSolvable( Solvable solv_r )
116 {
118 _solv = solv_r;
119 }
120
122 { return _parent; }
123
124 void setParent( SolvAttr attr_r )
125 { _parent = std::move(attr_r); }
126
127 public:
129 {
130 if ( _attr == SolvAttr::noAttr || sat::Pool::instance().reposEmpty() )
131 return end();
132
133 detail::RepoIdType whichRepo = detail::noRepoId; // all repos
134 if ( _solv )
135 whichRepo = _solv.repository().id();
136 else if ( _repo )
137 whichRepo = _repo.id();
138
139 detail::DIWrap dip( whichRepo, _solv.id(), _attr.id(), _strMatcher.searchstring(), _strMatcher.flags().get() );
140 if ( _parent != SolvAttr::noAttr )
141 ::dataiterator_prepend_keyname( dip.get(), _parent.id() );
142
143 return iterator( dip ); // iterator takes over ownership!
144 }
145
147 { return iterator(); }
148
149 private:
155
156 private:
157 friend Impl * rwcowClone<Impl>( const Impl * rhs );
159 Impl * clone() const
160 { return new Impl( *this ); }
161 };
162
164 //
165 // CLASS NAME : LookupAttr
166 //
168
170 : _pimpl( new Impl )
171 {}
172
174 : _pimpl( new Impl( std::move(attr_r), std::move(loc_r) ) )
175 {}
177 : _pimpl( new Impl( std::move(attr_r), std::move(loc_r) ) )
178 { _pimpl->setParent( std::move(parent_r) ); }
179
181 : _pimpl( new Impl( std::move(attr_r), std::move(repo_r), std::move(loc_r) ) )
182 {}
183 LookupAttr::LookupAttr( SolvAttr attr_r, SolvAttr parent_r, Repository repo_r, Location loc_r )
184 : _pimpl( new Impl( std::move(attr_r), std::move(repo_r), std::move(loc_r) ) )
185 { _pimpl->setParent( std::move(parent_r) ); }
186
188 : _pimpl( new Impl( std::move(attr_r), std::move(solv_r) ) )
189 {}
191 : _pimpl( new Impl( std::move(attr_r), std::move(solv_r) ) )
192 { _pimpl->setParent( std::move(parent_r) ); }
193
194
196
198 { return _pimpl->attr(); }
199
201 { _pimpl->setAttr( std::move(attr_r) ); }
202
204 { return _pimpl->strMatcher(); }
205
206 void LookupAttr::setStrMatcher( const StrMatcher & matcher_r )
207 { _pimpl->setStrMatcher( matcher_r ); }
208
210
211 bool LookupAttr::pool() const
212 { return _pimpl->pool(); }
213
215 { _pimpl->setPool( loc_r ); }
216
218 { return _pimpl->repo(); }
219
221 { _pimpl->setRepo( repo_r, loc_r ); }
222
224 { return _pimpl->solvable(); }
225
227 { _pimpl->setSolvable( solv_r ); }
228
230 { return _pimpl->parent(); }
231
233 { _pimpl->setParent( std::move(attr_r) ); }
234
236
238 { return _pimpl->begin(); }
239
241 { return _pimpl->end(); }
242
243 bool LookupAttr::empty() const
244 { return begin() == end(); }
245
247 {
248 size_type c = 0;
249 for_( it, begin(), end() )
250 ++c;
251 return c;
252 }
253
255
256 std::ostream & operator<<( std::ostream & str, const LookupAttr & obj )
257 {
258 if ( obj.attr() == SolvAttr::noAttr )
259 return str << "search nothing";
260
261 if ( obj.attr() )
262 str << "search " << obj.attr() << " in ";
263 else
264 str << "search ALL in ";
265
266 if ( obj.solvable() )
267 return str << obj.solvable();
268 if ( obj.repo() )
269 return str << obj.repo();
270 return str << "pool";
271 }
272
273 std::ostream & dumpOn( std::ostream & str, const LookupAttr & obj )
274 {
275 return dumpRange( str << obj, obj.begin(), obj.end() );
276 }
277
279 //
280 // CLASS NAME : LookupRepoAttr
281 //
283
285 : LookupAttr( std::move(attr_r), repo_r, REPO_ATTR )
286 {}
287
290
292 //
293 // CLASS NAME : detail::DIWrap
294 //
296
297 namespace detail
298 {
299 DIWrap::DIWrap( RepoIdType repoId_r, SolvableIdType solvId_r, IdType attrId_r,
300 std::string mstring_r, int flags_r )
301 : _dip( new ::Dataiterator )
302 , _mstring(std::move( mstring_r ))
303 {
304 ::dataiterator_init( _dip, sat::Pool::instance().get(), repoId_r, solvId_r, attrId_r,
305 _mstring.empty() ? 0 : _mstring.c_str(), flags_r );
306 }
307
308 DIWrap::DIWrap( RepoIdType repoId_r, SolvableIdType solvId_r, IdType attrId_r,
309 const char * mstring_r, int flags_r )
310 : _dip( new ::Dataiterator )
311 , _mstring( mstring_r ? mstring_r : "" )
312 {
313 ::dataiterator_init( _dip, sat::Pool::instance().get(), repoId_r, solvId_r, attrId_r,
314 _mstring.empty() ? 0 : _mstring.c_str(), flags_r );
315 }
316
317 DIWrap::DIWrap( const DIWrap & rhs )
318 : _dip( 0 )
319 , _mstring( rhs._mstring )
320 {
321 if ( rhs._dip )
322 {
323 _dip = new ::Dataiterator;
324 ::dataiterator_init_clone( _dip, rhs._dip );
325 ::dataiterator_strdup( _dip );
326 }
327 }
328
330 {
331 if ( _dip )
332 {
333 ::dataiterator_free( _dip );
334 delete _dip;
335 }
336 }
337
338 std::ostream & operator<<( std::ostream & str, const DIWrap & obj )
339 { return str << obj.get(); }
340 }
341
343 //
344 // CLASS NAME : LookupAttr::iterator
345 //
347
349 // position and moving
351
354
357
360
362 { if ( _dip ) ::dataiterator_skip_attribute( _dip.get() ); }
363
365 { if ( _dip ) ::dataiterator_skip_solvable( _dip.get() ); }
366
368 { if ( _dip ) ::dataiterator_skip_repo( _dip.get() ); }
369
371 { if ( _dip ) { _dip.get()->repoid = -1; _dip.get()->flags |= SEARCH_THISSOLVID; } }
372
374 { if ( _dip ) { _dip.get()->repoid = -1; } }
375
377 // attr value type test
379
382
384 {
385 switch ( solvAttrType() )
386 {
387 case REPOKEY_TYPE_NUM:
388 case REPOKEY_TYPE_CONSTANT:
389 return true;
390 break;
391 }
392 return false;
393 }
394
396 {
397 switch ( solvAttrType() )
398 {
399 case REPOKEY_TYPE_ID:
400 case REPOKEY_TYPE_IDARRAY:
401 case REPOKEY_TYPE_CONSTANTID:
402 case REPOKEY_TYPE_STR:
403 case REPOKEY_TYPE_DIRSTRARRAY:
404 return true;
405 break;
406 }
407 return false;
408 }
409
411 {
412 switch ( solvAttrType() )
413 {
414 case REPOKEY_TYPE_ID:
415 case REPOKEY_TYPE_IDARRAY:
416 case REPOKEY_TYPE_CONSTANTID:
417 return true;
418 break;
419 }
420 return false;
421 }
422
424 {
425 switch ( solvAttrType() )
426 {
427 case REPOKEY_TYPE_MD5:
428 case REPOKEY_TYPE_SHA1:
429 case REPOKEY_TYPE_SHA256:
430 return true;
431 break;
432 }
433 return false;
434 }
435
437 namespace
438 {
439 enum SubType { ST_NONE, // no sub-structure
440 ST_FLEX, // flexarray
441 ST_SUB }; // inside sub-structure
442 SubType subType( const detail::DIWrap & dip )
443 {
444 if ( ! dip )
445 return ST_NONE;
446 if ( dip.get()->key->type == REPOKEY_TYPE_FLEXARRAY )
447 return ST_FLEX;
448 return dip.get()->kv.parent ? ST_SUB : ST_NONE;
449 }
450 }
452
454 { return subType( _dip ) != ST_NONE; }
455
457 // Iterate sub-structures.
459
461 { return( subBegin() == subEnd() ); }
462
464 {
465 size_type c = 0;
466 for_( it, subBegin(), subEnd() )
467 ++c;
468 return c;
469 }
470
472 {
473 SubType subtype( subType( _dip ) );
474 if ( subtype == ST_NONE )
475 return subEnd();
476 // setup the new sub iterator with the remembered position
477 detail::DIWrap dip( 0, 0, 0 );
478 ::dataiterator_clonepos( dip.get(), _dip.get() );
479 switch ( subtype )
480 {
481 case ST_NONE: // not reached
482 break;
483 case ST_FLEX:
484 ::dataiterator_seek( dip.get(), DI_SEEK_CHILD|DI_SEEK_STAY );
485 break;
486 case ST_SUB:
487 ::dataiterator_seek( dip.get(), DI_SEEK_REWIND|DI_SEEK_STAY );
488 break;
489 }
490 return iterator( dip ); // iterator takes over ownership!
491 }
492
497
499 {
500 iterator it = subBegin();
501 if ( attr_r != sat::SolvAttr::allAttr )
502 {
503 while ( it != subEnd() && it.inSolvAttr() != attr_r )
504 ++it;
505 }
506 return it;
507 }
508
510 {
511 if ( attrname_r.empty() )
512 return subBegin();
513
514 SubType subtype( subType( _dip ) );
515 if ( subtype == ST_NONE )
516 return subBegin();
517
518 std::string subattr( inSolvAttr().asString() );
519 if ( subtype == ST_FLEX )
520 {
521 // append ":attrname"
522 subattr += ":";
523 subattr += attrname_r;
524 }
525 else
526 {
527 // replace "oldname" after ':' with "attrname"
528 std::string::size_type pos( subattr.rfind( ':' ) );
529 if ( pos != std::string::npos )
530 {
531 subattr.erase( pos+1 );
532 subattr += attrname_r;
533 }
534 else
535 subattr = attrname_r; // no ':' so replace all.
536 }
537 return subFind( SolvAttr( subattr ) );
538 }
539
541 // attr value retrieval
543
545 {
546 if ( _dip )
547 {
548 switch ( solvAttrType() )
549 {
550 case REPOKEY_TYPE_NUM:
551 case REPOKEY_TYPE_CONSTANT:
552 return _dip->kv.num;
553 break;
554 }
555 }
556 return 0;
557 }
558
560 { return asInt(); }
561
562 unsigned long long LookupAttr::iterator::asUnsignedLL() const
563 {
564 if ( _dip )
565 {
566 switch ( solvAttrType() )
567 {
568 case REPOKEY_TYPE_NUM:
569 case REPOKEY_TYPE_CONSTANT:
570 return SOLV_KV_NUM64(&_dip->kv);
571 break;
572 }
573 }
574 return 0;
575 }
576
578 { return asInt(); }
579
580
581 const char * LookupAttr::iterator::c_str() const
582 {
583 if ( _dip )
584 {
585 switch ( solvAttrType() )
586 {
587 case REPOKEY_TYPE_ID:
588 case REPOKEY_TYPE_IDARRAY:
589 case REPOKEY_TYPE_CONSTANTID:
590 if ( _dip->data && _dip->data->localpool )
591 return ::stringpool_id2str( &_dip->data->spool, _dip->kv.id ); // in local pool
592 else
593 return IdString( _dip->kv.id ).c_str(); // in global pool
594 break;
595
596 case REPOKEY_TYPE_STR:
597 return _dip->kv.str;
598 break;
599
600 case REPOKEY_TYPE_DIRSTRARRAY:
601 // may or may not be stringified depending on SEARCH_FILES flag
602 return( _dip->flags & SEARCH_FILES
603 ? _dip->kv.str
604 : ::repodata_dir2str( _dip->data, _dip->kv.id, _dip->kv.str ) );
605 break;
606 }
607 }
608 return 0;
609 }
610
612 {
613 if ( _dip )
614 {
615 switch ( solvAttrType() )
616 {
617 case REPOKEY_TYPE_ID:
618 case REPOKEY_TYPE_IDARRAY:
619 case REPOKEY_TYPE_CONSTANTID:
620 {
621 detail::IdType id = ::repodata_globalize_id( _dip->data, _dip->kv.id, 1 );
622 return ISRELDEP(id) ? Capability( id ).asString()
623 : IdString( id ).asString();
624 }
625 break;
626
627 case REPOKEY_TYPE_STR:
628 case REPOKEY_TYPE_DIRSTRARRAY:
629 {
630 const char * ret( c_str() );
631 return ret ? ret : "";
632 }
633 break;
634
635 case REPOKEY_TYPE_NUM:
636 case REPOKEY_TYPE_CONSTANT:
637 return str::numstring( asInt() );
638 break;
639
640 case REPOKEY_TYPE_MD5:
641 case REPOKEY_TYPE_SHA1:
642 case REPOKEY_TYPE_SHA256:
643 {
644 return asCheckSum().asString();
645 }
646 break;
647
648 case REPOKEY_TYPE_FLEXARRAY:
649 {
650 std::ostringstream str;
651 str << "{" << endl;
652 for_( it, subBegin(), subEnd() )
653 {
654 str << " " << it.inSolvAttr() << " = " << it.asString() << endl;
655 }
656 str << "}";
657 return str.str();
658 }
659 break;
660 }
661 }
662 return std::string();
663 }
664
666 {
667 if ( _dip )
668 {
669 switch ( solvAttrType() )
670 {
671 case REPOKEY_TYPE_ID:
672 case REPOKEY_TYPE_IDARRAY:
673 case REPOKEY_TYPE_CONSTANTID:
674 return IdString( ::repodata_globalize_id( _dip->data, _dip->kv.id, 1 ) );
675 break;
676 }
677 }
678 return IdString();
679 }
680
682 {
683 if ( _dip )
684 {
685 switch ( solvAttrType() )
686 {
687 case REPOKEY_TYPE_MD5:
688 return CheckSum::md5( ::repodata_chk2str( _dip->data, solvAttrType(), (unsigned char *)_dip->kv.str ) );
689 break;
690
691 case REPOKEY_TYPE_SHA1:
692 return CheckSum::sha1( ::repodata_chk2str( _dip->data, solvAttrType(), (unsigned char *)_dip->kv.str ) );
693 break;
694
695 case REPOKEY_TYPE_SHA224:
696 return CheckSum::sha224( ::repodata_chk2str( _dip->data, solvAttrType(), (unsigned char *)_dip->kv.str ) );
697 break;
698
699 case REPOKEY_TYPE_SHA256:
700 return CheckSum::sha256( ::repodata_chk2str( _dip->data, solvAttrType(), (unsigned char *)_dip->kv.str ) );
701 break;
702
703 case REPOKEY_TYPE_SHA384:
704 return CheckSum::sha384( ::repodata_chk2str( _dip->data, solvAttrType(), (unsigned char *)_dip->kv.str ) );
705 break;
706
707 case REPOKEY_TYPE_SHA512:
708 return CheckSum::sha512( ::repodata_chk2str( _dip->data, solvAttrType(), (unsigned char *)_dip->kv.str ) );
709 break;
710 }
711 }
712 return CheckSum();
713 }
714
716 // internal stuff below
718
720 : iterator_adaptor_( 0 )
721 {}
722
724 : iterator_adaptor_( 0 )
725 , _dip( rhs._dip )
726 {
727 base_reference() = _dip.get();
728 }
729
731 : iterator_adaptor_( 0 )
732 {
733 _dip.swap( dip_r ); // take ownership!
734 base_reference() = _dip.get();
735 increment();
736 }
737
740
742 {
743 if ( &rhs != this )
744 {
745 _dip = rhs._dip;
746 base_reference() = _dip.get();
747 }
748 return *this;
749 }
750
752
754 {
755 // Iterator equal is same position in same container.
756 // Here: same attribute in same solvable.
757 return( lhs.solvid == rhs.solvid && lhs.key->name == rhs.key->name );
758 }
759
761 {
762 return _dip ? ::repodata_globalize_id( _dip->data, _dip->kv.id, 1 )
763 : detail::noId;
764 }
765
767 {
768 if ( _dip )
769 {
770 if ( ! ::dataiterator_step( _dip.get() ) )
771 {
772 _dip.reset();
773 base_reference() = 0;
774 }
775 else
776 {
777 ::dataiterator_strdup( _dip.get() );
778 }
779 }
780 }
781
782 std::ostream & operator<<( std::ostream & str, const LookupAttr::iterator & obj )
783 {
784 const detail::CDataiterator * dip = obj.get();
785 if ( ! dip )
786 return str << "EndOfQuery";
787
788 if ( obj.inSolvable() )
789 str << obj.inSolvable();
790 else if ( obj.inRepo() )
791 str << obj.inRepo();
792
793 str << '<' << obj.inSolvAttr() << (obj.solvAttrSubEntry() ? ">(*" : ">(")
794 << IdString(obj.solvAttrType()) << ") = " << obj.asString();
795 return str;
796 }
797
799 { return asCheckSum(); }
800
802 } // namespace sat
805} // namespace zypp
807
808std::ostream & operator<<( std::ostream & str, const zypp::sat::detail::CDataiterator * obj )
809{
810 str << "detail::CDataiterator(";
811 if ( ! obj )
812 {
813 str << "NULL";
814 }
815 else
816 {
817 str << "|" << zypp::Repository(obj->repo);
818 str << "|" << zypp::sat::Solvable(obj->solvid);
819 str << "|" << zypp::IdString(obj->key->name);
820 str << "|" << zypp::IdString(obj->key->type);
821 str << "|" << obj->repodataid;
822 str << "|" << obj->repoid;
823 }
824 return str << ")";
825}
826
Convenience char* constructible from std::string and char*, it maps (char*)0 to an empty string.
Definition String.h:92
bool empty() const
Definition String.h:108
A sat capability.
Definition Capability.h:63
std::string asString() const
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition Capability.h:168
static CheckSum md5(const std::string &checksum)
Definition CheckSum.h:73
static CheckSum sha384(const std::string &checksum)
Definition CheckSum.h:78
static CheckSum sha1(const std::string &checksum)
Definition CheckSum.h:75
static CheckSum sha512(const std::string &checksum)
Definition CheckSum.h:79
static CheckSum sha256(const std::string &checksum)
Definition CheckSum.h:77
static CheckSum sha224(const std::string &checksum)
Definition CheckSum.h:76
Access to the sat-pools string space.
Definition IdString.h:44
const char * c_str() const
Conversion to const char *
Definition IdString.cc:50
std::string asString() const
Conversion to std::string
Definition IdString.h:99
static const Repository noRepository
Represents no Repository.
Definition Repository.h:67
String matching (STRING|SUBSTRING|GLOB|REGEX).
Definition StrMatcher.h:298
void compile() const
Compile the pattern e.g.
LookupAttr implememtation.
Definition LookupAttr.cc:57
void setSolvable(Solvable solv_r)
void setStrMatcher(const StrMatcher &matcher_r)
Definition LookupAttr.cc:87
void setParent(SolvAttr attr_r)
Solvable solvable() const
LookupAttr::iterator end() const
const StrMatcher & strMatcher() const
Definition LookupAttr.cc:84
void setPool(Location loc_r)
Definition LookupAttr.cc:97
Impl * clone() const
clone for RWCOW_pointer
Impl(const SolvAttr &attr_r, Location loc_r)
Definition LookupAttr.cc:62
friend Impl * rwcowClone(const Impl *rhs)
LookupAttr::iterator begin() const
Impl(const SolvAttr &attr_r, Repository repo_r, Location loc_r)
Definition LookupAttr.cc:65
Repository repo() const
Impl(const SolvAttr &attr_r, Solvable solv_r)
Definition LookupAttr.cc:68
void setRepo(Repository repo_r, Location loc_r)
void setAttr(SolvAttr attr_r)
Definition LookupAttr.cc:76
detail::CDataiterator * get() const
Expert backdoor.
Definition LookupAttr.h:575
iterator subBegin() const
Iterator to the begin of a sub-structure.
unsigned long long asUnsignedLL() const
This is an overloaded member function, provided for convenience. It differs from the above function o...
unsigned asUnsigned() const
This is an overloaded member function, provided for convenience. It differs from the above function o...
void stayInThisSolvable()
Stop after all matches in the current Solvable are processed.
Tp asType() const
Templated return type.
Definition LookupAttr.h:535
IdString idStr() const
As IdStr.
detail::IdType dereference() const
void nextSkipSolvable()
On the next call to operator++ advance to the next Solvable.
SolvAttr inSolvAttr() const
The current SolvAttr.
bool subEmpty() const
Whether the sub-structure is empty.
CheckSum asCheckSum() const
As CheckSum.
bool solvAttrCheckSum() const
Whether this is a CheckSum attribute.
std::string asString() const
This is an overloaded member function, provided for convenience. It differs from the above function o...
void nextSkipSolvAttr()
On the next call to operator++ advance to the next SolvAttr.
bool asBool() const
This is an overloaded member function, provided for convenience. It differs from the above function o...
iterator subEnd() const
Iterator behind the end of a sub-structure.
void stayInThisRepo()
Stop after all matches in the current Repository are processed.
bool solvAttrSubEntry() const
Whether this is the entry to a sub-structure (flexarray).
iterator subFind(const SolvAttr &attr_r) const
Iterator pointing to the first occurance of SolvAttr attr_r in sub-structure.
Solvable inSolvable() const
The current Solvable.
void nextSkipRepo()
On the next call to operator++ advance to the next Repository.
const char * c_str() const
Conversion to string types.
size_type subSize() const
Ammount of attributes in the sub-structure.
iterator & operator=(const iterator &rhs)
bool solvAttrNumeric() const
Whether this is a numeric attribute (incl.
bool solvAttrIdString() const
Whether this string attribute is available as IdString.
bool dip_equal(const detail::CDataiterator &lhs, const detail::CDataiterator &rhs) const
bool solvAttrString() const
Whether this is a string attribute.
detail::IdType solvAttrType() const
The current SolvAttr type.
int asInt() const
Conversion to numeric types.
Repository inRepo() const
The current Repository.
iterator end() const
Iterator behind the end of query results.
RWCOW_pointer< Impl > _pimpl
Definition LookupAttr.h:234
const StrMatcher & strMatcher() const
The pattern to match.
bool empty() const
Whether the query is empty.
unsigned int size_type
Definition LookupAttr.h:115
Location
Specify the where to look for the attribule.
Definition LookupAttr.h:118
@ REPO_ATTR
Search for repository attributes.
Definition LookupAttr.h:120
void setStrMatcher(const StrMatcher &matcher_r)
Set the pattern to match.
Repository repo() const
Whether to search in one Repository.
SolvAttr attr() const
The SolvAttr to search.
SolvAttr parent() const
Whether to search within a sub-structure (SolvAttr::noAttr if not)
void setAttr(SolvAttr attr_r)
Set the SolvAttr to search.
void setRepo(Repository repo_r, Location=SOLV_ATTR)
Set search in one Repository.
bool pool() const
Whether to search in Pool.
size_type size() const
Ammount of results.
iterator begin() const
Iterator to the begin of query results.
void setSolvable(Solvable solv_r)
Set search in one Solvable.
Solvable solvable() const
Whether to search in one Solvable.
std::ostream & operator<<(std::ostream &str, const LookupAttr &obj) ZYPP_API
Stream output.
LookupAttr()
Default ctor finds nothing.
void setPool(Location=SOLV_ATTR)
Set search in Pool (all repositories).
void setParent(SolvAttr attr_r)
Set search within a sub-structure (SolvAttr::noAttr for none)
void setRepo(Repository repo_r)
Set search in one Repository.
LookupRepoAttr()
Default ctor finds nothing.
Definition LookupAttr.h:268
static Pool instance()
Singleton ctor.
Definition Pool.h:55
Solvable attribute keys.
Definition SolvAttr.h:41
static const SolvAttr noAttr
Value representing noAttr ("")
Definition SolvAttr.h:48
static const SolvAttr allAttr
Value to request searching all Attributes (0).
Definition SolvAttr.h:46
A Solvable object within the sat Pool.
Definition Solvable.h:54
static const Solvable noSolvable
Represents no Solvable.
Definition Solvable.h:80
Wrapper around sat detail::CDataiterator.
Definition LookupAttr.h:300
detail::CDataiterator * get() const
Definition LookupAttr.h:338
DIWrap()
NULL detail::CDataiterator
Definition LookupAttr.h:303
detail::CDataiterator * _dip
Definition LookupAttr.h:342
Definition Arch.h:364
String related utilities and Regular expression matching.
unsigned int SolvableIdType
Id type to connect Solvable and sat-solvable.
Definition PoolMember.h:125
static const IdType noId(0)
static const SolvableIdType noSolvableId(0)
Id to denote Solvable::noSolvable.
int IdType
Generic Id type.
Definition PoolMember.h:104
static const RepoIdType noRepoId(0)
Id to denote Repo::noRepository.
::s_Dataiterator CDataiterator
Wrapped libsolv C data type exposed as backdoor.
Definition PoolMember.h:58
std::ostream & operator<<(std::ostream &str, const DIWrap &obj)
CRepo * RepoIdType
Id type to connect Repo and sat-repo.
Definition PoolMember.h:133
Libsolv interface
std::ostream & operator<<(std::ostream &str, const FileConflicts &obj)
static const SolvableIdType noSolvableId(0)
Id to denote Solvable::noSolvable.
std::ostream & dumpOn(std::ostream &str, const LocaleSupport &obj)
std::string numstring(char n, int w=0)
Definition String.h:290
Easy-to use interface to the ZYPP dependency resolver.
std::ostream & dumpRange(std::ostream &str, TIterator begin, TIterator end, const std::string &intro="{", const std::string &pfx="\n ", const std::string &sep="\n ", const std::string &sfx="\n", const std::string &extro="}")
Print range defined by iterators (multiline style).
Definition LogTools.h:120
std::ostream & operator<<(std::ostream &str, const SerialNumber &obj)
std::string asString(const Patch::Category &obj)
Definition Patch.cc:122
#define for_(IT, BEG, END)
Convenient for-loops using iterator.
Definition Easy.h:27