1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80
|
/** @file
* @brief Abstract base class for iterating term positions in a document.
*/
/* Copyright (C) 2007,2010,2017 Olly Betts
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef XAPIAN_INCLUDED_POSITIONLIST_H
#define XAPIAN_INCLUDED_POSITIONLIST_H
#include <xapian/intrusive_ptr.h>
#include <xapian/positioniterator.h>
#include <xapian/types.h>
namespace Xapian {
/// Abstract base class for iterating term positions in a document.
class PositionIterator::Internal : public Xapian::Internal::intrusive_base
{
/// Don't allow assignment.
void operator=(const Internal &) = delete;
/// Don't allow copying.
Internal(const Internal &) = delete;
protected:
/// Only constructable as a base class for derived classes.
Internal() { }
public:
/** We have virtual methods and want to be able to delete derived classes
* using a pointer to the base class, so we need a virtual destructor.
*/
virtual ~Internal() { }
/// Return approximate size of this positionlist.
virtual Xapian::termcount get_approx_size() const = 0;
/// Return the current position.
virtual Xapian::termpos get_position() const = 0;
/** Advance to the next entry in the positionlist.
*
* The list starts before the first entry, so next() or skip_to() must be
* called before get_position().
*
* @return true if we're on a valid entry; false if we've reached the end
* of the list.
*/
virtual bool next() = 0;
/** Skip forward to the specified position.
*
* If the specified position isn't in the list, position ourselves on the
* first entry after it.
*
* @return true if we're on a valid entry; false if we've reached the end
* of the list.
*/
virtual bool skip_to(Xapian::termpos termpos) = 0;
};
}
typedef Xapian::PositionIterator::Internal PositionList;
#endif // XAPIAN_INCLUDED_POSITIONLIST_H
|