69 _attr = std::move(attr_r);
70 SolvAttr p(
_attr.parent() );
71 if ( p != SolvAttr::noAttr )
122 {
_parent = std::move(attr_r); }
137 if (
_parent != SolvAttr::noAttr )
138 ::dataiterator_prepend_keyname( dip.get(),
_parent.id() );
155 friend Impl * zypp::rwcowClone<Impl>(
const Impl * rhs );
158 {
return new Impl( *
this ); }
170 : _pimpl( new
Impl( pool.get(),
std::move(attr_r),
std::move(loc_r) ) )
174 : _pimpl( new
Impl( pool.get(),
std::move(attr_r),
std::move(loc_r) ) )
180 _pimpl.
reset(
new Impl( cp, std::move(attr_r), std::move(repo_r), std::move(loc_r) ) );
186 _pimpl.
reset(
new Impl( cp, std::move(attr_r), std::move(repo_r), std::move(loc_r) ) );
252 for (
auto it =
begin(); it !=
end(); ++it )
275 std::string mstring_r,
int flags_r )
276 : _dip( new ::Dataiterator )
278 , _mstring(
std::move( mstring_r ))
280 ::dataiterator_init(
_dip,
_pool, repoId_r, solvId_r, attrId_r,
285 const char * mstring_r,
int flags_r )
286 : _dip( new ::Dataiterator )
288 , _mstring( mstring_r ? mstring_r :
"" )
290 ::dataiterator_init(
_dip,
_pool, repoId_r, solvId_r, attrId_r,
297 , _mstring( rhs._mstring )
301 _dip = new ::Dataiterator;
302 ::dataiterator_init_clone(
_dip, rhs.
_dip );
303 ::dataiterator_strdup(
_dip );
311 ::dataiterator_free(
_dip );
328 {
return _dip ? SolvAttr(
_dip->key->name ) : SolvAttr::noAttr; }
331 {
if (
_dip ) ::dataiterator_skip_attribute(
_dip.
get() ); }
334 {
if ( _dip ) ::dataiterator_skip_solvable( _dip.get() ); }
337 {
if ( _dip ) ::dataiterator_skip_repo( _dip.get() ); }
340 {
if ( _dip ) { _dip.get()->repoid = -1; _dip.get()->flags |= SEARCH_THISSOLVID; } }
343 {
if ( _dip ) { _dip.get()->repoid = -1; } }
350 switch ( solvAttrType() )
352 case REPOKEY_TYPE_NUM:
353 case REPOKEY_TYPE_CONSTANT:
362 switch ( solvAttrType() )
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:
377 switch ( solvAttrType() )
379 case REPOKEY_TYPE_ID:
380 case REPOKEY_TYPE_IDARRAY:
381 case REPOKEY_TYPE_CONSTANTID:
390 switch ( solvAttrType() )
392 case REPOKEY_TYPE_MD5:
393 case REPOKEY_TYPE_SHA1:
394 case REPOKEY_TYPE_SHA256:
410 if ( dip.
get()->key->type == REPOKEY_TYPE_FLEXARRAY )
412 return dip.
get()->kv.parent ? ST_SUB : ST_NONE;
419 if ( dip->key->type == REPOKEY_TYPE_FLEXARRAY )
421 return dip->kv.parent ? ST_SUB : ST_NONE;
426 {
return subType( _dip ) != ST_NONE; }
429 {
return subBegin() == subEnd(); }
434 for (
auto it = subBegin(); it != subEnd(); ++it )
441 SubType subtype( subType( _dip ) );
442 if ( subtype == ST_NONE )
446 ::dataiterator_clonepos( dip.
get(), _dip );
452 ::dataiterator_seek( dip.
get(), DI_SEEK_CHILD|DI_SEEK_STAY );
455 ::dataiterator_seek( dip.
get(), DI_SEEK_REWIND|DI_SEEK_STAY );
469 if ( attr_r != SolvAttr::allAttr )
471 while ( it != subEnd() && (*it).inSolvAttr() != attr_r )
479 if ( attrname_r.
empty() )
482 SubType subtype( subType( _dip ) );
483 if ( subtype == ST_NONE )
486 std::string subattr( inSolvAttr().
asString() );
487 if ( subtype == ST_FLEX )
491 subattr += attrname_r;
497 if ( pos != std::string::npos )
499 subattr.erase( pos+1 );
500 subattr += attrname_r;
503 subattr = attrname_r;
505 return subFind( SolvAttr( subattr ) );
512 switch ( solvAttrType() )
514 case REPOKEY_TYPE_NUM:
515 case REPOKEY_TYPE_CONSTANT:
530 switch ( solvAttrType() )
532 case REPOKEY_TYPE_NUM:
533 case REPOKEY_TYPE_CONSTANT:
534 return SOLV_KV_NUM64(&_dip->kv);
549 switch ( solvAttrType() )
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 );
560 case REPOKEY_TYPE_STR:
564 case REPOKEY_TYPE_DIRSTRARRAY:
566 return( _dip->flags & SEARCH_FILES
568 : ::repodata_dir2str( _dip->data, _dip->kv.id, _dip->kv.str ) );
579 switch ( solvAttrType() )
581 case REPOKEY_TYPE_ID:
582 case REPOKEY_TYPE_IDARRAY:
583 case REPOKEY_TYPE_CONSTANTID:
585 detail::IdType id = ::repodata_globalize_id( _dip->data, _dip->kv.id, 1 );
591 case REPOKEY_TYPE_STR:
592 case REPOKEY_TYPE_DIRSTRARRAY:
594 const char * ret( c_str() );
595 return ret ? ret :
"";
599 case REPOKEY_TYPE_NUM:
600 case REPOKEY_TYPE_CONSTANT:
604 case REPOKEY_TYPE_MD5:
605 case REPOKEY_TYPE_SHA1:
606 case REPOKEY_TYPE_SHA256:
608 return asCheckSum().asString();
612 case REPOKEY_TYPE_FLEXARRAY:
614 std::ostringstream
str;
616 for (
auto it = subBegin(); it != subEnd(); ++it )
618 str <<
" " << (*it).inSolvAttr() <<
" = " << (*it).asString() << endl;
626 return std::string();
633 switch ( solvAttrType() )
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 ) );
649 switch ( solvAttrType() )
651 case REPOKEY_TYPE_MD5:
652 return CheckSum::md5( ::repodata_chk2str( _dip->data, solvAttrType(), (
unsigned char *)_dip->kv.str ) );
655 case REPOKEY_TYPE_SHA1:
656 return CheckSum::sha1( ::repodata_chk2str( _dip->data, solvAttrType(), (
unsigned char *)_dip->kv.str ) );
659 case REPOKEY_TYPE_SHA224:
660 return CheckSum::sha224( ::repodata_chk2str( _dip->data, solvAttrType(), (
unsigned char *)_dip->kv.str ) );
663 case REPOKEY_TYPE_SHA256:
664 return CheckSum::sha256( ::repodata_chk2str( _dip->data, solvAttrType(), (
unsigned char *)_dip->kv.str ) );
667 case REPOKEY_TYPE_SHA384:
668 return CheckSum::sha384( ::repodata_chk2str( _dip->data, solvAttrType(), (
unsigned char *)_dip->kv.str ) );
671 case REPOKEY_TYPE_SHA512:
672 return CheckSum::sha512( ::repodata_chk2str( _dip->data, solvAttrType(), (
unsigned char *)_dip->kv.str ) );
708 return( lhs.solvid == rhs.solvid && lhs.key->name == rhs.key->name );
731 return (
bool(_dip) ==
bool(rhs.
_dip) )
732 && ( ! _dip || dip_equal( *_dip.get(), *rhs.
_dip.
get() ) );
739 if ( ! ::dataiterator_step( _dip.get() ) )
745 ::dataiterator_strdup( _dip.get() );
750 template<>
CheckSum LookupAttrValue::asType<CheckSum>()
const 751 {
return asCheckSum(); }
static const SolvableIdType noSolvableId(0)
Id to denote Solvable::noSolvable.
void setStrMatcher(const StrMatcher &matcher_r)
const StrMatcher & strMatcher() const
The pattern to match.
void setAttr(SolvAttr attr_r)
Impl(detail::CPool *pool_r, const SolvAttr &attr_r, Location loc_r)
A Solvable object within the sat Pool.
Impl * clone() const
clone for RWCOW_pointer
unsigned long long asUnsignedLL() const
std::string asString(const Patch::Category &obj)
relates: Patch::Category string representation.
DIWrap()
NULL detail::CDataiterator
String matching (STRING|SUBSTRING|GLOB|REGEX).
void setSolvable(Solvable solv_r)
Set search in one Solvable.
void nextSkipSolvable()
On the next call to operator++ advance to the next Solvable.
static const RepoIdType noRepoId(0)
Id to denote Repo::noRepository.
Lightweight attribute value lookup.
void stayInThisSolvable()
Stop after all matches in the current Solvable are processed.
LookupAttr::iterator subBegin() const
Iterator to the begin of a sub-structure.
void stayInThisRepo()
Stop after all matches in the current Repository are processed.
bool subEmpty() const
Whether the sub-structure is empty.
void setAttr(SolvAttr attr_r)
Set the SolvAttr to search.
String related utilities and Regular expression matching.
const char * c_str() const
Conversion to string types.
Value proxy returned by LookupAttr::iterator::operator*().
Access to the sat-pools string space.
Orchestrator for a libsolv pool instance.
void setPool(Location loc_r)
void setPool(Location=SOLV_ATTR)
Set search in Pool (all repositories).
zypp::sat::detail::CPool CPool
Repository inRepo() const
The current Repository.
void setParent(SolvAttr attr_r)
static CheckSum md5(const std::string &checksum)
void setParent(SolvAttr attr_r)
Set search within a sub-structure (SolvAttr::noAttr for none)
LookupAttr()
Default ctor finds nothing.
zypp::sat::detail::SolvableIdType SolvableIdType
bool empty() const
Whether the query is empty.
bool dip_equal(const detail::CDataiterator &lhs, const detail::CDataiterator &rhs) const
detail::IdType solvAttrType() const
The current SolvAttr type.
LookupAttr::iterator begin() const
void setRepo(Repository repo_r, Location=SOLV_ATTR)
Set search in one Repository.
void compile() const
Compile the pattern e.g.
detail::CDataiterator * get() const
Repository repo() const
Whether to search in one Repository.
void setStrMatcher(const StrMatcher &matcher_r)
Set the pattern to match.
std::string asString() const
This is an overloaded member function, provided for convenience. It differs from the above function o...
void nextSkipRepo()
On the next call to operator++ advance to the next Repository.
detail::CPool * get() const
Expert backdoor.
Convenience char* constructible from std::string and char*, it maps (char*)0 to an empty string...
size_type subSize() const
Amount of attributes in the sub-structure.
static CheckSum sha224(const std::string &checksum)
bool solvAttrNumeric() const
Whether this is a numeric attribute (incl.
This file contains private API, this might break at any time between releases.
LookupAttr implementation.
SolvAttr inSolvAttr() const
The current SolvAttr.
reference operator*() const
size_type size() const
Ammount of results.
detail::CDataiterator * _dip
Location
Specify the where to look for the attribule.
SolvAttr parent() const
Whether to search within a sub-structure (SolvAttr::noAttr if not)
static const Repository noRepository
Represents no Repository.
LookupAttr::size_type size_type
const char * c_str() const
Conversion to const char *
std::string numstring(char n, int w=0)
Impl(detail::CPool *pool_r, const SolvAttr &attr_r, Solvable solv_r)
bool solvAttrString() const
Whether this is a string attribute.
zypp::sat::detail::IdType IdType
iterator begin() const
Iterator to the begin of query results.
IdString idStr() const
As IdString.
IdType id() const
Expert backdoor.
LookupAttr::iterator subFind(const SolvAttr &attr_r) const
Iterator pointing to the first occurrence of SolvAttr attr_r in the sub-structure.
Solvable solvable() const
static CheckSum sha256(const std::string &checksum)
bool solvAttrIdString() const
Whether this string attribute is available as IdString.
zypp::RWCOW_pointer< Impl > _pimpl
void setRepo(Repository repo_r)
Set search in one Repository.
Search for repository attributes.
zypp::sat::detail::CDataiterator CDataiterator
int asInt() const
Conversion to numeric types.
detail::RepoIdType repository() const
The repo id this Solvable belongs to.
int get() const
Return the integer representation.
unsigned asUnsigned() const
IdType id() const
Expert backdoor.
static const Solvable noSolvable
Represents no Solvable.
bool solvAttrSubEntry() const
Whether this is the entry to a sub-structure (flexarray).
detail::CDataiterator * _dip
non-owning — current iterator position
Impl(detail::CPool *pool_r, const SolvAttr &attr_r, Repository repo_r, Location loc_r)
static const IdType noId(0)
Wrapper around sat detail::CDataiterator.
static CheckSum sha384(const std::string &checksum)
CheckSum asCheckSum() const
As CheckSum.
const Match & flags() const
The current search flags.
iterator end() const
Iterator behind the end of query results.
LookupAttr::iterator subEnd() const
Iterator behind the end of a sub-structure.
const StrMatcher & strMatcher() const
bool solvAttrCheckSum() const
Whether this is a CheckSum attribute.
static CheckSum sha1(const std::string &checksum)
Solvable solvable() const
Whether to search in one Solvable.
std::string asString() const
std::string asString() const
Conversion to std::string
Solvable inSolvable() const
The current Solvable.
LookupRepoAttr()
Default ctor finds nothing.
iterator & operator=(const iterator &rhs)
static CheckSum sha512(const std::string &checksum)
void setSolvable(Solvable solv_r)
bool operator==(const iterator &rhs) const
void nextSkipSolvAttr()
On the next call to operator++ advance to the next SolvAttr.
zypp::sat::detail::RepoIdType RepoIdType
const std::string & searchstring() const
The current searchstring.
SolvAttr attr() const
The SolvAttr to search.
void setRepo(Repository repo_r, Location loc_r)
LookupAttr::iterator end() const
bool pool() const
Whether to search in Pool.