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,
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; }
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 );
470 if ( attrname_r.
empty() )
473 SubType subtype( subType(
_dip ) );
474 if ( subtype == ST_NONE )
478 if ( subtype == ST_FLEX )
482 subattr += attrname_r;
487 std::string::size_type pos( subattr.rfind(
':' ) );
488 if ( pos != std::string::npos )
490 subattr.erase( pos+1 );
491 subattr += attrname_r;
494 subattr = attrname_r;
505 case REPOKEY_TYPE_NUM:
506 case REPOKEY_TYPE_CONSTANT:
523 case REPOKEY_TYPE_NUM:
524 case REPOKEY_TYPE_CONSTANT:
525 return SOLV_KV_NUM64(&
_dip->kv);
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 ) );
572 case REPOKEY_TYPE_ID:
573 case REPOKEY_TYPE_IDARRAY:
574 case REPOKEY_TYPE_CONSTANTID:
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:
603 case REPOKEY_TYPE_FLEXARRAY:
605 std::ostringstream
str;
609 str <<
" " << it.inSolvAttr() <<
" = " << it.asString() << endl;
617 return std::string();
626 case REPOKEY_TYPE_ID:
627 case REPOKEY_TYPE_IDARRAY:
628 case REPOKEY_TYPE_CONSTANTID:
642 case REPOKEY_TYPE_MD5:
646 case REPOKEY_TYPE_SHA1:
650 case REPOKEY_TYPE_SHA224:
654 case REPOKEY_TYPE_SHA256:
658 case REPOKEY_TYPE_SHA384:
662 case REPOKEY_TYPE_SHA512:
671 : iterator_adaptor_( 0 )
675 : iterator_adaptor_( 0 )
678 base_reference() =
_dip.get();
682 : iterator_adaptor_( 0 )
685 base_reference() =
_dip.get();
697 base_reference() =
_dip.get();
706 return( lhs.solvid == rhs.solvid && lhs.key->name == rhs.key->name );
711 return _dip ? ::repodata_globalize_id(
_dip->data,
_dip->kv.id, 1 )
719 if ( ! ::dataiterator_step(
_dip.get() ) )
722 base_reference() = 0;
726 ::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.
CheckSum asCheckSum() const
As CheckSum.
Repository inRepo() const
The current Repository.
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)
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)
bool solvAttrNumeric() const
Whether this is a numeric attribute (incl.
void nextSkipRepo()
On the next call to operator++ advance to the next Repository.
bool solvAttrString() const
Whether this is a string attribute.
unsigned asUnsigned() 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...
const char * c_str() const
Conversion to string types.
detail::IdType solvAttrType() const
The current SolvAttr type.
bool subEmpty() const
Whether the sub-structure is empty.
Tp asType() const
Templated return type.
bool dip_equal(const detail::CDataiterator &lhs, const detail::CDataiterator &rhs) const
iterator subFind(const SolvAttr &attr_r) const
Iterator pointing to the first occurance of SolvAttr attr_r in sub-structure.
bool asBool() const
This is an overloaded member function, provided for convenience. It differs from the above function o...
iterator & operator=(const iterator &rhs)
std::string asString() const
This is an overloaded member function, provided for convenience. It differs from the above function o...
bool solvAttrCheckSum() const
Whether this is a CheckSum attribute.
void stayInThisRepo()
Stop after all matches in the current Repository are processed.
bool solvAttrSubEntry() const
Whether this is the entry to a sub-structure (flexarray).
iterator subEnd() const
Iterator behind the end of a sub-structure.
IdString idStr() const
As IdString.
void stayInThisSolvable()
Stop after all matches in the current Solvable are processed.
SolvAttr inSolvAttr() const
The current SolvAttr.
void nextSkipSolvable()
On the next call to operator++ advance to the next Solvable.
void nextSkipSolvAttr()
On the next call to operator++ advance to the next SolvAttr.
int asInt() const
Conversion to numeric types.
iterator subBegin() const
Iterator to the begin of a sub-structure.
size_type subSize() const
Ammount of attributes in the sub-structure.
CheckSum asCheckSum() const
As CheckSum.
Solvable inSolvable() const
The current Solvable.
bool solvAttrIdString() const
Whether this string attribute is available as IdString.
detail::IdType dereference() 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.