libzypp: zypp::detail::PoolQueryIterator Class Reference

libzypp 17.38.6

zypp::detail::PoolQueryIterator Class Reference

PoolQuery iterator as returned by PoolQuery::begin. More...

`#include <zypp/PoolQuery.h>`

Inheritance diagram for zypp::detail::PoolQueryIterator:

## Public Types
using | size_type = Matches::size_type
using | matches_iterator = Matches::const_iterator

## Public Member Functions
| PoolQueryIterator ()
| Default ctor is also `end`.
| PoolQueryIterator (const shared_ptr< PoolQueryMatcher > &matcher_r)
| \Ref PoolQuery ctor.

## Private Types
using | Matches = std::vector<sat::LookupAttr::iterator>

## Detailed inspection of attribute matches within the current Solvable.
The matches_iterator visits all attribute matches within the current Solvable, providing a sat::LookupAttr::iterator pointing to attribute. While a matches_iterator itself becomes invalid if the PoolQueryIterator is advanced, the sat::LookupAttr::iterator it pointed to stays valid, even after the query ended. // Setup query for "libzypp" in name or requires: PoolQuery q; q.addString( "libzypp" ); q.setMatchSubstring(); q.setCaseSensitive( false ); q.addAttribute( sat::SolvAttr::name ); q.addDependency( sat::SolvAttr::requires ); // Iterate the result: for_( solvIter, q.begin(), q.end() ) { sat::Solvable solvable( *solvIter ); cout << "Found matches in " << solvable << endl; if ( verbose ) for_( attrIter, solvIter.matchesBegin(), solvIter.matchesEnd() ) { sat::LookupAttr::iterator attr( *attrIter ); cout << " " << attr.inSolvAttr() << "\t\"" << attr.asString() << "\"" << endl; } } Found matches in PackageKit-0.3.11-1.12.i586(@System) solvable:requires "libzypp.so.523" Found matches in libqdialogsolver1-1.2.6-1.1.2.i586(@System) solvable:requires "libzypp.so.523" solvable:requires "libzypp >= 5.25.3-0.1.2" Found matches in libzypp-5.30.3-0.1.1.i586(@System) solvable:name "libzypp" Found matches in libzypp-testsuite-tools-4.2.6-8.1.i586(@System) solvable:name "libzypp-testsuite-tools" solvable:requires "libzypp.so.523" ... for_ #define for_(IT, BEG, END) Convenient for-loops using iterator. Definition Easy.h:27 zypp::PoolQuery Meta-data query API. Definition PoolQuery.h:91 zypp::PoolQuery::addString void addString(const std::string &value) Add a global query string. Definition PoolQuery.cc:882 zypp::PoolQuery::setCaseSensitive void setCaseSensitive(bool value=true) Turn case sentitivity on or off (unsets or sets SEARCH_NOCASE flag). Definition PoolQuery.cc:1019 zypp::PoolQuery::addAttribute void addAttribute(const sat::SolvAttr &attr, const std::string &value="") Filter by the value of the specified attr attribute. Definition PoolQuery.cc:885 zypp::PoolQuery::end const_iterator end() const An iterator pointing to the end of the query result. Definition PoolQuery.h:621 zypp::PoolQuery::begin const_iterator begin() const Query result accessers. Definition PoolQuery.cc:1855 zypp::PoolQuery::addDependency void addDependency(const sat::SolvAttr &attr, const std::string &name, const Rel &op, const Edition &edition) Query "name|global op edition". Definition PoolQuery.cc:888 zypp::PoolQuery::setMatchSubstring void setMatchSubstring() Set to substring (the default). Definition PoolQuery.cc:963 zypp::detail::PoolQueryIterator::matches const Matches & matches() const Definition PoolQuery.cc:1821 zypp::sat::LookupAttr::iterator Result iterator. Definition LookupAttr.h:364 zypp::sat::SolvAttr::name static const SolvAttr name Definition SolvAttr.h:52 zypp::sat::Solvable A Solvable object within the sat Pool. Definition Solvable.h:54
class | boost::iterator_core_access
shared_ptr< PoolQueryMatcher > | _matcher
shared_ptr< Matches > | _matches
bool | matchesEmpty () const
| `False` unless this is the `end` iterator.
size_type | matchesSize () const
| Number of attribute matches.
matches_iterator | matchesBegin () const
| Begin of matches.
matches_iterator | matchesEnd () const
| End of matches.
sat::Solvable | dereference () const
void | increment ()
const Matches & | matches () const

