28 #undef ZYPP_BASE_LOGGER_LOGGROUP 29 #define ZYPP_BASE_LOGGER_LOGGROUP "PoolQuery" 46 bool isDependencyAttribute( sat::SolvAttr attr_r )
48 static sat::SolvAttr deps[] = {
55 SolvAttr::supplements,
68 struct EditionRangePredicate
70 EditionRangePredicate(
const Rel & op,
const Edition & edition )
74 EditionRangePredicate(
const Rel & op,
const Edition & edition,
const Arch & arch )
79 bool operator()( sat::LookupAttr::iterator iter_r )
81 if ( !
_arch.empty() && iter_r.inSolvable().arch() !=
_arch )
84 CapDetail cap( iter_r.id() );
85 if ( ! cap.isSimple() )
89 return overlaps( Edition::MatchRange( cap.op(), cap.ed() ),
_range );
92 std::string serialize()
const 94 std::string ret(
"EditionRange" );
106 struct SolvableRangePredicate
108 SolvableRangePredicate(
const Rel & op,
const Edition & edition )
113 SolvableRangePredicate(
const Rel & op,
const Edition & edition,
const Arch & arch )
118 bool operator()( sat::LookupAttr::iterator iter_r )
120 if ( !
_arch.empty() && iter_r.inSolvable().arch() !=
_arch )
122 return overlaps( Edition::MatchRange( Rel::EQ, iter_r.inSolvable().edition() ),
_range );
125 std::string serialize()
const 127 std::string ret(
"SolvableRange" );
134 Edition::MatchRange
_range;
142 struct CapabilityMatchPredicate
144 CapabilityMatchPredicate( Capability cap_r )
148 bool operator()( sat::LookupAttr::iterator iter_r )
const 150 return _cap.matches( iter_r.asType<Capability>() ) == CapMatch::yes;
153 std::string serialize()
const 155 std::string ret(
"CapabilityMatch" );
193 typedef function<bool(sat::LookupAttr::iterator)> Predicate;
195 static bool always( sat::LookupAttr::iterator ) {
return true; }
196 static bool never( sat::LookupAttr::iterator ) {
return false; }
201 AttrMatchData( sat::SolvAttr attr_r )
205 AttrMatchData( sat::SolvAttr attr_r,
const StrMatcher & strMatcher_r )
210 AttrMatchData( sat::SolvAttr attr_r,
const StrMatcher & strMatcher_r,
211 const Predicate & predicate_r,
const std::string & predicateStr_r )
223 template<
class TPredicate>
224 void addPredicate(
const TPredicate & predicate_r )
235 std::string serialize()
const 237 std::string ret(
"AttrMatchData" );
248 static AttrMatchData
deserialize(
const std::string & str_r )
250 std::vector<std::string> words;
252 if ( words.empty() || words[0] !=
"AttrMatchData" )
253 ZYPP_THROW( Exception( str::Str() <<
"Expecting AttrMatchData: " << str_r ) );
254 if ( words.size() != 5 )
255 ZYPP_THROW( Exception( str::Str() <<
"Wrong number of words: " << str_r ) );
258 ret.attr = sat::SolvAttr( words[1] );
259 ret.strMatcher = StrMatcher( words[2] );
260 if ( Match::Mode mode = deserializeMode( words[3] ) )
261 ret.strMatcher.setFlags( mode );
262 ret.predicateStr = words[4];
267 if ( ! words.empty() )
269 if ( words[0] ==
"EditionRange" )
271 switch( words.size() )
274 ret.predicate = EditionRangePredicate( Rel(words[1]), Edition(words[2]) );
277 ret.predicate = EditionRangePredicate( Rel(words[1]), Edition(words[2]), Arch(words[3]) );
280 ZYPP_THROW( Exception( str::Str() <<
"Wrong number of words: " << str_r ) );
284 else if ( words[0] ==
"SolvableRange" )
286 switch( words.size() )
289 ret.predicate = SolvableRangePredicate( Rel(words[1]), Edition(words[2]) );
292 ret.predicate = SolvableRangePredicate( Rel(words[1]), Edition(words[2]), Arch(words[3]) );
295 ZYPP_THROW( Exception( str::Str() <<
"Wrong number of words: " << str_r ) );
299 else if ( words[0] ==
"CapabilityMatch" )
301 if ( words.size() != 2 )
302 ZYPP_THROW( Exception( str::Str() <<
"Wrong number of words: " << str_r ) );
303 ret.predicate = CapabilityMatchPredicate( Capability(words[1]) );
306 ZYPP_THROW( Exception( str::Str() <<
"Unknown predicate: " << str_r ) );
319 static std::string serializeMode( Match::Mode mode_r )
326 #define OUTS(M,S) case Match::M: return #S; break 331 OUTS( STRINGSTART, S );
332 OUTS( STRINGEND, E );
333 OUTS( SUBSTRING, B );
345 static Match::Mode deserializeMode(
const std::string & str_r )
349 #define OUTS(M,C) case *#C: return Match::M; break 354 OUTS( STRINGSTART, S );
355 OUTS( STRINGEND, E );
356 OUTS( SUBSTRING, B );
364 return Match::NOTHING;
369 inline std::ostream &
operator<<( std::ostream &
str,
const AttrMatchData & obj )
371 str << obj.attr <<
": " << obj.strMatcher;
372 if ( obj.kindPredicate )
373 str <<
" +(" << obj.kindPredicate <<
")";
375 str <<
" +(" << obj.predicateStr <<
")";
380 inline bool operator==(
const AttrMatchData & lhs,
const AttrMatchData & rhs )
382 return ( lhs.attr == rhs.attr
383 && lhs.strMatcher == rhs.strMatcher
384 && lhs.predicateStr == rhs.predicateStr );
388 inline bool operator!=(
const AttrMatchData & lhs,
const AttrMatchData & rhs )
389 {
return !( lhs == rhs ); }
392 inline bool operator<(
const AttrMatchData & lhs,
const AttrMatchData & rhs )
394 if ( lhs.attr != rhs.attr )
395 return ( lhs.attr < rhs.attr );
396 if ( lhs.strMatcher != rhs.strMatcher )
397 return ( lhs.strMatcher < rhs.strMatcher );
398 if ( lhs.predicateStr != rhs.predicateStr )
399 return ( lhs.predicateStr < rhs.predicateStr );
403 typedef std::list<AttrMatchData> AttrMatchList;
421 , _require_all(false)
465 #define OUTS(A) if ( A != rhs.A ) return A < rhs.A; 468 OUTS( _uncompiledPredicated );
471 OUTS( _require_all );
472 OUTS( _status_flags );
492 && _attrs.size() == 1
493 && _attrs.begin()->first == sat::SolvAttr::name ) )
504 && _kinds == rhs.
_kinds );
517 void compile()
const;
527 friend Impl * rwcowClone<Impl>(
const Impl * rhs );
530 {
return new Impl( *
this ); }
557 void PoolQuery::Impl::compile()
const 559 _attrMatchList.clear();
561 Match cflags( _flags );
562 if ( cflags.
mode() == Match::OTHER )
587 else if (_attrs.size() == 1)
592 rcstrings = createRegex(joined, cflags);
593 if (joined.size() > 1)
595 _attrMatchList.push_back( AttrMatchData( _attrs.begin()->first,
603 bool attrvals_empty =
true;
604 for (AttrRawStrMap::const_iterator ai = _attrs.begin(); ai != _attrs.end(); ++ai)
605 if (!ai->second.empty())
606 for(StrContainer::const_iterator it = ai->second.begin();
607 it != ai->second.end(); it++)
610 attrvals_empty =
false;
611 goto attremptycheckend;
616 bool attrvals_thesame =
true;
617 AttrRawStrMap::const_iterator ai = _attrs.begin();
620 for (; ai != _attrs.end(); ++ai)
624 set1.begin(), set1.end(),
625 ai->second.begin(), ai->second.end(),
626 inserter(result, result.begin()));
629 attrvals_thesame =
false;
638 if (attrvals_empty || attrvals_thesame)
644 rcstrings = createRegex(joined, cflags);
650 rcstrings = createRegex(joined, cflags);
652 if (joined.size() > 1)
656 for_( ai, _attrs.begin(), _attrs.end() )
658 _attrMatchList.push_back( AttrMatchData( ai->first, matcher ) );
668 for_(ai, _attrs.begin(), _attrs.end())
673 string s = createRegex(joined, cflags);
674 if (joined.size() > 1)
676 _attrMatchList.push_back( AttrMatchData( ai->first,
683 if ( ! _uncompiledPredicated.empty() )
687 for_( it, _uncompiledPredicated.begin(), _uncompiledPredicated.end() )
689 if ( it->strMatcher.flags().mode() == Match::OTHER )
693 const std::string & mstr( it->strMatcher.searchstring() );
694 if ( ! mstr.empty() )
695 joined.insert( mstr );
698 rcstrings = createRegex( joined, cflags );
699 if ( joined.size() > 1 )
703 AttrMatchData nattr( *it );
704 nattr.strMatcher =
StrMatcher( rcstrings, cflags ),
705 _attrMatchList.push_back( std::move(nattr) );
710 _attrMatchList.push_back( *it );
716 if ( _attrMatchList.empty() )
719 rcstrings = createRegex( _strings, cflags );
720 if ( _strings.size() > 1 )
722 _attrMatchList.push_back( AttrMatchData( sat::SolvAttr::allAttr,
727 for_( it, _attrMatchList.begin(), _attrMatchList.end() )
729 it->strMatcher.compile();
740 string regexed = str;
747 for (pos = 0; (pos = regexed.find(
"*", pos)) != std::string::npos; pos+=2)
748 regexed = regexed.replace(pos, 1, r_all);
751 for (pos = 0; (pos = regexed.find(
'?', pos)) != std::string::npos; ++pos)
752 regexed = regexed.replace(pos, 1, r_one);
757 string PoolQuery::Impl::createRegex(
const StrContainer & container,
const Match & flags )
const 760 #define WB (_match_word ? string("\\b") : string()) 763 if (container.empty())
766 if (container.size() == 1)
768 return WB + *container.begin() +
WB;
774 StrContainer::const_iterator it = container.begin();
785 tmp +=
".*" +
WB + tmp;
786 rstr =
"(?=" + tmp +
")";
792 rstr +=
WB +
"(" + tmp;
797 for (; it != container.end(); ++it)
807 tmp +=
".*" +
WB + tmp;
808 rstr +=
"(?=" + tmp +
")";
837 if ( _kinds.empty() )
841 for(Kinds::const_iterator it = _kinds.begin();
842 it != _kinds.end(); ++it)
848 if ( _repos.empty() )
852 for(StrContainer::const_iterator it = _repos.begin();
853 it != _repos.end(); ++it)
858 o <<
"version: "<< _op <<
" " << _edition.asString() << endl;
859 o <<
"status: " << ( _status_flags ? ( _status_flags == INSTALLED_ONLY ?
"INSTALLED_ONLY" :
"UNINSTALLED_ONLY" )
862 o <<
"string match flags: " <<
Match(_flags) << endl;
866 for(StrContainer::const_iterator it = _strings.begin();
867 it != _strings.end(); ++it)
871 o <<
"attributes: " << endl;
872 for(AttrRawStrMap::const_iterator ai = _attrs.begin(); ai != _attrs.end(); ++ai)
874 o <<
"* " << ai->first <<
": ";
875 for(StrContainer::const_iterator vi = ai->second.begin();
876 vi != ai->second.end(); ++vi)
881 o <<
"predicated: " << endl;
882 for_( it, _uncompiledPredicated.begin(), _uncompiledPredicated.end() )
884 o <<
"* " << *it << endl;
888 o <<
"last attribute matcher compiled: " << endl;
889 if ( _attrMatchList.empty() )
891 o <<
"not yet compiled" << endl;
895 for_( it, _attrMatchList.begin(), _attrMatchList.end() )
897 o <<
"* " << *it << endl;
911 PoolQuery::PoolQuery()
920 if (repoalias.empty())
922 WAR <<
"ignoring an empty repository alias" << endl;
971 AttrMatchData attrMatchData( attr );
973 attrMatchData.strMatcher =
StrMatcher( name, mode );
977 attrMatchData.strMatcher =
StrMatcher( strchr( name.c_str(),
':')+1, mode );
978 attrMatchData.kindPredicate = explicitKind;
981 if ( isDependencyAttribute( attr ) )
982 attrMatchData.addPredicate( EditionRangePredicate( op, edition, arch ) );
984 attrMatchData.addPredicate( SolvableRangePredicate( op, edition, arch ) );
998 if ( isDependencyAttribute( attr ) )
999 attrMatchData.addPredicate( CapabilityMatchPredicate( cap_r ) );
1001 attrMatchData.addPredicate( SolvableRangePredicate( cap.
op(), cap.
ed() ) );
1052 AttrRawStrMap::const_iterator it =
_pimpl->
_attrs.find(attr);
1053 return it !=
_pimpl->
_attrs.end() ? it->second : nocontainer;
1208 bool finded_something =
false;
1216 if ((!s.empty()) && s[0]==
'#')
1222 if (s.empty() || pos == s.npos)
1224 if (finded_something)
1234 finded_something =
true;
1236 string attrName(
str::trim(
string(s,0,pos)));
1237 string attrValue(
str::trim(
string(s,pos+1,s.npos)));
1251 || attribute==
"global_string")
1256 || attribute==
"string_type" )
1279 else if ( s == StringTypeAttr::noAttr )
1281 WAR <<
"unknown string type " << attrValue << endl;
1285 WAR <<
"forget recover some attribute defined as String type attribute: " << attrValue << endl;
1300 WAR <<
"unknown boolean value " << attrValue << endl;
1315 WAR <<
"unknown boolean value " << attrValue << endl;
1320 if( attrValue ==
"all" )
1324 else if( attrValue ==
"installed" )
1328 else if( attrValue ==
"not-installed" )
1334 WAR <<
"Unknown value for install status " << attrValue << endl;
1341 if (attrValue.find_first_of(
"=<>!") == 0)
1343 pos = attrValue.find_last_of(
"=<>");
1344 rel =
Rel(attrValue.substr(0, pos+1));
1345 attrValue =
str::trim(attrValue.substr(pos+1, attrValue.npos));
1362 else if ( attribute==PoolQueryAttr::noAttr )
1364 WAR <<
"empty attribute name" << endl;
1368 string s = attrName;
1371 if ( a == SolvAttr::name || isDependencyAttribute( a ) )
1386 return finded_something;
1398 str <<
"repo: " << *it << delim ;
1404 << it->idStr() << delim ;
1419 <<
": substring" << delim;
1434 str <<
"case_sensitive: ";
1437 str <<
"on" << delim;
1441 str <<
"off" << delim;
1447 str <<
"require_all: ";
1450 str <<
"on" << delim;
1454 str <<
"off" << delim;
1463 str <<
"install_status: all" << delim;
1466 str <<
"install_status: installed" << delim;
1469 str <<
"install_status: not-installed" << delim;
1481 string s = it->first.asString();
1483 for_( it2,it->second.begin(),it->second.end() )
1485 str << s <<
": "<< *it2 << delim;
1489 for_( it,
_pimpl->_uncompiledPredicated.begin(),
_pimpl->_uncompiledPredicated.end() )
1491 str <<
"complex: "<< it->serialize() << delim;
1499 {
return _pimpl->asString(); }
1543 const base_iterator &
end()
const 1545 static base_iterator _end;
1551 if ( base_r ==
end() )
1552 base_r = startNewQyery();
1559 while ( base_r !=
end() )
1561 if ( isAMatch( base_r ) )
1572 void matchDetail(
const base_iterator & base_r, std::vector<base_iterator> & return_r )
const 1574 if ( base_r ==
end() )
1579 if ( _attrMatchList.size() == 1 )
1584 base_iterator base( base_r );
1586 return_r.push_back( base );
1588 const AttrMatchData::Predicate &
predicate( _attrMatchList.front().predicate );
1589 for ( ++base; base.
inSolvable() == inSolvable; ++base )
1592 return_r.push_back( base );
1598 for_( mi, _attrMatchList.begin(), _attrMatchList.end() )
1600 const AttrMatchData & matchData( *mi );
1602 if ( matchData.strMatcher )
1608 const AttrMatchData::Predicate &
predicate( matchData.predicate );
1612 return_r.push_back( it );
1630 for_( it, query_r->_repos.begin(), query_r->_repos.end() )
1636 _neverMatchRepo =
true;
1640 if ( _neverMatchRepo && ! _repos.empty() )
1641 _neverMatchRepo =
false;
1644 _kinds = query_r->_kinds;
1647 _edition = query_r->_edition;
1649 _status_flags = query_r->_status_flags;
1651 _attrMatchList = query_r->_attrMatchList;
1663 if ( _neverMatchRepo )
1667 if ( _repos.size() == 1 )
1672 if ( _attrMatchList.size() == 1 )
1674 const AttrMatchData & matchData( _attrMatchList.front() );
1676 if ( matchData.strMatcher )
1711 if ( _repos.size() > 1 && _repos.find( inRepo ) == _repos.end() )
1728 bool globalKindOk =( _kinds.empty() || inSolvable.isKind( _kinds.begin(), _kinds.end() ) );
1733 if ( _attrMatchList.size() == 1 )
1737 const AttrMatchData & matchData( _attrMatchList.front() );
1739 if ( matchData.kindPredicate )
1741 if ( matchData.kindPredicate != inSolvable.kind() )
1747 else if ( !globalKindOk )
1750 if ( !matchData.predicate || matchData.predicate( base_r ) )
1757 for_( mi, _attrMatchList.begin(), _attrMatchList.end() )
1759 const AttrMatchData & matchData( *mi );
1761 if ( matchData.kindPredicate )
1763 if ( matchData.kindPredicate != inSolvable.kind() )
1766 else if ( !globalKindOk )
1770 if ( matchData.strMatcher )
1776 const AttrMatchData::Predicate &
predicate( matchData.predicate );
1809 void PoolQueryIterator::increment()
1818 if ( ! _matcher->advance( base_reference() ) )
1834 _matches.reset(
new Matches );
1835 _matcher->matchDetail( base_reference(), *_matches );
1842 if ( ! obj.matchesEmpty() )
1844 for_( it, obj.matchesBegin(), obj.matchesEnd() )
1846 str << endl <<
" " << it->inSolvAttr() <<
"\t" << it->asString();
const Rel editionRel() const
unsigned splitEscaped(const C_Str &line_r, TOutputIterator result_r, const C_Str &sepchars_r=" \t", bool withEmpty=false)
Split line_r into words with respect to escape delimeters.
int _status_flags
Installed status filter flags.
static const PoolQueryAttr installStatusAttr
Rel _op
Operator for edition condition.
void appendEscaped(std::string &str_r, const C_Str &next_r, const char sep_r= ' ')
Escape next_r and append it to str_r using separator sep_r.
A Solvable object within the sat Pool.
void setUninstalledOnly()
Return only packages from repos other than .
StatusFilter
Installed status filter setters.
static const StringTypeAttr substringAttr
bool compareByRel(Rel op, const Tp &lhs, const Tp &rhs, TCompare compare)
Comparison of two elements using relational operator op.
bool advance(base_iterator &base_r) const
void addAttribute(const sat::SolvAttr &attr, const std::string &value="")
Filter by the value of the specified attr attribute.
void setAttr(SolvAttr attr_r)
Set the SolvAttr to search.
std::set< ResKind > Kinds
std::string asString(const DefaultIntegral< Tp, TInitial > &obj)
#define ZYPP_THROW(EXCPT)
Drops a logline and throws the Exception.
String matching option flags as used e.g.
static const SolvAttr allAttr
Value to request searching all Attributes (0).
std::set< ResKind > _kinds
Resolvable kinds to include.
Helper providing more detailed information about a Capability.
PoolQuery::StrContainer & _cont
bool operator==(const PoolQuery::Impl &rhs) const
const StrContainer & strings() const
Search strings added via addString()
static const StringTypeAttr noAttr
const StrContainer & attribute(const sat::SolvAttr &attr) const
static ResKind explicitBuiltin(const char *str_r)
Return the builtin kind if str_r explicitly prefixed.
PoolQuery iterator as returned by PoolQuery::begin.
void setFlags(const Match &flags)
Free function to set libsolv repo search flags.
String matching (STRING|SUBSTRING|GLOB|REGEX).
static const PoolQueryAttr caseSensitiveAttr
void execute(ProcessResolvable fnc)
Executes the query with the current settings.
void addString(const std::string &value)
Add a global query string.
bool filesMatchFullPath() const
Whether searching in filelists looks at the full path or just at the basenames.
bool operator==(const PoolQuery &b) const
Lightweight attribute value lookup.
std::ostream & operator<<(std::ostream &str, const PoolQuery &obj)
const Edition edition() const
bool operator()(const string &str)
void setMatchGlob()
Set to match globs.
void setMatchRegex()
Set to use the query strings as regexes.
const Arch Arch_empty(IdString::Empty)
bool recover(std::istream &str, char delim= '\n')
Reads from stream query.
String related utilities and Regular expression matching.
bool operator!=(const PoolQuery::Impl &rhs) const
PoolQueryMatcher(const shared_ptr< const PoolQuery::Impl > &query_r)
Ctor stores the PoolQuery settings.
void addDependency(const sat::SolvAttr &attr, const std::string &name, const Rel &op, const Edition &edition)
Query "name|global op edition".
void setModeGlob()
Set the mode GLOB.
Access to the sat-pools string space.
void setCaseSensitive(bool value=true)
Turn case sentitivity on or off (unsets or sets SEARCH_NOCASE flag).
Match _flags
Sat solver search flags.
void addKind(const ResKind &kind)
Filter by selectable kind.
#define for_(IT, BEG, END)
Convenient for-loops using iterator.
Edition represents [epoch:]version[-release]
Store PoolQuery settings and assist PoolQueryIterator.
Edition _edition
Edition condition operand.
bool caseSensitive() const
returns true if search is case sensitive
bool operator==(const SetRelation::Enum &lhs, const SetCompare &rhs)
void setModeSubstring()
Set the mode SUBSTRING.
bool empty() const
Test for an empty Arch (this is Arch_epmty, not Arch_noarch ).
Base class for creating IdString based types.
PoolQueryAttr(const std::string &str_r)
const StrContainer & repos() const
std::string asString() const
Conversion to std::string
constPtrType getPtr() const
std::string & replaceAll(std::string &str_r, const std::string &from_r, const std::string &to_r)
Replace all occurrences of from_r with to_r in str_r (inplace).
static const PoolQueryAttr noAttr
bool requireAll() const
Whether all values added via addString() or addAttribute() are required to match the values of the re...
bool overlaps(Rel lhs, Rel rhs, int cmp)
Compute Range overlaps.
static const PoolQueryAttr repoAttr
std::vector< sat::LookupAttr::iterator > Matches
AttrMatchList _attrMatchList
StrMatcher per attribtue.
void turn(const Match &rhs, bool onoff)
Depending on the value of onoff, set or unset flags.
Edition::MatchRange _range
Match::Mode matchMode() const
Returns string matching mode as enum.
std::string getline(std::istream &str)
Read one line from stream.
StringTypeAttr(const char *cstr_r)
static Pool instance()
Singleton ctor.
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).
std::set< std::string > StrContainer
iterator end() const
Iterator behind the end of query results.
bool isModeGlob() const
Whether this has mode GLOB.
void setRepo(Repository repo_r, Location=SOLV_ATTR)
Set search in one Repository.
void setStatusFilterFlags(StatusFilter flags)
Set status filter directly.
void matchDetail(const base_iterator &base_r, std::vector< base_iterator > &return_r) const
Provide all matching attributes within this solvable.
std::string trim(const std::string &s, const Trim trim_r)
std::string asString() const
void addRepo(const std::string &repoalias)
Filter by repo.
static string wildcards2regex(const string &str)
Converts '*' and '?' wildcards within str into their regex equivalents.
const AttrRawStrMap & attributes() const
Map (map<SolvAttr, StrContainer>) of attribute values added via addAttribute(), addDep in string form...
void setModeRegex()
Set the mode REGEX.
Solvable inSolvable() const
The current Solvable.
void setMatchWord()
Set to match words (uses regex)
void stayInThisSolvable()
Stop after all matches in the current Solvable are processed.
std::ostream & dumpOn(std::ostream &str, const PoolQuery &obj)
Repository reposFind(const std::string &alias_r) const
Find a Repository named alias_r.
bool isAMatch(base_iterator &base_r) const
Check whether we are on a match.
void setStrMatcher(const StrMatcher &matcher_r)
Set the pattern to match.
MyInserter(PoolQuery::StrContainer &cont)
Match flags() const
Free function to get libsolv repo search flags.
sat::LookupAttr::iterator base_iterator
void nextSkipSolvable()
On the next call to operator++ advance to the next Solvable.
static const SolvAttr name
StringTypeAttr(const std::string &str_r)
bool strToFalse(const C_Str &str)
Return false if str is 0, false, no, off.
Kinds _kinds
Kinds to search.
void setInstalledOnly()
Return only repo packages.
static const StringTypeAttr exactAttr
Mode
Mode flags (mutual exclusive).
base_iterator startNewQyery() const
Initialize a new base query.
static const PoolQueryAttr stringTypeAttr
static const StringTypeAttr wordAttr
std::ostream & operator<<(std::ostream &str, const zypp::shared_ptr< void > &obj)
bool empty() const
Whether the query is empty.
Repository inRepo() const
The current Repository.
bool operator!=(const SetRelation::Enum &lhs, const SetCompare &rhs)
void setMatchSubstring()
Set to substring (the default).
represents all atributes in PoolQuery except SolvAtributes, which are used as is (not needed extend a...
#define arrayBegin(A)
Simple C-array iterator.
bool strToTrue(const C_Str &str)
Parsing boolean from string.
std::set< Repository > _repos
Repositories include in the search.
bool isModeSubstring() const
Whether this has mode SUBSTRING.
static const PoolQueryAttr stringAttr
bool deserialize(const std::string &str_r, DownloadMode &result_r)
std::map< sat::SolvAttr, StrContainer > AttrRawStrMap
bool matchSubstring() const
std::set< AttrMatchData > _uncompiledPredicated
Uncompiled attributes with predicate.
StatusFilter statusFilterFlags() const
void setModeString()
Set the mode STRING.
static const Match NOCASE
If set, match case insensitive.
Base class for Exception.
bool isModeRegex() const
Whether this has mode REGEX.
const Kinds & kinds() const
bool empty() const
Whether the result is empty.
static const PoolQueryAttr complexAttr
void setEdition(const Edition &edition, const Rel &op=Rel::EQ)
Set version condition.
void setMatchExact()
Set to match exact string instead of substring.
int get() const
Return the integer representation.
void nextSkipRepo()
On the next call to operator++ advance to the next Repository.
StrContainer _repos
Repos to search.
bool operator<(const PoolQuery::Impl &rhs) const
bool operator()(const string &str)
Mode mode() const
Return the mode part.
std::string asUserHistory() const
A single (multiline) string composed of asUserString and historyAsString.
size_type size() const
Number of solvables in the query result.
DefaultIntegral< bool, false > _neverMatchRepo
static const PoolQueryAttr requireAllAttr
void serialize(std::ostream &str, char delim= '\n') const
Writes a machine-readable string representation of the query to stream.
static const PoolQueryAttr editionAttr
for_use_in_switch inSwitch() const
Enumarator provided for use in switch statement.
void setFilesMatchFullPath(bool value=true)
If set (default), look at the full path when searching in filelists.
bool operator<(const PoolQuery &b) const
RW_pointer< Impl > _pimpl
Pointer to implementation.
AttrMatchList _attrMatchList
StrMatcher per attribtue.
const_iterator begin() const
Query result accessers.
StatusFilter _status_flags
Sat solver status flags.
PoolQueryAttr(const char *cstr_r)
Impl * clone() const
clone for RWCOW_pointer
int invokeOnEach(TIterator begin_r, TIterator end_r, TFilter filter_r, TFunction fnc_r)
Iterate through [begin_r,end_r) and invoke fnc_r on each item that passes filter_r.
const_iterator end() const
An iterator pointing to the end of the query result.
bool operator<(const StrMatcher &lhs, const StrMatcher &rhs)
std::string asString() const
Return a human-readable description of the query.
Easy-to use interface to the ZYPP dependency resolver.
static const PoolQueryAttr kindAttr
function< bool(const sat::Solvable &)> ProcessResolvable
static const Match FILES
LookupAttr: match full path when matching in filelists, otherwise just the basenames.
StrContainer _strings
Raw search strings.
static const StringTypeAttr globAttr
AttrRawStrMap _attrs
Raw attributes.
static const Edition noedition
Value representing noedition ("") This is in fact a valid Edition.
const base_iterator & end() const
iterator begin() const
Iterator to the begin of query results.
static const StringTypeAttr regexAttr
bool isModeString() const
Whether this has mode STRING.
void setRequireAll(bool require_all=true)
Require that all of the values set by addString or addAttribute match the values of respective attrib...
bool test(const Match &rhs) const
Test whether all of the rhs bits are set (same mode if rhs has one).