libzypp  17.38.7
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 
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 
27 using std::endl;
28 
29 namespace zyppng::sat
30 {
32 
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  {
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 
107  { return _solv; }
108 
109  void setSolvable( Solvable solv_r )
110  {
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:
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 
144  { return iterator(); }
145 
146  private:
148  SolvAttr _attr;
149  SolvAttr _parent;
153 
154  private:
155  friend Impl * zypp::rwcowClone<Impl>( const Impl * rhs );
157  Impl * clone() const
158  { return new Impl( *this ); }
159  };
160 
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 
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 
220  { _pimpl->setPool( loc_r ); }
221 
223  { return _pimpl->repo(); }
224 
226  { _pimpl->setRepo( repo_r, loc_r ); }
227 
229  { return _pimpl->solvable(); }
230 
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 
241  { return _pimpl->begin(); }
242 
244  { return _pimpl->end(); }
245 
246  bool LookupAttr::empty() const
247  { return begin() == end(); }
248 
250  {
251  size_type c = 0;
252  for ( auto it = begin(); it != end(); ++it )
253  ++c;
254  return c;
255  }
256 
261  LookupRepoAttr::LookupRepoAttr( SolvAttr attr_r, Repository repo_r )
262  : LookupAttr( std::move(attr_r), repo_r, REPO_ATTR )
263  {}
264 
266  { LookupAttr::setRepo( repo_r, REPO_ATTR ); }
267 
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 
308  {
309  if ( _dip )
310  {
311  ::dataiterator_free( _dip );
312  delete _dip;
313  }
314  }
315  }
316 
322  { return _dip ? Repository( _dip->repo ) : Repository::noRepository; }
323 
325  { return _dip ? Solvable( _dip->solvid ) : Solvable::noSolvable; }
326 
328  { return _dip ? SolvAttr( _dip->key->name ) : SolvAttr::noAttr; }
329 
331  { if ( _dip ) ::dataiterator_skip_attribute( _dip.get() ); }
332 
334  { if ( _dip ) ::dataiterator_skip_solvable( _dip.get() ); }
335 
337  { if ( _dip ) ::dataiterator_skip_repo( _dip.get() ); }
338 
340  { if ( _dip ) { _dip.get()->repoid = -1; _dip.get()->flags |= SEARCH_THISSOLVID; } }
341 
343  { if ( _dip ) { _dip.get()->repoid = -1; } }
344 
346  { return _dip ? _dip->key->type : detail::noId; }
347 
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 
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 
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 
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  }
414  }
415 
417  { return subType( _dip ) != ST_NONE; }
418 
420  { return( subBegin() == subEnd() ); }
421 
423  {
424  size_type c = 0;
425  for ( auto it = subBegin(); it != subEnd(); ++it )
426  ++c;
427  return c;
428  }
429 
431  {
432  SubType subtype( subType( _dip ) );
433  if ( subtype == ST_NONE )
434  return subEnd();
435  // setup the new sub iterator with the remembered position
436  detail::DIWrap dip( _dip.pool(), 0, 0, 0 );
437  ::dataiterator_clonepos( dip.get(), _dip.get() );
438  switch ( subtype )
439  {
440  case ST_NONE: // not reached
441  break;
442  case ST_FLEX:
443  ::dataiterator_seek( dip.get(), DI_SEEK_CHILD|DI_SEEK_STAY );
444  break;
445  case ST_SUB:
446  ::dataiterator_seek( dip.get(), DI_SEEK_REWIND|DI_SEEK_STAY );
447  break;
448  }
449  return iterator( dip ); // iterator takes over ownership!
450  }
451 
453  {
454  return iterator();
455  }
456 
457  LookupAttr::iterator LookupAttr::iterator::subFind( const SolvAttr& attr_r ) const
458  {
459  iterator it = subBegin();
460  if ( attr_r != SolvAttr::allAttr )
461  {
462  while ( it != subEnd() && it.inSolvAttr() != attr_r )
463  ++it;
464  }
465  return it;
466  }
467 
469  {
470  if ( attrname_r.empty() )
471  return subBegin();
472 
473  SubType subtype( subType( _dip ) );
474  if ( subtype == ST_NONE )
475  return subBegin();
476 
477  std::string subattr( inSolvAttr().asString() );
478  if ( subtype == ST_FLEX )
479  {
480  // append ":attrname"
481  subattr += ":";
482  subattr += attrname_r;
483  }
484  else
485  {
486  // replace "oldname" after ':' with "attrname"
487  std::string::size_type pos( subattr.rfind( ':' ) );
488  if ( pos != std::string::npos )
489  {
490  subattr.erase( pos+1 );
491  subattr += attrname_r;
492  }
493  else
494  subattr = attrname_r; // no ':' so replace all.
495  }
496  return subFind( SolvAttr( subattr ) );
497  }
498 
500  {
501  if ( _dip )
502  {
503  switch ( solvAttrType() )
504  {
505  case REPOKEY_TYPE_NUM:
506  case REPOKEY_TYPE_CONSTANT:
507  return _dip->kv.num;
508  break;
509  }
510  }
511  return 0;
512  }
513 
515  { return asInt(); }
516 
517  unsigned long long LookupAttr::iterator::asUnsignedLL() const
518  {
519  if ( _dip )
520  {
521  switch ( solvAttrType() )
522  {
523  case REPOKEY_TYPE_NUM:
524  case REPOKEY_TYPE_CONSTANT:
525  return SOLV_KV_NUM64(&_dip->kv);
526  break;
527  }
528  }
529  return 0;
530  }
531 
533  { return asInt(); }
534 
535 
536  const char * LookupAttr::iterator::c_str() const
537  {
538  if ( _dip )
539  {
540  switch ( solvAttrType() )
541  {
542  case REPOKEY_TYPE_ID:
543  case REPOKEY_TYPE_IDARRAY:
544  case REPOKEY_TYPE_CONSTANTID:
545  if ( _dip->data && _dip->data->localpool )
546  return ::stringpool_id2str( &_dip->data->spool, _dip->kv.id ); // in local pool
547  else
548  return IdString( _dip->kv.id ).c_str(); // in global pool
549  break;
550 
551  case REPOKEY_TYPE_STR:
552  return _dip->kv.str;
553  break;
554 
555  case REPOKEY_TYPE_DIRSTRARRAY:
556  // may or may not be stringified depending on SEARCH_FILES flag
557  return( _dip->flags & SEARCH_FILES
558  ? _dip->kv.str
559  : ::repodata_dir2str( _dip->data, _dip->kv.id, _dip->kv.str ) );
560  break;
561  }
562  }
563  return 0;
564  }
565 
566  std::string LookupAttr::iterator::asString() const
567  {
568  if ( _dip )
569  {
570  switch ( solvAttrType() )
571  {
572  case REPOKEY_TYPE_ID:
573  case REPOKEY_TYPE_IDARRAY:
574  case REPOKEY_TYPE_CONSTANTID:
575  {
576  detail::IdType id = ::repodata_globalize_id( _dip->data, _dip->kv.id, 1 );
577  return ISRELDEP(id) ? Capability( id ).asString()
578  : IdString( id ).asString();
579  }
580  break;
581 
582  case REPOKEY_TYPE_STR:
583  case REPOKEY_TYPE_DIRSTRARRAY:
584  {
585  const char * ret( c_str() );
586  return ret ? ret : "";
587  }
588  break;
589 
590  case REPOKEY_TYPE_NUM:
591  case REPOKEY_TYPE_CONSTANT:
592  return zypp::str::numstring( asInt() );
593  break;
594 
595  case REPOKEY_TYPE_MD5:
596  case REPOKEY_TYPE_SHA1:
597  case REPOKEY_TYPE_SHA256:
598  {
599  return asCheckSum().asString();
600  }
601  break;
602 
603  case REPOKEY_TYPE_FLEXARRAY:
604  {
605  std::ostringstream str;
606  str << "{" << endl;
607  for ( auto it = subBegin(); it != subEnd(); ++it )
608  {
609  str << " " << it.inSolvAttr() << " = " << it.asString() << endl;
610  }
611  str << "}";
612  return str.str();
613  }
614  break;
615  }
616  }
617  return std::string();
618  }
619 
621  {
622  if ( _dip )
623  {
624  switch ( solvAttrType() )
625  {
626  case REPOKEY_TYPE_ID:
627  case REPOKEY_TYPE_IDARRAY:
628  case REPOKEY_TYPE_CONSTANTID:
629  return IdString( ::repodata_globalize_id( _dip->data, _dip->kv.id, 1 ) );
630  break;
631  }
632  }
633  return IdString();
634  }
635 
637  {
638  if ( _dip )
639  {
640  switch ( solvAttrType() )
641  {
642  case REPOKEY_TYPE_MD5:
643  return CheckSum::md5( ::repodata_chk2str( _dip->data, solvAttrType(), (unsigned char *)_dip->kv.str ) );
644  break;
645 
646  case REPOKEY_TYPE_SHA1:
647  return CheckSum::sha1( ::repodata_chk2str( _dip->data, solvAttrType(), (unsigned char *)_dip->kv.str ) );
648  break;
649 
650  case REPOKEY_TYPE_SHA224:
651  return CheckSum::sha224( ::repodata_chk2str( _dip->data, solvAttrType(), (unsigned char *)_dip->kv.str ) );
652  break;
653 
654  case REPOKEY_TYPE_SHA256:
655  return CheckSum::sha256( ::repodata_chk2str( _dip->data, solvAttrType(), (unsigned char *)_dip->kv.str ) );
656  break;
657 
658  case REPOKEY_TYPE_SHA384:
659  return CheckSum::sha384( ::repodata_chk2str( _dip->data, solvAttrType(), (unsigned char *)_dip->kv.str ) );
660  break;
661 
662  case REPOKEY_TYPE_SHA512:
663  return CheckSum::sha512( ::repodata_chk2str( _dip->data, solvAttrType(), (unsigned char *)_dip->kv.str ) );
664  break;
665  }
666  }
667  return CheckSum();
668  }
669 
671  {}
672 
674  : _dip( rhs._dip )
675  {}
676 
678  {
679  _dip.swap( dip_r ); // take ownership!
680  increment();
681  }
682 
684  {}
685 
687  {
688  if ( &rhs != this )
689  {
690  _dip = rhs._dip;
691  }
692  return *this;
693  }
694 
696  {
697  // Iterator equal is same position in same container.
698  // Here: same attribute in same solvable.
699  return( lhs.solvid == rhs.solvid && lhs.key->name == rhs.key->name );
700  }
701 
703  {
704  return _dip ? ::repodata_globalize_id( _dip->data, _dip->kv.id, 1 )
705  : detail::noId;
706  }
707 
709  {
710  increment();
711  return *this;
712  }
713 
715  {
716  iterator tmp = *this;
717  increment();
718  return tmp;
719  }
720 
721  bool LookupAttr::iterator::operator==( const iterator & rhs ) const
722  {
723  return ( bool(_dip) == bool(rhs._dip) )
724  && ( ! _dip || dip_equal( *_dip.get(), *rhs._dip.get() ) );
725  }
726 
728  {
729  if ( _dip )
730  {
731  if ( ! ::dataiterator_step( _dip.get() ) )
732  {
733  _dip.reset();
734  }
735  else
736  {
737  ::dataiterator_strdup( _dip.get() );
738  }
739  }
740  }
741 
742  template<> CheckSum LookupAttr::iterator::asType<CheckSum>() const
743  { return asCheckSum(); }
744 
745 } // namespace zyppng::sat
static const SolvableIdType noSolvableId(0)
Id to denote Solvable::noSolvable.
void setStrMatcher(const StrMatcher &matcher_r)
Definition: lookupattr.cc:78
const StrMatcher & strMatcher() const
The pattern to match.
Definition: lookupattr.cc:210
int asInt() const
Conversion to numeric types.
Definition: lookupattr.cc:499
void setAttr(SolvAttr attr_r)
Definition: lookupattr.cc:67
Impl(detail::CPool *pool_r, const SolvAttr &attr_r, Location loc_r)
Definition: lookupattr.cc:53
A Solvable object within the sat Pool.
Definition: solvable.h:64
iterator subEnd() const
Iterator behind the end of a sub-structure.
Definition: lookupattr.cc:452
Impl * clone() const
clone for RWCOW_pointer
Definition: lookupattr.cc:157
iterator subFind(const SolvAttr &attr_r) const
Iterator pointing to the first occurance of SolvAttr attr_r in sub-structure.
Definition: lookupattr.cc:457
std::string asString(const Patch::Category &obj)
relates: Patch::Category string representation.
Definition: Patch.cc:122
DIWrap()
NULL detail::CDataiterator
Definition: lookupattr.h:295
String matching (STRING|SUBSTRING|GLOB|REGEX).
Definition: StrMatcher.h:297
void setSolvable(Solvable solv_r)
Set search in one Solvable.
Definition: lookupattr.cc:231
void nextSkipSolvable()
On the next call to operator++ advance to the next Solvable.
Definition: lookupattr.cc:333
size_type subSize() const
Ammount of attributes in the sub-structure.
Definition: lookupattr.cc:422
static const RepoIdType noRepoId(0)
Id to denote Repo::noRepository.
Lightweight attribute value lookup.
Definition: lookupattr.h:111
void stayInThisSolvable()
Stop after all matches in the current Solvable are processed.
Definition: lookupattr.cc:339
void stayInThisRepo()
Stop after all matches in the current Repository are processed.
Definition: lookupattr.cc:342
void setAttr(SolvAttr attr_r)
Set the SolvAttr to search.
Definition: lookupattr.cc:207
String related utilities and Regular expression matching.
Definition: ansi.h:854
bool subEmpty() const
Whether the sub-structure is empty.
Definition: lookupattr.cc:419
Access to the sat-pools string space.
Definition: IdString.h:51
Orchestrator for a libsolv pool instance.
Definition: pool.h:36
iterator subBegin() const
Iterator to the begin of a sub-structure.
Definition: lookupattr.cc:430
void setPool(Location loc_r)
Definition: lookupattr.cc:88
void setPool(Location=SOLV_ATTR)
Set search in Pool (all repositories).
Definition: lookupattr.cc:219
zypp::sat::detail::CPool CPool
Definition: poolconstants.h:36
void setParent(SolvAttr attr_r)
Definition: lookupattr.cc:121
static CheckSum md5(const std::string &checksum)
Definition: CheckSum.h:73
void setParent(SolvAttr attr_r)
Set search within a sub-structure (SolvAttr::noAttr for none)
Definition: lookupattr.cc:237
LookupAttr()
Default ctor finds nothing.
Definition: lookupattr.cc:165
zypp::sat::detail::SolvableIdType SolvableIdType
Definition: poolconstants.h:44
bool empty() const
Whether the query is empty.
Definition: lookupattr.cc:246
bool dip_equal(const detail::CDataiterator &lhs, const detail::CDataiterator &rhs) const
Definition: lookupattr.cc:695
unsigned int size_type
Definition: lookupattr.h:117
std::string asString() const
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: lookupattr.cc:566
LookupAttr::iterator begin() const
Definition: lookupattr.cc:125
SolvAttr inSolvAttr() const
The current SolvAttr.
Definition: lookupattr.cc:327
void setRepo(Repository repo_r, Location=SOLV_ATTR)
Set search in one Repository.
Definition: lookupattr.cc:225
void compile() const
Compile the pattern e.g.
Definition: StrMatcher.cc:297
detail::CDataiterator * get() const
Definition: lookupattr.h:332
bool solvAttrIdString() const
Whether this string attribute is available as IdString.
Definition: lookupattr.cc:375
Repository repo() const
Whether to search in one Repository.
Definition: lookupattr.cc:222
Repository repo() const
Definition: lookupattr.cc:94
void setStrMatcher(const StrMatcher &matcher_r)
Set the pattern to match.
Definition: lookupattr.cc:213
void nextSkipRepo()
On the next call to operator++ advance to the next Repository.
Definition: lookupattr.cc:336
detail::CPool * get() const
Expert backdoor.
Definition: pool.h:59
Convenience char* constructible from std::string and char*, it maps (char*)0 to an empty string...
Definition: String.h:91
static CheckSum sha224(const std::string &checksum)
Definition: CheckSum.h:76
This file contains private API, this might break at any time between releases.
Definition: capabilities.h:22
CheckSum asCheckSum() const
As CheckSum.
Definition: lookupattr.cc:636
A sat capability.
Definition: capability.h:73
LookupAttr implementation.
Definition: lookupattr.cc:46
bool solvAttrSubEntry() const
Whether this is the entry to a sub-structure (flexarray).
Definition: lookupattr.cc:416
size_type size() const
Ammount of results.
Definition: lookupattr.cc:249
const char * c_str() const
Conversion to string types.
Definition: lookupattr.cc:536
detail::CDataiterator * _dip
Definition: lookupattr.h:337
Location
Specify the where to look for the attribule.
Definition: lookupattr.h:120
SolvAttr parent() const
Whether to search within a sub-structure (SolvAttr::noAttr if not)
Definition: lookupattr.cc:234
static const Repository noRepository
Represents no Repository.
Definition: repository.h:79
IdString idStr() const
As IdString.
Definition: lookupattr.cc:620
const char * c_str() const
Conversion to const char *
Definition: IdString.cc:51
detail::IdType solvAttrType() const
The current SolvAttr type.
Definition: lookupattr.cc:345
std::string numstring(char n, int w=0)
Definition: String.h:290
Impl(detail::CPool *pool_r, const SolvAttr &attr_r, Solvable solv_r)
Definition: lookupattr.cc:59
SolvableIdType size_type
Definition: poolconstants.h:59
zypp::sat::detail::IdType IdType
Definition: poolconstants.h:43
iterator begin() const
Iterator to the begin of query results.
Definition: lookupattr.cc:240
IdType id() const
Expert backdoor.
Definition: solvable.h:338
static CheckSum sha256(const std::string &checksum)
Definition: CheckSum.h:77
zypp::RWCOW_pointer< Impl > _pimpl
Definition: lookupattr.h:235
void setRepo(Repository repo_r)
Set search in one Repository.
Definition: lookupattr.cc:265
Search for repository attributes.
Definition: lookupattr.h:122
zypp::sat::detail::CDataiterator CDataiterator
Definition: poolconstants.h:33
detail::RepoIdType repository() const
The repo id this Solvable belongs to.
Definition: solvable.cc:273
int get() const
Return the integer representation.
Definition: StrMatcher.h:150
bool solvAttrNumeric() const
Whether this is a numeric attribute (incl.
Definition: lookupattr.cc:348
IdType id() const
Expert backdoor.
Definition: repository.h:327
static const Solvable noSolvable
Represents no Solvable.
Definition: solvable.h:94
Solvable inSolvable() const
The current Solvable.
Definition: lookupattr.cc:324
Impl(detail::CPool *pool_r, const SolvAttr &attr_r, Repository repo_r, Location loc_r)
Definition: lookupattr.cc:56
static const IdType noId(0)
Wrapper around sat detail::CDataiterator.
Definition: lookupattr.h:291
static CheckSum sha384(const std::string &checksum)
Definition: CheckSum.h:78
const Match & flags() const
The current search flags.
Definition: StrMatcher.cc:325
iterator end() const
Iterator behind the end of query results.
Definition: lookupattr.cc:243
unsigned long long asUnsignedLL() const
Definition: lookupattr.cc:517
bool empty() const
Definition: String.h:108
const StrMatcher & strMatcher() const
Definition: lookupattr.cc:75
bool solvAttrCheckSum() const
Whether this is a CheckSum attribute.
Definition: lookupattr.cc:388
static CheckSum sha1(const std::string &checksum)
Definition: CheckSum.h:75
Solvable solvable() const
Whether to search in one Solvable.
Definition: lookupattr.cc:228
std::string asString() const
Definition: capability.h:203
std::string asString() const
Conversion to std::string
Definition: IdString.h:110
Repository inRepo() const
The current Repository.
Definition: lookupattr.cc:321
LookupRepoAttr()
Default ctor finds nothing.
Definition: lookupattr.h:260
iterator & operator=(const iterator &rhs)
Definition: lookupattr.cc:686
static CheckSum sha512(const std::string &checksum)
Definition: CheckSum.h:79
bool solvAttrString() const
Whether this is a string attribute.
Definition: lookupattr.cc:360
void setSolvable(Solvable solv_r)
Definition: lookupattr.cc:109
zypp::IdString IdString
Definition: idstring.h:16
bool operator==(const iterator &rhs) const
Definition: lookupattr.cc:721
void nextSkipSolvAttr()
On the next call to operator++ advance to the next SolvAttr.
Definition: lookupattr.cc:330
zypp::sat::detail::RepoIdType RepoIdType
Definition: poolconstants.h:45
const std::string & searchstring() const
The current searchstring.
Definition: StrMatcher.cc:306
SolvAttr attr() const
The SolvAttr to search.
Definition: lookupattr.cc:204
void setRepo(Repository repo_r, Location loc_r)
Definition: lookupattr.cc:97
LookupAttr::iterator end() const
Definition: lookupattr.cc:143
bool pool() const
Whether to search in Pool.
Definition: lookupattr.cc:216