now only fails at the link stage
[xapian.git] / xapian-core / backends / positionlist.h
blobd1515d331ebd29523ffb7dd0a0ff2aa4c07e354e
1 /** @file positionlist.h
2 * @brief Abstract base class for iterating term positions in a document.
3 */
4 /* Copyright (C) 2007,2010,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_POSITIONLIST_H
22 #define XAPIAN_INCLUDED_POSITIONLIST_H
24 #include <xapian/intrusive_ptr.h>
25 #include <xapian/positioniterator.h>
26 #include <xapian/types.h>
28 namespace Xapian {
30 /// Abstract base class for iterating term positions in a document.
31 class PositionIterator::Internal : public Xapian::Internal::intrusive_base
33 /// Don't allow assignment.
34 void operator=(const Internal &) = delete;
36 /// Don't allow copying.
37 Internal(const Internal &) = delete;
39 protected:
40 /// Only constructable as a base class for derived classes.
41 Internal() { }
43 public:
44 /** We have virtual methods and want to be able to delete derived classes
45 * using a pointer to the base class, so we need a virtual destructor.
47 virtual ~Internal() { }
49 /// Return approximate size of this positionlist.
50 virtual Xapian::termcount get_approx_size() const = 0;
52 /// Return the current position.
53 virtual Xapian::termpos get_position() const = 0;
55 /** Advance to the next entry in the positionlist.
57 * The list starts before the first entry, so next() or skip_to() must be
58 * called before get_position().
60 * @return true if we're on a valid entry; false if we've reached the end
61 * of the list.
63 virtual bool next() = 0;
65 /** Skip forward to the specified position.
67 * If the specified position isn't in the list, position ourselves on the
68 * first entry after it.
70 * @return true if we're on a valid entry; false if we've reached the end
71 * of the list.
73 virtual bool skip_to(Xapian::termpos termpos) = 0;
78 typedef Xapian::PositionIterator::Internal PositionList;
80 #endif // XAPIAN_INCLUDED_POSITIONLIST_H