## Detailed Description

PoolQuery iterator as returned by PoolQuery::begin.

The PoolQueryIterator visits sat::Solavables that do contain matches.

But it also provides an iterator by itself, to allow a detailed inspection of the individual attribute matches within the current Solvable.

Definition at line 516 of file PoolQuery.h.

## Member Typedef Documentation

## ◆ Matches

using zypp::detail::PoolQueryIterator::Matches = std::vector<sat::LookupAttr::iterator>
| private

Definition at line 524 of file PoolQuery.h.

## ◆ size_type

using zypp::detail::PoolQueryIterator::size_type = Matches::size_type

Definition at line 526 of file PoolQuery.h.

## ◆ matches_iterator

using zypp::detail::PoolQueryIterator::matches_iterator = Matches::const_iterator

Definition at line 527 of file PoolQuery.h.

## Constructor & Destructor Documentation

## ◆ PoolQueryIterator() [1/2]

zypp::detail::PoolQueryIterator::PoolQueryIterator | ( |  | ) |
| inline

Default ctor is also `end`.

Definition at line 530 of file PoolQuery.h.

## ◆ PoolQueryIterator() [2/2]

zypp::detail::PoolQueryIterator::PoolQueryIterator | ( | const shared_ptr< PoolQueryMatcher > & | matcher_r | ) |
| inline

\Ref PoolQuery ctor.

Definition at line 534 of file PoolQuery.h.

## Member Function Documentation

## ◆ matchesEmpty()

bool zypp::detail::PoolQueryIterator::matchesEmpty | ( |  | ) | const
| inline

`False` unless this is the `end` iterator.

Definition at line 584 of file PoolQuery.h.

## ◆ matchesSize()

size_type zypp::detail::PoolQueryIterator::matchesSize | ( |  | ) | const
| inline

Number of attribute matches.

Definition at line 586 of file PoolQuery.h.

## ◆ matchesBegin()

matches_iterator zypp::detail::PoolQueryIterator::matchesBegin | ( |  | ) | const
| inline

Begin of matches.

Definition at line 588 of file PoolQuery.h.

## ◆ matchesEnd()

matches_iterator zypp::detail::PoolQueryIterator::matchesEnd | ( |  | ) | const
| inline

End of matches.

Definition at line 590 of file PoolQuery.h.

## ◆ dereference()

sat::Solvable zypp::detail::PoolQueryIterator::dereference | ( |  | ) | const
| inlineprivate

Definition at line 596 of file PoolQuery.h.

## ◆ increment()

void zypp::detail::PoolQueryIterator::increment | ( |  | ) |
| private

Definition at line 1808 of file PoolQuery.cc.

## ◆ matches()

const PoolQueryIterator::Matches & zypp::detail::PoolQueryIterator::matches | ( |  | ) | const
| private

Definition at line 1821 of file PoolQuery.cc.

## Friends And Related Symbol Documentation

## ◆ boost::iterator_core_access

friend class boost::iterator_core_access
| friend

Definition at line 594 of file PoolQuery.h.

## Member Data Documentation

## ◆ _matcher

shared_ptr<PoolQueryMatcher> zypp::detail::PoolQueryIterator::_matcher
| private

Definition at line 605 of file PoolQuery.h.

## ◆ _matches

shared_ptr<Matches> zypp::detail::PoolQueryIterator::_matches
| mutableprivate

Definition at line 606 of file PoolQuery.h.

The documentation for this class was generated from the following files:

- zypp/PoolQuery.h
- zypp/PoolQuery.cc