78 _attr = std::move(attr_r);
125 {
_parent = std::move(attr_r); }
141 ::dataiterator_prepend_keyname( dip.get(),
_parent.
id() );
157 friend Impl * rwcowClone<Impl>(
const Impl * rhs );
160 {
return new Impl( *
this ); }
174 : _pimpl( new
Impl(
std::move(attr_r),
std::move(loc_r) ) )
177 : _pimpl( new
Impl(
std::move(attr_r),
std::move(loc_r) ) )
181 : _pimpl( new
Impl(
std::move(attr_r),
std::move(repo_r),
std::move(loc_r) ) )
184 : _pimpl( new
Impl(
std::move(attr_r),
std::move(repo_r),
std::move(loc_r) ) )
188 : _pimpl( new
Impl(
std::move(attr_r),
std::move(solv_r) ) )
191 : _pimpl( new
Impl(
std::move(attr_r),
std::move(solv_r) ) )
259 return str <<
"search nothing";
262 str <<
"search " << obj.
attr() <<
" in ";
264 str <<
"search ALL in ";
270 return str <<
"pool";
300 std::string mstring_r,
int flags_r )
301 : _dip( new ::Dataiterator )
302 , _mstring(
std::move( mstring_r ))
309 const char * mstring_r,
int flags_r )
310 : _dip( new ::Dataiterator )
311 , _mstring( mstring_r ? mstring_r :
"" )
319 , _mstring( rhs._mstring )
323 _dip = new ::Dataiterator;
324 ::dataiterator_init_clone(
_dip, rhs.
_dip );
325 ::dataiterator_strdup(
_dip );
333 ::dataiterator_free(
_dip );
339 {
return str << obj.
get(); }
362 {
if ( _dip ) ::dataiterator_skip_attribute( _dip.get() ); }
365 {
if ( _dip ) ::dataiterator_skip_solvable( _dip.get() ); }
368 {
if ( _dip ) ::dataiterator_skip_repo( _dip.get() ); }
371 {
if ( _dip ) { _dip.get()->repoid = -1; _dip.get()->flags |= SEARCH_THISSOLVID; } }
374 {
if ( _dip ) { _dip.get()->repoid = -1; } }
385 switch ( solvAttrType() )
387 case REPOKEY_TYPE_NUM:
388 case REPOKEY_TYPE_CONSTANT:
397 switch ( solvAttrType() )
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:
412 switch ( solvAttrType() )
414 case REPOKEY_TYPE_ID:
415 case REPOKEY_TYPE_IDARRAY:
416 case REPOKEY_TYPE_CONSTANTID:
425 switch ( solvAttrType() )
427 case REPOKEY_TYPE_MD5:
428 case REPOKEY_TYPE_SHA1:
429 case REPOKEY_TYPE_SHA256:
446 if ( dip.
get()->key->type == REPOKEY_TYPE_FLEXARRAY )
448 return dip.
get()->kv.parent ? ST_SUB : ST_NONE;
454 {
return subType( _dip ) != ST_NONE; }
461 {
return( subBegin() == subEnd() ); }
466 for_( it, subBegin(), subEnd() )
473 SubType subtype( subType( _dip ) );
474 if ( subtype == ST_NONE )
478 ::dataiterator_clonepos( dip.
get(), _dip.get() );
484 ::dataiterator_seek( dip.
get(), DI_SEEK_CHILD|DI_SEEK_STAY );
487 ::dataiterator_seek( dip.
get(), DI_SEEK_REWIND|DI_SEEK_STAY );
503 while ( it != subEnd() && it.
inSolvAttr() != attr_r )
511 if ( attrname_r.
empty() )
514 SubType subtype( subType( _dip ) );
515 if ( subtype == ST_NONE )
518 std::string subattr( inSolvAttr().
asString() );
519 if ( subtype == ST_FLEX )
523 subattr += attrname_r;
529 if ( pos != std::string::npos )
531 subattr.erase( pos+1 );
532 subattr += attrname_r;
535 subattr = attrname_r;
537 return subFind(
SolvAttr( subattr ) );
548 switch ( solvAttrType() )
550 case REPOKEY_TYPE_NUM:
551 case REPOKEY_TYPE_CONSTANT:
566 switch ( solvAttrType() )
568 case REPOKEY_TYPE_NUM:
569 case REPOKEY_TYPE_CONSTANT:
570 return SOLV_KV_NUM64(&_dip->kv);
585 switch ( solvAttrType() )
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 );
596 case REPOKEY_TYPE_STR:
600 case REPOKEY_TYPE_DIRSTRARRAY:
602 return( _dip->flags & SEARCH_FILES
604 : ::repodata_dir2str( _dip->data, _dip->kv.id, _dip->kv.str ) );
615 switch ( solvAttrType() )
617 case REPOKEY_TYPE_ID:
618 case REPOKEY_TYPE_IDARRAY:
619 case REPOKEY_TYPE_CONSTANTID:
621 detail::IdType id = ::repodata_globalize_id( _dip->data, _dip->kv.id, 1 );
627 case REPOKEY_TYPE_STR:
628 case REPOKEY_TYPE_DIRSTRARRAY:
630 const char * ret( c_str() );
631 return ret ? ret :
"";
635 case REPOKEY_TYPE_NUM:
636 case REPOKEY_TYPE_CONSTANT:
640 case REPOKEY_TYPE_MD5:
641 case REPOKEY_TYPE_SHA1:
642 case REPOKEY_TYPE_SHA256:
644 return asCheckSum().asString();
648 case REPOKEY_TYPE_FLEXARRAY:
650 std::ostringstream
str;
652 for_( it, subBegin(), subEnd() )
654 str <<
" " << it.inSolvAttr() <<
" = " << it.asString() << endl;
662 return std::string();
669 switch ( solvAttrType() )
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 ) );
685 switch ( solvAttrType() )
687 case REPOKEY_TYPE_MD5:
688 return CheckSum::md5( ::repodata_chk2str( _dip->data, solvAttrType(), (
unsigned char *)_dip->kv.str ) );
691 case REPOKEY_TYPE_SHA1:
692 return CheckSum::sha1( ::repodata_chk2str( _dip->data, solvAttrType(), (
unsigned char *)_dip->kv.str ) );
695 case REPOKEY_TYPE_SHA224:
696 return CheckSum::sha224( ::repodata_chk2str( _dip->data, solvAttrType(), (
unsigned char *)_dip->kv.str ) );
699 case REPOKEY_TYPE_SHA256:
700 return CheckSum::sha256( ::repodata_chk2str( _dip->data, solvAttrType(), (
unsigned char *)_dip->kv.str ) );
703 case REPOKEY_TYPE_SHA384:
704 return CheckSum::sha384( ::repodata_chk2str( _dip->data, solvAttrType(), (
unsigned char *)_dip->kv.str ) );
707 case REPOKEY_TYPE_SHA512:
708 return CheckSum::sha512( ::repodata_chk2str( _dip->data, solvAttrType(), (
unsigned char *)_dip->kv.str ) );
720 : iterator_adaptor_( 0 )
724 : iterator_adaptor_( 0 )
731 : iterator_adaptor_( 0 )
746 base_reference() = _dip.
get();
757 return( lhs.solvid == rhs.solvid && lhs.key->name == rhs.key->name );
762 return _dip ? ::repodata_globalize_id( _dip->data, _dip->kv.id, 1 )
770 if ( ! ::dataiterator_step( _dip.get() ) )
773 base_reference() = 0;
777 ::dataiterator_strdup( _dip.get() );
786 return str <<
"EndOfQuery";
798 template<>
CheckSum LookupAttr::iterator::asType<CheckSum>()
const 799 {
return asCheckSum(); }
810 str <<
"detail::CDataiterator(";
821 str <<
"|" << obj->repodataid;
822 str <<
"|" << obj->repoid;
static const SolvableIdType noSolvableId(0)
Id to denote Solvable::noSolvable.
std::string asString(const Patch::Category &obj)
void stayInThisRepo()
Stop after all matches in the current Repository are processed.
DIWrap()
NULL detail::CDataiterator
void setStrMatcher(const StrMatcher &matcher_r)
SolvAttr parent() const
Whether to search within a sub-structure (SolvAttr::noAttr if not)
A Solvable object within the sat Pool.
SolvAttr parent() const
Return the parent of well know sub-structure attributes (SolvAttr::noAttr if none).
bool subEmpty() const
Whether the sub-structure is empty.
IdString idStr() const
As IdStr.
IdType id() const
Expert backdoor.
LookupAttr::iterator end() const
void setPool(Location=SOLV_ATTR)
Set search in Pool (all repositories).
Solvable solvable() const
Whether to search in one Solvable.
iterator subEnd() const
Iterator behind the end of a sub-structure.
void setAttr(SolvAttr attr_r)
Set the SolvAttr to search.
static const SolvAttr allAttr
Value to request searching all Attributes (0).
detail::IdType solvAttrType() const
The current SolvAttr type.
::s_Dataiterator CDataiterator
Wrapped libsolv C data type exposed as backdoor.
String matching (STRING|SUBSTRING|GLOB|REGEX).
bool solvAttrCheckSum() const
Whether this is a CheckSum attribute.
const StrMatcher & strMatcher() const
The pattern to match.
bool solvAttrString() const
Whether this is a string attribute.
Lightweight attribute value lookup.
detail::CDataiterator * get() const
Expert backdoor.
std::ostream & operator<<(std::ostream &str, const FileConflicts &obj)
void setRepo(Repository repo_r, Location loc_r)
std::ostream & dumpRange(std::ostream &str, TIterator begin, TIterator end, const std::string &intro="{", const std::string &pfx="\ ", const std::string &sep="\ ", const std::string &sfx="\, const std::string &extro="}")
Print range defined by iterators (multiline style).
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)
#define for_(IT, BEG, END)
Convenient for-loops using iterator.
void setSolvable(Solvable solv_r)
Set search in one Solvable.
void setPool(Location loc_r)
String related utilities and Regular expression matching.
detail::CDataiterator * get() const
std::ostream & operator<<(std::ostream &str, const SerialNumber &obj)
void nextSkipSolvAttr()
On the next call to operator++ advance to the next SolvAttr.
Impl(const SolvAttr &attr_r, Solvable solv_r)
int IdType
Generic Id type.
Access to the sat-pools string space.
RWCOW_pointer< Impl > _pimpl
void setSolvable(Solvable solv_r)
detail::IdType dereference() const
const StrMatcher & strMatcher() const
static CheckSum md5(const std::string &checksum)
bool dip_equal(const detail::CDataiterator &lhs, const detail::CDataiterator &rhs) const
LookupAttr()
Default ctor finds nothing.
static const Solvable noSolvable
Represents no Solvable.
LookupAttr implememtation.
void setRepo(Repository repo_r)
Set search in one Repository.
iterator & operator=(const iterator &rhs)
bool solvAttrNumeric() const
Whether this is a numeric attribute (incl.
iterator end() const
Iterator behind the end of query results.
Repository repository() const
The Repository this Solvable belongs to.
void compile() const
Compile the pattern e.g.
static Pool instance()
Singleton ctor.
void setRepo(Repository repo_r, Location=SOLV_ATTR)
Set search in one Repository.
SolvAttr inSolvAttr() const
The current SolvAttr.
Convenience char* constructible from std::string and char*, it maps (char*)0 to an empty string...
static CheckSum sha224(const std::string &checksum)
Wrapper around sat detail::CDataiterator.
void stayInThisSolvable()
Stop after all matches in the current Solvable are processed.
Impl * clone() const
clone for RWCOW_pointer
LookupAttr::iterator begin() const
unsigned asUnsigned() const
void setStrMatcher(const StrMatcher &matcher_r)
Set the pattern to match.
void nextSkipSolvable()
On the next call to operator++ advance to the next Solvable.
std::ostream & operator<<(std::ostream &str, const DIWrap &obj)
void setAttr(SolvAttr attr_r)
std::ostream & dumpOn(std::ostream &str, const LocaleSupport &obj)
const char * c_str() const
Conversion to const char *
int asInt() const
Conversion to numeric types.
std::string numstring(char n, int w=0)
LookupRepoAttr()
Default ctor finds nothing.
static CheckSum sha256(const std::string &checksum)
bool pool() const
Whether to search in Pool.
std::ostream & operator<<(std::ostream &str, const LookupAttr &obj) ZYPP_API
size_type subSize() const
Ammount of attributes in the sub-structure.
SolvAttr attr() const
The SolvAttr to search.
static const SolvAttr noAttr
Value representing noAttr ("")
Repository repo() const
Whether to search in one Repository.
Impl(const SolvAttr &attr_r, Location loc_r)
CRepo * RepoIdType
Id type to connect Repo and sat-repo.
static const Repository noRepository
Represents no Repository.
int get() const
Return the integer representation.
Solvable inSolvable() const
The current Solvable.
void setParent(SolvAttr attr_r)
Solvable solvable() const
void nextSkipRepo()
On the next call to operator++ advance to the next Repository.
static const IdType noId(0)
static CheckSum sha384(const std::string &checksum)
detail::CDataiterator * _dip
const Match & flags() const
The current search flags.
unsigned int SolvableIdType
Id type to connect Solvable and sat-solvable.
static CheckSum sha1(const std::string &checksum)
bool solvAttrIdString() const
Whether this string attribute is available as IdString.
std::string asString() const
Conversion to std::string
CheckSum asCheckSum() const
As CheckSum.
size_type size() const
Ammount of results.
std::string asString() const
This is an overloaded member function, provided for convenience. It differs from the above function o...
iterator subFind(const SolvAttr &attr_r) const
Iterator pointing to the first occurance of SolvAttr attr_r in sub-structure.
static CheckSum sha512(const std::string &checksum)
std::string asString() const
IdType id() const
Expert backdoor.
Easy-to use interface to the ZYPP dependency resolver.
iterator subBegin() const
Iterator to the begin of a sub-structure.
Impl(const SolvAttr &attr_r, Repository repo_r, Location loc_r)
Repository inRepo() const
The current Repository.
bool solvAttrSubEntry() const
Whether this is the entry to a sub-structure (flexarray).
Location
Specify the where to look for the attribule.
unsigned long long asUnsignedLL() const
bool empty() const
Whether the query is empty.
const std::string & searchstring() const
The current searchstring.
iterator begin() const
Iterator to the begin of query results.
const char * c_str() const
Conversion to string types.
Search for repository attributes.
void swap(DIWrap &rhs) noexcept