Go to the documentation of this file.
140 ::dataiterator_prepend_keyname( dip.
get(),
_parent.
id() );
156 friend Impl * rwcowClone<Impl>(
const Impl * rhs );
159 {
return new Impl( *
this ); }
173 : _pimpl( new
Impl( attr_r, loc_r ) )
176 : _pimpl( new
Impl( attr_r, loc_r ) )
180 : _pimpl( new
Impl( attr_r, repo_r, loc_r ) )
183 : _pimpl( new
Impl( attr_r, repo_r, loc_r ) )
187 : _pimpl( new
Impl( attr_r, solv_r ) )
190 : _pimpl( new
Impl( attr_r, solv_r ) )
258 return str <<
"search nothing";
261 str <<
"search " << obj.
attr() <<
" in ";
263 str <<
"search ALL in ";
269 return str <<
"pool";
299 const std::string & mstring_r,
int flags_r )
300 : _dip( new ::Dataiterator )
301 , _mstring( mstring_r )
308 const char * mstring_r,
int flags_r )
309 : _dip( new ::Dataiterator )
310 , _mstring( mstring_r ? mstring_r :
"" )
318 , _mstring( rhs._mstring )
322 _dip = new ::Dataiterator;
323 ::dataiterator_init_clone(
_dip, rhs.
_dip );
324 ::dataiterator_strdup(
_dip );
332 ::dataiterator_free(
_dip );
338 {
return str << obj.
get(); }
361 {
if ( _dip ) ::dataiterator_skip_attribute( _dip.get() ); }
364 {
if ( _dip ) ::dataiterator_skip_solvable( _dip.get() ); }
367 {
if ( _dip ) ::dataiterator_skip_repo( _dip.get() ); }
370 {
if ( _dip ) { _dip.get()->repoid = -1; _dip.get()->flags |= SEARCH_THISSOLVID; } }
373 {
if ( _dip ) { _dip.get()->repoid = -1; } }
384 switch ( solvAttrType() )
386 case REPOKEY_TYPE_U32:
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:
439 enum SubType { ST_NONE,
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_U32:
551 case REPOKEY_TYPE_NUM:
552 case REPOKEY_TYPE_CONSTANT:
567 switch ( solvAttrType() )
569 case REPOKEY_TYPE_U32:
570 case REPOKEY_TYPE_NUM:
571 case REPOKEY_TYPE_CONSTANT:
572 return SOLV_KV_NUM64(&_dip->kv);
587 switch ( solvAttrType() )
589 case REPOKEY_TYPE_ID:
590 case REPOKEY_TYPE_IDARRAY:
591 case REPOKEY_TYPE_CONSTANTID:
592 if ( _dip->data && _dip->data->localpool )
593 return ::stringpool_id2str( &_dip->data->spool, _dip->kv.id );
598 case REPOKEY_TYPE_STR:
602 case REPOKEY_TYPE_DIRSTRARRAY:
604 return( _dip->flags & SEARCH_FILES
606 : ::repodata_dir2str( _dip->data, _dip->kv.id, _dip->kv.str ) );
617 switch ( solvAttrType() )
619 case REPOKEY_TYPE_ID:
620 case REPOKEY_TYPE_IDARRAY:
621 case REPOKEY_TYPE_CONSTANTID:
623 detail::IdType id = ::repodata_globalize_id( _dip->data, _dip->kv.id, 1 );
629 case REPOKEY_TYPE_STR:
630 case REPOKEY_TYPE_DIRSTRARRAY:
632 const char * ret( c_str() );
633 return ret ? ret :
"";
637 case REPOKEY_TYPE_U32:
638 case REPOKEY_TYPE_NUM:
639 case REPOKEY_TYPE_CONSTANT:
643 case REPOKEY_TYPE_MD5:
644 case REPOKEY_TYPE_SHA1:
645 case REPOKEY_TYPE_SHA256:
647 return asCheckSum().asString();
651 case REPOKEY_TYPE_FLEXARRAY:
653 std::ostringstream
str;
655 for_( it, subBegin(), subEnd() )
657 str <<
" " << it.inSolvAttr() <<
" = " << it.asString() << endl;
665 return std::string();
672 switch ( solvAttrType() )
674 case REPOKEY_TYPE_ID:
675 case REPOKEY_TYPE_IDARRAY:
676 case REPOKEY_TYPE_CONSTANTID:
677 return IdString( ::repodata_globalize_id( _dip->data, _dip->kv.id, 1 ) );
688 switch ( solvAttrType() )
690 case REPOKEY_TYPE_MD5:
691 return CheckSum::md5( ::repodata_chk2str( _dip->data, solvAttrType(), (
unsigned char *)_dip->kv.str ) );
694 case REPOKEY_TYPE_SHA1:
695 return CheckSum::sha1( ::repodata_chk2str( _dip->data, solvAttrType(), (
unsigned char *)_dip->kv.str ) );
698 case REPOKEY_TYPE_SHA224:
699 return CheckSum::sha224( ::repodata_chk2str( _dip->data, solvAttrType(), (
unsigned char *)_dip->kv.str ) );
702 case REPOKEY_TYPE_SHA256:
703 return CheckSum::sha256( ::repodata_chk2str( _dip->data, solvAttrType(), (
unsigned char *)_dip->kv.str ) );
706 case REPOKEY_TYPE_SHA384:
707 return CheckSum::sha384( ::repodata_chk2str( _dip->data, solvAttrType(), (
unsigned char *)_dip->kv.str ) );
710 case REPOKEY_TYPE_SHA512:
711 return CheckSum::sha512( ::repodata_chk2str( _dip->data, solvAttrType(), (
unsigned char *)_dip->kv.str ) );
723 : iterator_adaptor_( 0 )
727 : iterator_adaptor_( 0 )
734 : iterator_adaptor_( 0 )
749 base_reference() = _dip.
get();
760 return( lhs.solvid == rhs.solvid && lhs.key->name == rhs.key->name );
765 return _dip ? ::repodata_globalize_id( _dip->data, _dip->kv.id, 1 )
773 if ( ! ::dataiterator_step( _dip.get() ) )
776 base_reference() = 0;
780 ::dataiterator_strdup( _dip.get() );
789 return str <<
"EndOfQuery";
801 template<>
CheckSum LookupAttr::iterator::asType<CheckSum>()
const
802 {
return asCheckSum(); }
813 str <<
"detail::CDataiterator(";
824 str <<
"|" << obj->repodataid;
825 str <<
"|" << obj->repoid;
const StrMatcher & strMatcher() const
The pattern to match.
static Pool instance()
Singleton ctor.
void setParent(SolvAttr attr_r)
Set search within a sub-structure (SolvAttr::noAttr for none)
std::string asString() const
This is an overloaded member function, provided for convenience. It differs from the above function o...
static const SolvAttr allAttr
Value to request searching all Attributes (0).
::_Repo * RepoIdType
Id type to connect Repo and sat-repo.
Impl(SolvAttr attr_r, Repository repo_r, Location loc_r)
A Solvable object within the sat Pool.
IdType id() const
Expert backdoor.
Solvable solvable() const
Whether to search in one Solvable.
bool empty() const
Whether the query is empty.
static CheckSum sha256(const std::string &checksum)
Wrapper around sat detail::CDataiterator.
LookupAttr::iterator begin() const
String matching (STRING|SUBSTRING|GLOB|REGEX).
const char * c_str() const
Conversion to const char *
int get() const
Return the integer representation.
static const IdType noId(0)
Impl(SolvAttr attr_r, Location loc_r)
std::ostream & dumpRange(std::ostream &str, TIterator begin, TIterator end, const std::string &intro="{", const std::string &pfx="\n ", const std::string &sep="\n ", const std::string &sfx="\n", const std::string &extro="}")
Print range defined by iterators (multiline style).
iterator subFind(SolvAttr attr_r) const
Iterator pointing to the first occurance of SolvAttr attr_r in sub-structure.
CheckSum asCheckSum() const
As CheckSum.
iterator begin() const
Iterator to the begin of query results.
void setPool(Location loc_r)
void stayInThisSolvable()
Stop after all matches in the current Solvable are processed.
Solvable inSolvable() const
The current Solvable.
Repository repo() const
Whether to search in one Repository.
size_type subSize() const
Ammount of attributes in the sub-structure.
void nextSkipSolvable()
On the next call to operator++ advance to the next Solvable.
std::ostream & operator<<(std::ostream &str, const DIWrap &obj)
LookupAttr implememtation.
int asInt() const
Conversion to numeric types.
detail::CDataiterator * get() const
Expert backdoor.
Location
Specify the where to look for the attribule.
::_Dataiterator CDataiterator
Wrapped libsolv C data type exposed as backdoor.
void setRepo(Repository repo_r)
Set search in one Repository.
unsigned asUnsigned() const
This is an overloaded member function, provided for convenience. It differs from the above function o...
detail::CDataiterator * get() const
static const RepoIdType noRepoId(0)
Id to denote Repo::noRepository.
static CheckSum sha384(const std::string &checksum)
Repository repository() const
The Repository this Solvable belongs to.
bool solvAttrIdString() const
Whether this string attribute is available as IdString.
SolvAttr parent() const
Whether to search within a sub-structure (SolvAttr::noAttr if not)
void nextSkipRepo()
On the next call to operator++ advance to the next Repository.
std::ostream & dumpOn(std::ostream &str, const LocaleSupport &obj)
std::string asString() const
Conversion to std::string
static const Solvable noSolvable
Represents no Solvable.
static CheckSum sha1(const std::string &checksum)
Access to the sat-pools string space.
void setSolvable(Solvable solv_r)
Set search in one Solvable.
static CheckSum sha512(const std::string &checksum)
void setSolvable(Solvable solv_r)
bool pool() const
Whether to search in Pool.
bool subEmpty() const
Whether the sub-structure is empty.
bool dip_equal(const detail::CDataiterator &lhs, const detail::CDataiterator &rhs) const
SolvAttr attr() const
The SolvAttr to search.
unsigned SolvableIdType
Id type to connect Solvable and sat-solvable.
unsigned long long asUnsignedLL() const
This is an overloaded member function, provided for convenience. It differs from the above function o...
static const SolvableIdType noSolvableId(0)
Id to denote Solvable::noSolvable.
iterator subEnd() const
Iterator behind the end of a sub-structure.
detail::CDataiterator * _dip
std::ostream & operator<<(std::ostream &str, const LookupAttr &obj)
IdType id() const
Expert backdoor.
Impl(SolvAttr attr_r, Solvable solv_r)
Repository inRepo() const
The current Repository.
int IdType
Generic Id type.
std::ostream & operator<<(std::ostream &str, const FileConflicts &obj)
IdString idStr() const
As IdStr.
bool solvAttrCheckSum() const
Whether this is a CheckSum attribute.
Easy-to use interface to the ZYPP dependency resolver.
const char * c_str() const
Conversion to string types.
std::string numstring(char n, int w=0)
LookupAttr()
Default ctor finds nothing.
void setRepo(Repository repo_r, Location loc_r)
Convenience char* constructible from std::string and char*, it maps (char*)0 to an empty string.
const std::string & searchstring() const
The current searchstring.
bool solvAttrSubEntry() const
Whether this is the entry to a sub-structure (flexarray).
void setStrMatcher(const StrMatcher &matcher_r)
RWCOW_pointer< Impl > _pimpl
void setRepo(Repository repo_r, Location=SOLV_ATTR)
Set search in one Repository.
LookupAttr::iterator end() const
static const Repository noRepository
Represents no Repository.
void stayInThisRepo()
Stop after all matches in the current Repository are processed.
iterator subBegin() const
Iterator to the begin of a sub-structure.
std::string asString(const DefaultIntegral< Tp, TInitial > &obj)
bool solvAttrNumeric() const
Whether this is a numeric attribute (incl.
static const SolvAttr noAttr
Value representing noAttr ("")
std::ostream & operator<<(std::ostream &str, const Exception &obj)
#define for_(IT, BEG, END)
Convenient for-loops using iterator.
bool solvAttrString() const
Whether this is a string attribute.
LookupRepoAttr()
Default ctor finds nothing.
detail::IdType dereference() const
void compile() const
Compile the pattern e.g.
void setParent(SolvAttr attr_r)
detail::IdType solvAttrType() const
The current SolvAttr type.
static CheckSum md5(const std::string &checksum)
iterator & operator=(const iterator &rhs)
iterator end() const
Iterator behind the end of query results.
void nextSkipSolvAttr()
On the next call to operator++ advance to the next SolvAttr.
void setAttr(SolvAttr attr_r)
Set the SolvAttr to search.
String related utilities and Regular expression matching.
DIWrap()
NULL detail::CDataiterator
bool asBool() const
This is an overloaded member function, provided for convenience. It differs from the above function o...
size_type size() const
Ammount of results.
const StrMatcher & strMatcher() const
Solvable solvable() const
static CheckSum sha224(const std::string &checksum)
void setPool(Location=SOLV_ATTR)
Set search in Pool (all repositories).
Impl * clone() const
clone for RWCOW_pointer
void setStrMatcher(const StrMatcher &matcher_r)
Set the pattern to match.
Lightweight attribute value lookup.
const Match & flags() const
The current search flags.
SolvAttr inSolvAttr() const
The current SolvAttr.
@ REPO_ATTR
Search for repository attributes.
SolvAttr parent() const
Return the parent of well know sub-structure attributes (SolvAttr::noAttr if none).
void setAttr(SolvAttr attr_r)
std::string asString() const
This is an overloaded member function, provided for convenience. It differs from the above function o...