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;
417 {
return subType( _dip ) != ST_NONE; }
420 {
return( subBegin() == subEnd() ); }
425 for (
auto it = subBegin(); it != subEnd(); ++it )
432 SubType subtype( subType( _dip ) );
433 if ( subtype == ST_NONE )
437 ::dataiterator_clonepos( dip.
get(), _dip.get() );
443 ::dataiterator_seek( dip.
get(), DI_SEEK_CHILD|DI_SEEK_STAY );
446 ::dataiterator_seek( dip.
get(), DI_SEEK_REWIND|DI_SEEK_STAY );
460 if ( attr_r != SolvAttr::allAttr )
462 while ( it != subEnd() && it.
inSolvAttr() != attr_r )
470 if ( attrname_r.
empty() )
473 SubType subtype( subType( _dip ) );
474 if ( subtype == ST_NONE )
477 std::string subattr( inSolvAttr().
asString() );
478 if ( subtype == ST_FLEX )
482 subattr += attrname_r;
488 if ( pos != std::string::npos )
490 subattr.erase( pos+1 );
491 subattr += attrname_r;
494 subattr = attrname_r;
496 return subFind( SolvAttr( subattr ) );
503 switch ( solvAttrType() )
505 case REPOKEY_TYPE_NUM:
506 case REPOKEY_TYPE_CONSTANT:
521 switch ( solvAttrType() )
523 case REPOKEY_TYPE_NUM:
524 case REPOKEY_TYPE_CONSTANT:
525 return SOLV_KV_NUM64(&_dip->kv);
540 switch ( solvAttrType() )
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 );
551 case REPOKEY_TYPE_STR:
555 case REPOKEY_TYPE_DIRSTRARRAY:
557 return( _dip->flags & SEARCH_FILES
559 : ::repodata_dir2str( _dip->data, _dip->kv.id, _dip->kv.str ) );
570 switch ( solvAttrType() )
572 case REPOKEY_TYPE_ID:
573 case REPOKEY_TYPE_IDARRAY:
574 case REPOKEY_TYPE_CONSTANTID:
576 detail::IdType id = ::repodata_globalize_id( _dip->data, _dip->kv.id, 1 );
582 case REPOKEY_TYPE_STR:
583 case REPOKEY_TYPE_DIRSTRARRAY:
585 const char * ret( c_str() );
586 return ret ? ret :
"";
590 case REPOKEY_TYPE_NUM:
591 case REPOKEY_TYPE_CONSTANT:
595 case REPOKEY_TYPE_MD5:
596 case REPOKEY_TYPE_SHA1:
597 case REPOKEY_TYPE_SHA256:
599 return asCheckSum().asString();
603 case REPOKEY_TYPE_FLEXARRAY:
605 std::ostringstream
str;
607 for (
auto it = subBegin(); it != subEnd(); ++it )
609 str <<
" " << it.inSolvAttr() <<
" = " << it.asString() << endl;
617 return std::string();
624 switch ( solvAttrType() )
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 ) );
640 switch ( solvAttrType() )
642 case REPOKEY_TYPE_MD5:
643 return CheckSum::md5( ::repodata_chk2str( _dip->data, solvAttrType(), (
unsigned char *)_dip->kv.str ) );
646 case REPOKEY_TYPE_SHA1:
647 return CheckSum::sha1( ::repodata_chk2str( _dip->data, solvAttrType(), (
unsigned char *)_dip->kv.str ) );
650 case REPOKEY_TYPE_SHA224:
651 return CheckSum::sha224( ::repodata_chk2str( _dip->data, solvAttrType(), (
unsigned char *)_dip->kv.str ) );
654 case REPOKEY_TYPE_SHA256:
655 return CheckSum::sha256( ::repodata_chk2str( _dip->data, solvAttrType(), (
unsigned char *)_dip->kv.str ) );
658 case REPOKEY_TYPE_SHA384:
659 return CheckSum::sha384( ::repodata_chk2str( _dip->data, solvAttrType(), (
unsigned char *)_dip->kv.str ) );
662 case REPOKEY_TYPE_SHA512:
663 return CheckSum::sha512( ::repodata_chk2str( _dip->data, solvAttrType(), (
unsigned char *)_dip->kv.str ) );
699 return( lhs.solvid == rhs.solvid && lhs.key->name == rhs.key->name );
704 return _dip ? ::repodata_globalize_id( _dip->data, _dip->kv.id, 1 )
723 return (
bool(_dip) ==
bool(rhs.
_dip) )
724 && ( ! _dip || dip_equal( *_dip.get(), *rhs.
_dip.
get() ) );
731 if ( ! ::dataiterator_step( _dip.get() ) )
737 ::dataiterator_strdup( _dip.get() );
742 template<>
CheckSum LookupAttr::iterator::asType<CheckSum>()
const 743 {
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.
int asInt() const
Conversion to numeric types.
void setAttr(SolvAttr attr_r)
Impl(detail::CPool *pool_r, const SolvAttr &attr_r, Location loc_r)
A Solvable object within the sat Pool.
iterator subEnd() const
Iterator behind the end of a sub-structure.
Impl * clone() const
clone for RWCOW_pointer
iterator subFind(const SolvAttr &attr_r) const
Iterator pointing to the first occurance of SolvAttr attr_r in sub-structure.
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.
size_type subSize() const
Ammount of attributes in the sub-structure.
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.
void stayInThisRepo()
Stop after all matches in the current Repository are processed.
void setAttr(SolvAttr attr_r)
Set the SolvAttr to search.
String related utilities and Regular expression matching.
reference operator*() const
bool subEmpty() const
Whether the sub-structure is empty.
Access to the sat-pools string space.
Orchestrator for a libsolv pool instance.
iterator subBegin() const
Iterator to the begin of a sub-structure.
void setPool(Location loc_r)
void setPool(Location=SOLV_ATTR)
Set search in Pool (all repositories).
zypp::sat::detail::CPool CPool
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
std::string asString() const
This is an overloaded member function, provided for convenience. It differs from the above function o...
LookupAttr::iterator begin() const
SolvAttr inSolvAttr() const
The current SolvAttr.
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
bool solvAttrIdString() const
Whether this string attribute is available as IdString.
Repository repo() const
Whether to search in one Repository.
void setStrMatcher(const StrMatcher &matcher_r)
Set the pattern to match.
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...
static CheckSum sha224(const std::string &checksum)
This file contains private API, this might break at any time between releases.
CheckSum asCheckSum() const
As CheckSum.
LookupAttr implementation.
bool solvAttrSubEntry() const
Whether this is the entry to a sub-structure (flexarray).
size_type size() const
Ammount of results.
const char * c_str() const
Conversion to string types.
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.
IdString idStr() const
As IdString.
const char * c_str() const
Conversion to const char *
detail::IdType solvAttrType() const
The current SolvAttr type.
std::string numstring(char n, int w=0)
Impl(detail::CPool *pool_r, const SolvAttr &attr_r, Solvable solv_r)
zypp::sat::detail::IdType IdType
iterator begin() const
Iterator to the begin of query results.
IdType id() const
Expert backdoor.
Solvable solvable() const
static CheckSum sha256(const std::string &checksum)
zypp::RWCOW_pointer< Impl > _pimpl
void setRepo(Repository repo_r)
Set search in one Repository.
unsigned asUnsigned() const
Search for repository attributes.
zypp::sat::detail::CDataiterator CDataiterator
detail::RepoIdType repository() const
The repo id this Solvable belongs to.
int get() const
Return the integer representation.
bool solvAttrNumeric() const
Whether this is a numeric attribute (incl.
IdType id() const
Expert backdoor.
static const Solvable noSolvable
Represents no Solvable.
Solvable inSolvable() const
The current Solvable.
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)
const Match & flags() const
The current search flags.
iterator end() const
Iterator behind the end of query results.
unsigned long long asUnsignedLL() const
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
Repository inRepo() const
The current Repository.
LookupRepoAttr()
Default ctor finds nothing.
iterator & operator=(const iterator &rhs)
static CheckSum sha512(const std::string &checksum)
bool solvAttrString() const
Whether this is a string attribute.
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.