69 _attr = std::move(attr_r);
122 {
_parent = std::move(attr_r); }
132 whichRepo =
_solv.repository();
134 whichRepo =
_repo.id();
138 ::dataiterator_prepend_keyname( dip.
get(),
_parent.id() );
158 {
return new Impl( *
this ); }
175 {
_pimpl->setParent( std::move(parent_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) ) );
187 _pimpl->setParent( std::move(parent_r) );
193 _pimpl.reset(
new Impl( cp, std::move(attr_r), std::move(solv_r) ) );
199 _pimpl.reset(
new Impl( cp, std::move(attr_r), std::move(solv_r) ) );
200 _pimpl->setParent( std::move(parent_r) );
205 {
return _pimpl->attr(); }
208 {
_pimpl->setAttr( std::move(attr_r) ); }
211 {
return _pimpl->strMatcher(); }
214 {
_pimpl->setStrMatcher( matcher_r ); }
217 {
return _pimpl->pool(); }
220 {
_pimpl->setPool( loc_r ); }
223 {
return _pimpl->repo(); }
226 {
_pimpl->setRepo( repo_r, loc_r ); }
229 {
return _pimpl->solvable(); }
232 {
_pimpl->setSolvable( solv_r ); }
235 {
return _pimpl->parent(); }
238 {
_pimpl->setParent( std::move(attr_r) ); }
241 {
return _pimpl->begin(); }
252 for (
auto it =
begin(); it !=
end(); ++it )
275 std::string mstring_r,
int flags_r )
276 :
_dip( new ::Dataiterator )
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,
301 _dip = new ::Dataiterator;
302 ::dataiterator_init_clone( _dip, rhs._dip );
303 ::dataiterator_strdup( _dip );
311 ::dataiterator_free(
_dip );
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; } }
352 case REPOKEY_TYPE_NUM:
353 case REPOKEY_TYPE_CONSTANT:
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:
379 case REPOKEY_TYPE_ID:
380 case REPOKEY_TYPE_IDARRAY:
381 case REPOKEY_TYPE_CONSTANTID:
392 case REPOKEY_TYPE_MD5:
393 case REPOKEY_TYPE_SHA1:
394 case REPOKEY_TYPE_SHA256:
403 enum SubType { ST_NONE,
406 SubType subType(
const detail::DIWrap & dip )
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; }
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 );
471 while ( it !=
subEnd() && (*it).inSolvAttr() != attr_r )
479 if ( attrname_r.
empty() )
482 SubType subtype( subType(
_dip ) );
483 if ( subtype == ST_NONE )
487 if ( subtype == ST_FLEX )
491 subattr += attrname_r;
496 std::string::size_type pos( subattr.rfind(
':' ) );
497 if ( pos != std::string::npos )
499 subattr.erase( pos+1 );
500 subattr += attrname_r;
503 subattr = attrname_r;
514 case REPOKEY_TYPE_NUM:
515 case REPOKEY_TYPE_CONSTANT:
532 case REPOKEY_TYPE_NUM:
533 case REPOKEY_TYPE_CONSTANT:
534 return SOLV_KV_NUM64(&
_dip->kv);
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 ) );
581 case REPOKEY_TYPE_ID:
582 case REPOKEY_TYPE_IDARRAY:
583 case REPOKEY_TYPE_CONSTANTID:
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:
612 case REPOKEY_TYPE_FLEXARRAY:
614 std::ostringstream
str;
618 str <<
" " << (*it).inSolvAttr() <<
" = " << (*it).asString() << endl;
626 return std::string();
635 case REPOKEY_TYPE_ID:
636 case REPOKEY_TYPE_IDARRAY:
637 case REPOKEY_TYPE_CONSTANTID:
651 case REPOKEY_TYPE_MD5:
655 case REPOKEY_TYPE_SHA1:
659 case REPOKEY_TYPE_SHA224:
663 case REPOKEY_TYPE_SHA256:
667 case REPOKEY_TYPE_SHA384:
671 case REPOKEY_TYPE_SHA512:
708 return( lhs.solvid == rhs.solvid && lhs.key->name == rhs.key->name );
731 return (
bool(
_dip) ==
bool(rhs.
_dip) )
739 if ( ! ::dataiterator_step(
_dip.get() ) )
745 ::dataiterator_strdup(
_dip.get() );
Convenience char* constructible from std::string and char*, it maps (char*)0 to an empty string.
Access to the sat-pools string space.
const char * c_str() const
Conversion to const char *.
std::string asString() const
Conversion to std::string.
String matching (STRING|SUBSTRING|GLOB|REGEX).
void compile() const
Compile the pattern e.g.
void nextSkipSolvAttr()
On the next call to operator++ advance to the next SolvAttr.
iterator end() const
Iterator behind the end of query results.
const StrMatcher & strMatcher() const
The pattern to match.
bool empty() const
Whether the query is empty.
void setStrMatcher(const StrMatcher &matcher_r)
Set the pattern to match.
Repository repo() const
Whether to search in one Repository.
SolvAttr attr() const
The SolvAttr to search.
SolvAttr parent() const
Whether to search within a sub-structure (SolvAttr::noAttr if not).
void setAttr(SolvAttr attr_r)
Set the SolvAttr to search.
void setRepo(Repository repo_r, Location=SOLV_ATTR)
Set search in one Repository.
bool pool() const
Whether to search in Pool.
size_type size() const
Ammount of results.
iterator begin() const
Iterator to the begin of query results.
void setSolvable(Solvable solv_r)
Set search in one Solvable.
Solvable solvable() const
Whether to search in one Solvable.
LookupAttr()
Default ctor finds nothing.
void setPool(Location=SOLV_ATTR)
Set search in Pool (all repositories).
void setParent(SolvAttr attr_r)
Set search within a sub-structure (SolvAttr::noAttr for none).
void setRepo(Repository repo_r)
Set search in one Repository.
LookupRepoAttr()
Default ctor finds nothing.
std::string asString() const
This is an overloaded member function, provided for convenience. It differs from the above function o...
static CheckSum md5(const std::string &checksum)
static CheckSum sha384(const std::string &checksum)
static CheckSum sha1(const std::string &checksum)
static CheckSum sha512(const std::string &checksum)
static CheckSum sha256(const std::string &checksum)
static CheckSum sha224(const std::string &checksum)
Value proxy returned by LookupAttr::iterator::operator*().
std::string asString() const
This is an overloaded member function, provided for convenience. It differs from the above function o...
SolvAttr inSolvAttr() const
The current SolvAttr.
LookupAttr::iterator subEnd() const
Iterator behind the end of a sub-structure.
LookupAttr::iterator subFind(const SolvAttr &attr_r) const
Iterator pointing to the first occurrence of SolvAttr attr_r in the sub-structure.
bool subEmpty() const
Whether the sub-structure is empty.
unsigned asUnsigned() const
This is an overloaded member function, provided for convenience. It differs from the above function o...
bool solvAttrString() const
Whether this is a string attribute.
bool solvAttrNumeric() const
Whether this is a numeric attribute (incl.
int asInt() const
Conversion to numeric types.
LookupAttr::size_type size_type
detail::IdType solvAttrType() const
The current SolvAttr type.
detail::CDataiterator * _dip
non-owning — current iterator position
IdString idStr() const
As IdString.
Tp asType() const
Templated return type.
LookupAttr::iterator subBegin() const
Iterator to the begin of a sub-structure.
bool solvAttrIdString() const
Whether this string attribute is available as IdString.
bool solvAttrCheckSum() const
Whether this is a CheckSum attribute.
bool solvAttrSubEntry() const
Whether this is the entry to a sub-structure (flexarray).
Solvable inSolvable() const
The current Solvable.
bool asBool() const
This is an overloaded member function, provided for convenience. It differs from the above function o...
unsigned long long asUnsignedLL() const
This is an overloaded member function, provided for convenience. It differs from the above function o...
detail::CPool * _pool
non-owning — needed for sub-structure DIWrap construction
CheckSum asCheckSum() const
As CheckSum.
Repository inRepo() const
The current Repository.
const char * c_str() const
Conversion to string types.
size_type subSize() const
Amount of attributes in the sub-structure.
LookupAttr implementation.
Impl(detail::CPool *pool_r, const SolvAttr &attr_r, Location loc_r)
void setSolvable(Solvable solv_r)
LookupAttr::iterator begin() const
const StrMatcher & strMatcher() const
void setStrMatcher(const StrMatcher &matcher_r)
Impl(detail::CPool *pool_r, const SolvAttr &attr_r, Solvable solv_r)
Impl(detail::CPool *pool_r, const SolvAttr &attr_r, Repository repo_r, Location loc_r)
void setAttr(SolvAttr attr_r)
LookupAttr::iterator end() const
void setRepo(Repository repo_r, Location loc_r)
Solvable solvable() const
void setPool(Location loc_r)
Impl * clone() const
clone for RWCOW_pointer
void setParent(SolvAttr attr_r)
void nextSkipRepo()
On the next call to operator++ advance to the next Repository.
bool operator==(const iterator &rhs) const
bool dip_equal(const detail::CDataiterator &lhs, const detail::CDataiterator &rhs) const
iterator & operator=(const iterator &rhs)
void stayInThisRepo()
Stop after all matches in the current Repository are processed.
void stayInThisSolvable()
Stop after all matches in the current Solvable are processed.
void nextSkipSolvable()
On the next call to operator++ advance to the next Solvable.
reference operator*() const
iterator end() const
Iterator behind the end of query results.
bool pool() const
Whether to search in Pool.
iterator begin() const
Iterator to the begin of query results.
Location
Specify the where to look for the attribule.
@ REPO_ATTR
Search for repository attributes.
LookupAttr()
Default ctor finds nothing.
void setRepo(Repository repo_r, Location=SOLV_ATTR)
Set search in one Repository.
zypp::RWCOW_pointer< Impl > _pimpl
Orchestrator for a libsolv pool instance.
detail::CPool * get() const
Expert backdoor.
static const Repository noRepository
Represents no Repository.
static const SolvAttr noAttr
Value representing noAttr ("").
static const SolvAttr allAttr
Value to request searching all Attributes (0).
A Solvable object within the sat Pool.
static const Solvable noSolvable
Represents no Solvable.
Wrapper around sat detail::CDataiterator.
detail::CDataiterator * get() const
detail::CPool * pool() const
DIWrap()
NULL detail::CDataiterator
detail::CDataiterator * _dip
String related utilities and Regular expression matching.
std::string numstring(char n, int w=0)
D * rwcowClone(const D *rhs)
relates: RWCOW_pointer Clone the underlying object.
std::string asString(const Patch::Category &obj)
relates: Patch::Category string representation.
CLASS NAME : detail::DIWrap.
zypp::sat::detail::CDataiterator CDataiterator
zypp::sat::detail::RepoIdType RepoIdType
zypp::sat::detail::CPool CPool
zypp::sat::detail::SolvableIdType SolvableIdType
static const IdType noId(0)
static const SolvableIdType noSolvableId(0)
Id to denote Solvable::noSolvable.
static const RepoIdType noRepoId(0)
Id to denote Repo::noRepository.
zypp::sat::detail::IdType IdType
This file contains private API, this might break at any time between releases.