xapian-core  2.0.0
Classes | Public Member Functions | Private Types | 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
 

Public Member Functions

 PostingIterator (const PostingIterator &o)
 Copy constructor. More...
 
PostingIteratoroperator= (const PostingIterator &o)
 Assignment. More...
 
 PostingIterator (PostingIterator &&o)
 Move constructor. More...
 
PostingIteratoroperator= (PostingIterator &&o)
 Move assignment operator. More...
 
 PostingIterator () noexcept
 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...
 
Xapian::termcount get_wdfdocmax () const
 Return the max_wdf in the current document. More...
 
PositionIterator positionlist_begin () const
 Return a PositionIterator for the current document. More...
 
PositionIterator positionlist_end () const noexcept
 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 value_typepointer
 
typedef value_type reference
 

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 40 of file postingiterator.h.

Member Typedef Documentation

◆ difference_type

Definition at line 151 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 147 of file postingiterator.h.

◆ pointer

Definition at line 153 of file postingiterator.h.

◆ reference

Definition at line 155 of file postingiterator.h.

◆ value_type

Definition at line 149 of file postingiterator.h.

Constructor & Destructor Documentation

◆ PostingIterator() [1/4]

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

Wrap an existing Internal.

Definition at line 41 of file postingiterator.cc.

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

◆ PostingIterator() [2/4]

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

Copy constructor.

Definition at line 59 of file postingiterator.cc.

References LOGCALL_CTOR.

◆ PostingIterator() [3/4]

Xapian::PostingIterator::PostingIterator ( PostingIterator &&  o)
inline

Move constructor.

Definition at line 58 of file postingiterator.h.

◆ PostingIterator() [4/4]

Xapian::PostingIterator::PostingIterator ( )
inlinenoexcept

Default constructor.

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

Definition at line 78 of file postingiterator.h.

◆ ~PostingIterator()

Xapian::PostingIterator::~PostingIterator ( )
inline

Destructor.

Definition at line 82 of file postingiterator.h.

Member Function Documentation

◆ decref()

void Xapian::PostingIterator::decref ( )
private

Definition at line 34 of file postingiterator.cc.

References Assert.

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

◆ get_description()

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

Return a string describing this object.

Definition at line 162 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 108 of file postingiterator.cc.

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

Referenced by DEFINE_TESTCASE(), closedb1_iterators::perform(), remotefailure1_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 116 of file postingiterator.cc.

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

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

◆ get_wdf()

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

Return the wdf for the document at the current position.

Definition at line 100 of file postingiterator.cc.

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

Referenced by DEFINE_TESTCASE().

◆ get_wdfdocmax()

Xapian::termcount Xapian::PostingIterator::get_wdfdocmax ( ) const

Return the max_wdf in the current document.

Definition at line 124 of file postingiterator.cc.

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

◆ operator*()

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

Return the document id at the current position.

Definition at line 80 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 88 of file postingiterator.cc.

References Assert, decref(), internal, LOGCALL, Xapian::PostingIterator::Internal::next(), 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 118 of file postingiterator.h.

◆ operator=() [1/2]

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

Assignment.

Definition at line 68 of file postingiterator.cc.

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

◆ operator=() [2/2]

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

Move assignment operator.

Definition at line 64 of file postingiterator.h.

◆ positionlist_begin()

PositionIterator Xapian::PostingIterator::positionlist_begin ( ) const

Return a PositionIterator for the current document.

Definition at line 142 of file postingiterator.cc.

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

◆ positionlist_end()

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

Return an end PositionIterator for the current document.

Definition at line 110 of file postingiterator.h.

◆ post_advance()

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

◆ 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 150 of file postingiterator.cc.

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

Referenced by DEFINE_TESTCASE(), 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: