Regenerate version.h when version_h.cc changes
[xapian.git] / xapian-core / backends / contiguousalldocspostlist.h
blob362eb89dcd3330d83c36ae0ab195f5e9341eb0af
1 /** @file contiguousalldocspostlist.h
2 * @brief Iterate all document ids when they form a contiguous range.
3 */
4 /* Copyright (C) 2007,2008,2009,2011 Olly Betts
5 * Copyright (C) 2009 Lemur Consulting Ltd
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 #ifndef XAPIAN_INCLUDED_CONTIGUOUSALLDOCSPOSTLIST_H
23 #define XAPIAN_INCLUDED_CONTIGUOUSALLDOCSPOSTLIST_H
25 #include <string>
27 #include "database.h"
28 #include "api/leafpostlist.h"
30 /// A PostList iteratating all docids when they form a contiguous range.
31 class ContiguousAllDocsPostList : public LeafPostList {
32 /// Don't allow assignment.
33 void operator=(const ContiguousAllDocsPostList &);
35 /// Don't allow copying.
36 ContiguousAllDocsPostList(const ContiguousAllDocsPostList &);
38 /// The database we're iterating over.
39 Xapian::Internal::intrusive_ptr<const Xapian::Database::Internal> db;
41 /// The current document id.
42 Xapian::docid did;
44 /// The number of documents in the database.
45 Xapian::doccount doccount;
47 public:
48 /// Constructor.
49 ContiguousAllDocsPostList(Xapian::Internal::intrusive_ptr<const Xapian::Database::Internal> db_,
50 Xapian::doccount doccount_)
51 : LeafPostList(std::string()),
52 db(db_), did(0), doccount(doccount_) { }
54 /** Return the term frequency.
56 * For an all documents postlist, this is the number of documents in the
57 * database.
59 Xapian::doccount get_termfreq() const;
61 /// Return the current docid.
62 Xapian::docid get_docid() const;
64 /// Return the length of current document.
65 Xapian::termcount get_doclength() const;
67 /// Return the number of unique terms.
68 Xapian::termcount get_unique_terms() const;
70 /// Always return 1 (wdf isn't totally meaningful for us).
71 Xapian::termcount get_wdf() const;
73 /// Throws InvalidOperationError.
74 PositionList *read_position_list();
76 /// Throws InvalidOperationError.
77 PositionList * open_position_list() const;
79 /// Advance to the next document.
80 PostList * next(double w_min);
82 /// Skip ahead to next document with docid >= target.
83 PostList * skip_to(Xapian::docid target, double w_min);
85 /// Return true if and only if we're off the end of the list.
86 bool at_end() const;
88 /// Return a string description of this object.
89 std::string get_description() const;
92 #endif // XAPIAN_INCLUDED_CONTIGUOUSALLDOCSPOSTLIST_H