zypp::detail::PoolQueryIterator Class Reference

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

#include <PoolQuery.h>

Inheritance diagram for zypp::detail::PoolQueryIterator:
[legend]

List of all members.

Public Types

typedef Matches::size_type size_type
typedef Matches::const_iterator matches_iterator

Public Member Functions

 PoolQueryIterator ()
 Default ctor is also end.
 PoolQueryIterator (const shared_ptr< PoolQueryMatcher > &matcher_r)
 PoolQuery ctor.
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"
 ...


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.

Private Types

typedef std::vector
< sat::LookupAttr::iterator
Matches

Private Member Functions

sat::Solvable dereference () const
void increment ()
const Matchesmatches () const

Private Attributes

shared_ptr< PoolQueryMatcher_matcher
shared_ptr< Matches_matches

Friends

class boost::iterator_core_access

Related Functions

(Note that these are not member functions.)

std::ostream & operator<< (std::ostream &str, const PoolQueryIterator &obj)
std::ostream & dumpOn (std::ostream &str, const PoolQueryIterator &obj)


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 491 of file PoolQuery.h.


Member Typedef Documentation

Definition at line 499 of file PoolQuery.h.

typedef Matches::size_type zypp::detail::PoolQueryIterator::size_type

Definition at line 501 of file PoolQuery.h.

typedef Matches::const_iterator zypp::detail::PoolQueryIterator::matches_iterator

Definition at line 502 of file PoolQuery.h.


Constructor & Destructor Documentation

zypp::detail::PoolQueryIterator::PoolQueryIterator (  )  [inline]

Default ctor is also end.

Definition at line 505 of file PoolQuery.h.

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

PoolQuery ctor.

Definition at line 509 of file PoolQuery.h.

References increment().


Member Function Documentation

bool zypp::detail::PoolQueryIterator::matchesEmpty (  )  const [inline]

False unless this is the end iterator.

Definition at line 559 of file PoolQuery.h.

References _matcher.

size_type zypp::detail::PoolQueryIterator::matchesSize (  )  const [inline]

Number of attribute matches.

Definition at line 561 of file PoolQuery.h.

References matches().

matches_iterator zypp::detail::PoolQueryIterator::matchesBegin (  )  const [inline]

Begin of matches.

Definition at line 563 of file PoolQuery.h.

References matches().

matches_iterator zypp::detail::PoolQueryIterator::matchesEnd (  )  const [inline]

End of matches.

Definition at line 565 of file PoolQuery.h.

References matches().

sat::Solvable zypp::detail::PoolQueryIterator::dereference (  )  const [inline, private]

Definition at line 571 of file PoolQuery.h.

void zypp::detail::PoolQueryIterator::increment (  )  [private]

Definition at line 1610 of file PoolQuery.cc.

References _matcher, and _matches.

Referenced by PoolQueryIterator().

const PoolQueryIterator::Matches & zypp::detail::PoolQueryIterator::matches (  )  const [private]

Definition at line 1623 of file PoolQuery.cc.

References _matcher, and _matches.

Referenced by matchesBegin(), matchesEnd(), and matchesSize().


Friends And Related Function Documentation

friend class boost::iterator_core_access [friend]

Definition at line 569 of file PoolQuery.h.

std::ostream & operator<< ( std::ostream &  str,
const PoolQueryIterator obj 
) [related]

Stream output.

Definition at line 586 of file PoolQuery.h.

std::ostream & dumpOn ( std::ostream &  str,
const PoolQueryIterator obj 
) [related]

Detailed stream output.

Definition at line 1640 of file PoolQuery.cc.


Member Data Documentation

Definition at line 580 of file PoolQuery.h.

Referenced by increment(), matches(), and matchesEmpty().

shared_ptr<Matches> zypp::detail::PoolQueryIterator::_matches [mutable, private]

Definition at line 581 of file PoolQuery.h.

Referenced by increment(), and matches().


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

doxygen