xapian-core  1.4.21
Classes | Public Member Functions | Private Member Functions | Private Attributes | List of all members
Xapian::PostingIterator Class Reference

Class for iterating over a list of terms. More...

#include <postingiterator.h>

+ Collaboration diagram for Xapian::PostingIterator:

Classes

class  Internal
 Abstract base class for postlists. More...
 

Public Member Functions

 PostingIterator (const PostingIterator &o)
 Copy constructor. More...
 
PostingIteratoroperator= (const PostingIterator &o)
 Assignment. More...
 
 PostingIterator ()
 Default constructor. More...
 
 ~PostingIterator ()
 Destructor. More...
 
Xapian::docid operator* () const
 Return the document id at the current position. More...
 
Xapian::termcount get_wdf () const
 Return the wdf for the document at the current position. More...
 
Xapian::termcount get_doclength () const
 Return the length of the document at the current position. More...
 
Xapian::termcount get_unique_terms () const
 Return the number of unique terms in the current document. More...
 
PositionIterator positionlist_begin () const
 Return a PositionIterator for the current document. More...
 
PositionIterator positionlist_end () const
 Return an end PositionIterator for the current document. More...
 
PostingIteratoroperator++ ()
 Advance the iterator to the next position. More...
 
DerefWrapper_< Xapian::docidoperator++ (int)
 Advance the iterator to the next position (postfix version). More...
 
void skip_to (Xapian::docid did)
 Advance the iterator to document did. More...
 
std::string get_description () const
 Return a string describing this object. More...
 

Private Types

typedef std::input_iterator_tag iterator_category
 
typedef Xapian::docid value_type
 
typedef Xapian::doccount_diff difference_type
 
typedef Xapian::docidpointer
 
typedef Xapian::docidreference
 

Private Member Functions

 PostingIterator (Internal *internal_)
 
void decref ()
 
void post_advance (Internal *res)
 

Private Attributes

Internalinternal
 

Detailed Description

Class for iterating over a list of terms.

Definition at line 41 of file postingiterator.h.

Member Typedef Documentation

◆ difference_type

PostingIterator is what the C++ STL calls an input_iterator.

The following typedefs allow std::iterator_traits<> to work so that this iterator can be used with the STL.

These are deliberately hidden from the Doxygen-generated docs, as the machinery here isn't interesting to API users. They just need to know that Xapian iterator classes are compatible with the STL.

Definition at line 150 of file postingiterator.h.

◆ iterator_category

typedef std::input_iterator_tag Xapian::PostingIterator::iterator_category
private

PostingIterator is what the C++ STL calls an input_iterator.

The following typedefs allow std::iterator_traits<> to work so that this iterator can be used with the STL.

These are deliberately hidden from the Doxygen-generated docs, as the machinery here isn't interesting to API users. They just need to know that Xapian iterator classes are compatible with the STL.

Definition at line 146 of file postingiterator.h.

◆ pointer

PostingIterator is what the C++ STL calls an input_iterator.

The following typedefs allow std::iterator_traits<> to work so that this iterator can be used with the STL.

These are deliberately hidden from the Doxygen-generated docs, as the machinery here isn't interesting to API users. They just need to know that Xapian iterator classes are compatible with the STL.

Definition at line 152 of file postingiterator.h.

◆ reference

PostingIterator is what the C++ STL calls an input_iterator.

The following typedefs allow std::iterator_traits<> to work so that this iterator can be used with the STL.

These are deliberately hidden from the Doxygen-generated docs, as the machinery here isn't interesting to API users. They just need to know that Xapian iterator classes are compatible with the STL.

Definition at line 154 of file postingiterator.h.

◆ value_type

PostingIterator is what the C++ STL calls an input_iterator.

The following typedefs allow std::iterator_traits<> to work so that this iterator can be used with the STL.

These are deliberately hidden from the Doxygen-generated docs, as the machinery here isn't interesting to API users. They just need to know that Xapian iterator classes are compatible with the STL.

Definition at line 148 of file postingiterator.h.

Constructor & Destructor Documentation

◆ PostingIterator() [1/3]

Xapian::PostingIterator::PostingIterator ( Internal internal_)
explicitprivate

Construct given internals.

Definition at line 57 of file postingiterator.cc.

References decref(), internal, LOGCALL_CTOR, Xapian::PostingIterator::Internal::next(), and post_advance().

◆ PostingIterator() [2/3]

Xapian::PostingIterator::PostingIterator ( const PostingIterator o)

Copy constructor.

Definition at line 72 of file postingiterator.cc.

References LOGCALL_CTOR.

