12#ifndef ZYPP_SAT_LOOKUPATTR_H
13#define ZYPP_SAT_LOOKUPATTR_H
19#include <zypp-core/base/DefaultIntegral>
30 struct MatchException;
167 template<class TResult, class TAttr = TResult>
307 std::string mstring_r = std::string(),
int flags_r = 0 );
310 const char * mstring_r,
int flags_r = 0 );
318 std::swap( _dip, rhs._dip );
319 std::swap( _mstring, rhs._mstring );
338 const std::string &
getstr()
const {
return _mstring; }
358 , detail::CDataiterator *
360 , boost::forward_traversal_tag
368 void nextSkipSolvAttr();
371 void nextSkipSolvable();
378 { nextSkipSolvAttr(); increment(); }
382 { nextSkipSolvable(); increment(); }
386 { nextSkipRepo(); increment(); }
389 void stayInThisSolvable();
392 void stayInThisRepo();
417 bool solvAttrNumeric()
const;
420 bool solvAttrString()
const;
423 bool solvAttrIdString()
const;
426 bool solvAttrCheckSum()
const;
432 bool solvAttrSubEntry()
const;
466 bool subEmpty()
const;
501 unsigned asUnsigned()
const;
505 unsigned long long asUnsignedLL()
const;
508 const char * c_str()
const;
513 std::string asString()
const;
523 {
return idStr().id(); }
534 template<
class Tp> Tp
asType()
const {
return Tp(
id()); }
557 friend class boost::iterator_core_access;
559 template <
class OtherDerived,
class OtherIterator,
class V,
class C,
class R,
class D>
560 bool equal(
const boost::iterator_adaptor<OtherDerived, OtherIterator, V, C, R, D> & rhs )
const
562 return (
bool(base()) ==
bool(rhs.base()) )
563 && ( ! base() || dip_equal( *base(), *rhs.base() ) );
575 {
return _dip.get(); }
593 template<>
inline std::string LookupAttr::iterator::asType<std::string>()
const {
return asString(); }
597 template<
class TResult,
class TAttr>
613{
return str << &obj; }
std::ostream & operator<<(std::ostream &str, const zypp::sat::detail::CDataiterator *obj)
Convenience char* constructible from std::string and char*, it maps (char*)0 to an empty string.
Access to the sat-pools string space.
String matching (STRING|SUBSTRING|GLOB|REGEX).
LookupAttr implememtation.
detail::CDataiterator * get() const
Expert backdoor.
detail::IdType id() const
Tp asType() const
Templated return type.
bool equal(const boost::iterator_adaptor< OtherDerived, OtherIterator, V, C, R, D > &rhs) const
void skipSolvable()
Immediately advance to the next Solvable.
bool atEnd() const
Whether this points to the end of a query (Iterator is invalid).
void skipSolvAttr()
Immediately advance to the next SolvAttr.
void skipRepo()
Immediately advance to the next Repository.
Lightweight attribute value lookup.
void resetStrMatcher()
Reset the pattern to match.
iterator end() const
Iterator behind the end of query results.
RWCOW_pointer< Impl > _pimpl
const StrMatcher & strMatcher() const
The pattern to match.
std::ostream & dumpOn(std::ostream &str, const LookupAttr &obj)
Verbose stream output including the query result.
bool empty() const
Whether the query is empty.
LookupAttr(LookupAttr &&) noexcept=default
Location
Specify the where to look for the attribule.
@ REPO_ATTR
Search for repository attributes.
@ SOLV_ATTR
Search for solvable attributes (default)
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.
LookupAttr(const LookupAttr &)=default
void setSolvable(Solvable solv_r)
Set search in one Solvable.
Solvable solvable() const
Whether to search in one Solvable.
std::ostream & operator<<(std::ostream &str, const LookupAttr &obj)
Stream output.
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)
Lightweight repository attribute value lookup.
LookupRepoAttr(SolvAttr attr_r)
LookupRepoAttr()
Default ctor finds nothing.
void setPool()
Set search in Pool (all repositories).
A Solvable object within the sat Pool.
Wrapper around sat detail::CDataiterator.
void swap(DIWrap &rhs) noexcept
detail::CDataiterator * get() const
DIWrap & operator=(const DIWrap &rhs)
detail::CDataiterator * operator->() const
const std::string & getstr() const
DIWrap()
NULL detail::CDataiterator
detail::CDataiterator * _dip
String related utilities and Regular expression matching.
unsigned int SolvableIdType
Id type to connect Solvable and sat-solvable.
int IdType
Generic Id type.
::s_Dataiterator CDataiterator
Wrapped libsolv C data type exposed as backdoor.
CRepo * RepoIdType
Id type to connect Repo and sat-repo.
SolvableSpec & operator=(const SolvableSpec &)=default
Easy-to use interface to the ZYPP dependency resolver.
std::ostream & operator<<(std::ostream &str, const SerialNumber &obj)
std::string asString(const Patch::Category &obj)
Exceptions thrown from attribute matching.
RW_pointer supporting 'copy on write' functionality.