Branch data Line data Source code
1 : : /** @file flint_alldocspostlist.h
2 : : * @brief A PostList which iterates over all documents in a FlintDatabase.
3 : : */
4 : : /* Copyright (C) 2006,2007,2008,2009 Olly Betts
5 : : * Copyright (C) 2009 Lemur Consulting Ltd
6 : : *
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.
11 : : *
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.
16 : : *
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
20 : : */
21 : :
22 : : #ifndef XAPIAN_INCLUDED_FLINT_ALLDOCSPOSTLIST_H
23 : : #define XAPIAN_INCLUDED_FLINT_ALLDOCSPOSTLIST_H
24 : :
25 : : #include <string>
26 : :
27 : : #include "autoptr.h"
28 : : #include "flint_database.h"
29 : : #include "leafpostlist.h"
30 : :
31 : : class FlintCursor;
32 : :
33 [ + - ][ # # ]: 229 : class FlintAllDocsPostList : public LeafPostList {
34 : : /// Don't allow assignment.
35 : : void operator=(const FlintAllDocsPostList &);
36 : :
37 : : /// Don't allow copying.
38 : : FlintAllDocsPostList(const FlintAllDocsPostList &);
39 : :
40 : : /// Set @a current_did from @a cursor->current_key.
41 : : PostList * read_did_from_current_key();
42 : :
43 : : /// The database we're iterating over.
44 : : Xapian::Internal::RefCntPtr<const FlintDatabase> db;
45 : :
46 : : /// The number of documents in the database.
47 : : Xapian::doccount doccount;
48 : :
49 : : /// Cursor running over termlist table keys.
50 : : AutoPtr<FlintCursor> cursor;
51 : :
52 : : /// The current document id.
53 : : Xapian::docid current_did;
54 : :
55 : : public:
56 : 229 : FlintAllDocsPostList(Xapian::Internal::RefCntPtr<const FlintDatabase> db_,
57 : : Xapian::doccount doccount_)
58 : : : LeafPostList(std::string()),
59 : : db(db_), doccount(doccount_), cursor(db->termlist_table.cursor_get()),
60 : 229 : current_did(0)
61 : : {
62 : 229 : cursor->find_entry(std::string());
63 : 229 : }
64 : :
65 : : Xapian::doccount get_termfreq() const;
66 : :
67 : : Xapian::docid get_docid() const;
68 : :
69 : : Xapian::termcount get_doclength() const;
70 : :
71 : : Xapian::termcount get_wdf() const;
72 : :
73 : : PostList * next(Xapian::weight w_min);
74 : :
75 : : PostList * skip_to(Xapian::docid desired_did, Xapian::weight w_min);
76 : :
77 : : bool at_end() const;
78 : :
79 : : std::string get_description() const;
80 : : };
81 : :
82 : : #endif // XAPIAN_INCLUDED_FLINT_ALLDOCSPOSTLIST_H
|