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

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

#include <termiterator.h>

+ Collaboration diagram for Xapian::TermIterator:

Classes

class  Internal
 Abstract base class for termlists. More...
 

Public Member Functions

 TermIterator (const TermIterator &o)
 Copy constructor. More...
 
TermIteratoroperator= (const TermIterator &o)
 Assignment. More...
 
 TermIterator ()
 Default constructor. More...
 
 ~TermIterator ()
 Destructor. More...
 
std::string operator* () const
 Return the term at the current position. More...
 
Xapian::termcount get_wdf () const
 Return the wdf for the term at the current position. More...
 
Xapian::doccount get_termfreq () const
 Return the term frequency for the term at the current position. More...
 
Xapian::termcount positionlist_count () const
 Return the length of the position list for the current position. More...
 
PositionIterator positionlist_begin () const
 Return a PositionIterator for the current term. More...
 
PositionIterator positionlist_end () const
 Return an end PositionIterator for the current term. More...
 
TermIteratoroperator++ ()
 Advance the iterator to the next position. More...
 
DerefWrapper_< std::string > operator++ (int)
 Advance the iterator to the next position (postfix version). More...
 
void skip_to (const std::string &term)
 Advance the iterator to term term. More...
 
std::string get_description () const
 Return a string describing this object. More...
 

Private Types

typedef std::input_iterator_tag iterator_category
 
typedef std::string value_type
 
typedef Xapian::termcount_diff difference_type
 
typedef std::string * pointer
 
typedef std::string & reference
 

Private Member Functions

 TermIterator (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 termiterator.h.

Member Typedef Documentation

◆ difference_type

TermIterator 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 termiterator.h.

◆ iterator_category

typedef std::input_iterator_tag Xapian::TermIterator::iterator_category
private

TermIterator 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 termiterator.h.

◆ pointer

typedef std::string* Xapian::TermIterator::pointer
private

TermIterator 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 156 of file termiterator.h.

◆ reference

typedef std::string& Xapian::TermIterator::reference
private

TermIterator 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 158 of file termiterator.h.

◆ value_type

typedef std::string Xapian::TermIterator::value_type
private

TermIterator 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 termiterator.h.

Constructor & Destructor Documentation

◆ TermIterator() [1/3]

Xapian::TermIterator::TermIterator ( Internal internal_)
explicitprivate

Construct given internals.

Definition at line 56 of file termiterator.cc.

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

◆ TermIterator() [2/3]

Xapian::TermIterator::TermIterator ( const TermIterator o)

Copy constructor.

Definition at line 71 of file termiterator.cc.

References LOGCALL_CTOR.

◆ TermIterator() [3/3]

Xapian::TermIterator::TermIterator ( )
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 termiterator.h.

◆ ~TermIterator()

Xapian::TermIterator::~TermIterator ( )
inline

Destructor.

Definition at line 84 of file termiterator.h.

References Xapian::operator*().

Member Function Documentation

◆ decref()

void Xapian::TermIterator::decref ( )
private

Definition at line 34 of file termiterator.cc.

References Assert.

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

◆ get_description()

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

Return a string describing this object.

Definition at line 149 of file termiterator.cc.

◆ get_termfreq()

Xapian::doccount Xapian::TermIterator::get_termfreq ( ) const

Return the term frequency for the term at the current position.

Note that for a TermIterator returned by calling termlist_begin() on a Document object obtained from a sharded database, this method will return the term frequency from the shard that the document is in rather than for the combined database.

Definition at line 117 of file termiterator.cc.

References Assert, Xapian::TermIterator::Internal::get_termfreq(), internal, LOGCALL, and RETURN.

Referenced by dbcheck(), DEFINE_TESTCASE(), main(), closedb1_iterators::perform(), and show_termlist().

◆ get_wdf()

Xapian::termcount Xapian::TermIterator::get_wdf ( ) const

◆ operator*()

string Xapian::TermIterator::operator* ( ) const

Return the term at the current position.

Definition at line 92 of file termiterator.cc.

References Assert, Xapian::TermIterator::Internal::get_termname(), internal, LOGCALL, and RETURN.

◆ operator++() [1/2]

TermIterator & Xapian::TermIterator::operator++ ( )

Advance the iterator to the next position.

Definition at line 100 of file termiterator.cc.

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

◆ operator++() [2/2]

DerefWrapper_<std::string> Xapian::TermIterator::operator++ ( int  )
inline

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

Definition at line 118 of file termiterator.h.

◆ operator=()

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

Assignment.

Definition at line 80 of file termiterator.cc.

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

◆ positionlist_begin()

PositionIterator Xapian::TermIterator::positionlist_begin ( ) const

◆ positionlist_count()

Xapian::termcount Xapian::TermIterator::positionlist_count ( ) const

Return the length of the position list for the current position.

Definition at line 125 of file termiterator.cc.

References Assert, internal, LOGCALL, Xapian::TermIterator::Internal::positionlist_count(), and RETURN.

Referenced by dbcheck(), DEFINE_TESTCASE(), format_doc_termlist(), and serialise_document().

◆ positionlist_end()

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

◆ post_advance()

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

Definition at line 42 of file termiterator.cc.

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

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

◆ skip_to()

void Xapian::TermIterator::skip_to ( const std::string &  term)

Advance the iterator to term term.

If the iteration is over an unsorted list of terms, then this method will throw Xapian::InvalidOperationError.

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

Definition at line 141 of file termiterator.cc.

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

Referenced by DEFINE_TESTCASE().

Member Data Documentation

◆ internal

Internal* Xapian::TermIterator::internal
private

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