Branch data Line data Source code
1 : : /** @file wrapperpostlist.h
2 : : * @brief Base class for a PostList which wraps another PostList
3 : : */
4 : : /* Copyright 2017 Olly Betts
5 : : *
6 : : * This program is free software; you can redistribute it and/or
7 : : * modify it under the terms of the GNU General Public License as
8 : : * published by the Free Software Foundation; either version 2 of the
9 : : * License, or (at your option) any later version.
10 : : *
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.
15 : : *
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
19 : : */
20 : :
21 : : #ifndef XAPIAN_INCLUDED_WRAPPERPOSTLIST_H
22 : : #define XAPIAN_INCLUDED_WRAPPERPOSTLIST_H
23 : :
24 : : #include "api/postlist.h"
25 : :
26 : : /** Base class for a PostList which wraps another PostList.
27 : : *
28 : : * Generally methods are just forwarded to the wrapped PostList. For next()
29 : : * and skip_to(), the return value is also handled, so the wrapped PostList
30 : : * is updated when pruning happens.
31 : : */
32 : : class WrapperPostList : public PostList {
33 : : /// Don't allow assignment.
34 : : void operator=(const WrapperPostList&) = delete;
35 : :
36 : : /// Don't allow copying.
37 : : WrapperPostList(const WrapperPostList&) = delete;
38 : :
39 : : protected:
40 : : PostList* pl;
41 : :
42 : : public:
43 : 6450 : explicit WrapperPostList(PostList* pl_) : pl(pl_) {}
44 : :
45 [ + + ][ - + ]: 6450 : ~WrapperPostList() { delete pl; }
46 : :
47 : : Xapian::doccount get_termfreq_min() const;
48 : :
49 : : Xapian::doccount get_termfreq_max() const;
50 : :
51 : : Xapian::doccount get_termfreq_est() const;
52 : :
53 : : TermFreqs get_termfreq_est_using_stats(
54 : : const Xapian::Weight::Internal& stats) const;
55 : :
56 : : Xapian::docid get_docid() const;
57 : :
58 : : double get_weight(Xapian::termcount doclen,
59 : : Xapian::termcount unique_terms) const;
60 : :
61 : : bool at_end() const;
62 : :
63 : : double recalc_maxweight();
64 : :
65 : : PositionList* read_position_list();
66 : :
67 : : PostList* next(double w_min);
68 : :
69 : : PostList* skip_to(Xapian::docid, double w_min);
70 : :
71 : : std::string get_description() const;
72 : :
73 : : Xapian::termcount get_wdf() const;
74 : :
75 : : Xapian::termcount count_matching_subqs() const;
76 : : };
77 : :
78 : : #endif // XAPIAN_INCLUDED_WRAPPERPOSTLIST_H
|