◆ PostingIterator() [3/3]

Xapian::PostingIterator::PostingIterator ( )
inline

Default constructor.

Creates an uninitialised iterator, which can't be used before being assigned to, but is sometimes syntactically convenient.

Definition at line 80 of file postingiterator.h.

◆ ~PostingIterator()

Xapian::PostingIterator::~PostingIterator ( )
inline

Destructor.

Definition at line 84 of file postingiterator.h.

References Xapian::operator*().

Member Function Documentation

◆ decref()

void Xapian::PostingIterator::decref ( )
private

Definition at line 34 of file postingiterator.cc.

References Assert.

Referenced by operator=(), and PostingIterator().

◆ get_description()

std::string Xapian::PostingIterator::get_description ( ) const

Return a string describing this object.

Definition at line 160 of file postingiterator.cc.

Referenced by DEFINE_TESTCASE().

◆ get_doclength()

Xapian::termcount Xapian::PostingIterator::get_doclength ( ) const

Return the length of the document at the current position.

Definition at line 118 of file postingiterator.cc.

References Assert, Xapian::PostingIterator::Internal::get_doclength(), internal, LOGCALL, and RETURN.

Referenced by DEFINE_TESTCASE(), closedb1_iterators::perform(), and show_db_stats().

◆ get_unique_terms()

Xapian::termcount Xapian::PostingIterator::get_unique_terms ( ) const

Return the number of unique terms in the current document.

Definition at line 126 of file postingiterator.cc.

References Assert, Xapian::PostingIterator::Internal::get_unique_terms(), internal, LOGCALL, and RETURN.

Referenced by DEFINE_TESTCASE(), and closedb1_iterators::perform().

◆ get_wdf()

Xapian::termcount Xapian::PostingIterator::get_wdf ( ) const

Return the wdf for the document at the current position.

Definition at line 110 of file postingiterator.cc.

References Assert, Xapian::PostingIterator::Internal::get_wdf(), internal, LOGCALL, and RETURN.

Referenced by DEFINE_TESTCASE(), and main().

◆ operator*()

Xapian::docid Xapian::PostingIterator::operator* ( ) const

Return the document id at the current position.

Definition at line 93 of file postingiterator.cc.

References Assert, Xapian::PostingIterator::Internal::get_docid(), internal, LOGCALL, and RETURN.

◆ operator++() [1/2]

PostingIterator & Xapian::PostingIterator::operator++ ( )

Advance the iterator to the next position.

Definition at line 101 of file postingiterator.cc.

References Assert, internal, LOGCALL, Xapian::PostingIterator::Internal::next(), post_advance(), and RETURN.

◆ operator++() [2/2]

DerefWrapper_<Xapian::docid> Xapian::PostingIterator::operator++ ( int  )
inline

Advance the iterator to the next position (postfix version).

Definition at line 117 of file postingiterator.h.

◆ operator=()

PostingIterator & Xapian::PostingIterator::operator= ( const PostingIterator o)

Assignment.

Definition at line 81 of file postingiterator.cc.

References Xapian::Internal::intrusive_base::_refs, decref(), internal, LOGCALL, and RETURN.

◆ positionlist_begin()

PositionIterator Xapian::PostingIterator::positionlist_begin ( ) const

Return a PositionIterator for the current document.

Definition at line 144 of file postingiterator.cc.

References Assert, internal, LOGCALL, Xapian::PostingIterator::Internal::open_position_list(), and RETURN.

Referenced by main().

◆ positionlist_end()

PositionIterator Xapian::PostingIterator::positionlist_end ( ) const
inline

Return an end PositionIterator for the current document.

Definition at line 109 of file postingiterator.h.

Referenced by main().

◆ post_advance()

void Xapian::PostingIterator::post_advance ( Internal res)
private

Definition at line 42 of file postingiterator.cc.

References Xapian::Internal::intrusive_base::_refs.

Referenced by operator++(), PostingIterator(), and skip_to().

◆ skip_to()

void Xapian::PostingIterator::skip_to ( Xapian::docid  did)

Advance the iterator to document did.

Parameters
didThe document id to advance to. If this document id isn't in the stream being iterated, then the iterator is moved to the next document id after it which is.

Definition at line 152 of file postingiterator.cc.

References internal, LOGCALL_VOID, post_advance(), and Xapian::PostingIterator::Internal::skip_to().

Referenced by DEFINE_TESTCASE(), main(), Xapian::FixedWeightPostingSource::next(), and Xapian::FixedWeightPostingSource::skip_to().

Member Data Documentation

◆ internal

Internal* Xapian::PostingIterator::internal
private

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