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