Split PostList and PostingIterator::Internal
[xapian.git] / xapian-core / api / postingiteratorinternal.h
blobd99646ba02f397a66425124d0379f796c146dfb6
1 /** @file postingiteratorinternal.h
2 * @brief Xapian::PostingIterator internals
3 */
4 /* Copyright 2017 Olly Betts
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.
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_POSTINGITERATORINTERNAL_H
22 #define XAPIAN_INCLUDED_POSTINGITERATORINTERNAL_H
24 #include "xapian/postingiterator.h"
26 #include "postlist.h"
28 namespace Xapian {
30 class PostingIterator::Internal {
31 friend class PostingIterator;
33 PostList* pl;
35 unsigned _refs = 0;
37 public:
38 explicit
39 Internal(PostList* pl_) : pl(pl_) {}
41 ~Internal() {
42 delete pl;
45 Xapian::docid get_docid() const {
46 return pl->get_docid();
49 Xapian::termcount get_wdf() const {
50 return pl->get_wdf();
53 Xapian::termcount get_doclength() const {
54 return pl->get_doclength();
57 Xapian::termcount get_unique_terms() const {
58 return pl->get_unique_terms();
61 PositionList* open_position_list() const {
62 return pl->open_position_list();
65 bool next() {
66 (void)pl->next();
67 return !pl->at_end();
70 bool skip_to(Xapian::docid did) {
71 (void)pl->skip_to(did);
72 return !pl->at_end();
75 std::string get_description() const {
76 return pl->get_description();
82 #endif // XAPIAN_INCLUDED_POSTINGITERATORINTERNAL_H