HoneyTable::read_item(): Read tag in one go
[xapian.git] / xapian-core / backends / alltermslist.h
blobf34e85560d215e0404d00d72ffdce4d3870f6a44
1 /** @file alltermslist.h
2 * @brief Abstract base class for iterating all terms in a database.
3 */
4 /* Copyright (C) 2007,2008,2011 Olly Betts
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21 #ifndef XAPIAN_INCLUDED_ALLTERMSLIST_H
22 #define XAPIAN_INCLUDED_ALLTERMSLIST_H
24 #include "api/termlist.h"
26 /// Abstract base class for iterating all terms in a database.
27 class AllTermsList : public TermList {
28 /// Don't allow assignment.
29 void operator=(const AllTermsList &);
31 /// Don't allow copying.
32 AllTermsList(const AllTermsList &);
34 protected:
35 /// Only constructable as a base class for derived classes.
36 AllTermsList() { }
38 public:
39 /// Return approximate size of this termlist.
40 virtual Xapian::termcount get_approx_size() const = 0;
42 /// Return the termname at the current position.
43 virtual std::string get_termname() const = 0;
45 /** Return the wdf for the term at the current position.
47 * This isn't meaningful for an AllTermsList, and will throw
48 * Xapian::InvalidOperationError if called.
50 virtual Xapian::termcount get_wdf() const;
52 /// Return the term frequency for the term at the current position.
53 virtual Xapian::doccount get_termfreq() const = 0;
55 /// Advance the current position to the next term in the termlist.
56 virtual TermList *next() = 0;
58 /** Skip forward to the specified term.
60 * If the specified term isn't in the list, position ourselves on the
61 * first term after @a term (or at_end() if no terms after @a term exist).
63 virtual TermList *skip_to(const std::string &term) = 0;
65 /// Return true if the current position is past the last term in this list.
66 virtual bool at_end() const = 0;
68 /** Return true if the current position is past the last term in this list.
70 * This isn't meaningful for an AllTermsList, and will throw
71 * Xapian::InvalidOperationError if called.
73 virtual Xapian::termcount positionlist_count() const;
75 /** Return a PositionIterator for the current position.
77 * This isn't meaningful for an AllTermsList, and will throw
78 * Xapian::InvalidOperationError if called.
80 virtual PositionList* positionlist_begin() const;
83 #endif // XAPIAN_INCLUDED_ALLTERMSLIST_H