LCOV - code coverage report
Current view: top level - backends - positionlist.h (source / functions) Hit Total Coverage
Test: Test Coverage for xapian-core 7822d31adece Lines: 2 2 100.0 %
Date: 2019-05-23 11:15:29 Functions: 2 2 100.0 %
Branches: 1 2 50.0 %

           Branch data     Line data    Source code
       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
       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_POSITIONLIST_H
      22                 :            : #define XAPIAN_INCLUDED_POSITIONLIST_H
      23                 :            : 
      24                 :            : #include <xapian/intrusive_ptr.h>
      25                 :            : #include <xapian/positioniterator.h>
      26                 :            : #include <xapian/types.h>
      27                 :            : 
      28                 :            : namespace Xapian {
      29                 :            : 
      30                 :            : /// Abstract base class for iterating term positions in a document.
      31                 :            : class PositionIterator::Internal : public Xapian::Internal::intrusive_base
      32                 :            : {
      33                 :            :     /// Don't allow assignment.
      34                 :            :     void operator=(const Internal &) = delete;
      35                 :            : 
      36                 :            :     /// Don't allow copying.
      37                 :            :     Internal(const Internal &) = delete;
      38                 :            : 
      39                 :            :   protected:
      40                 :            :     /// Only constructable as a base class for derived classes.
      41                 :    3473790 :     Internal() { }
      42                 :            : 
      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.
      46                 :            :      */
      47         [ -  + ]:    3473790 :     virtual ~Internal() { }
      48                 :            : 
      49                 :            :     /// Return approximate size of this positionlist.
      50                 :            :     virtual Xapian::termcount get_approx_size() const = 0;
      51                 :            : 
      52                 :            :     /// Return the final entry in this positionlist.
      53                 :            :     virtual Xapian::termpos back() const = 0;
      54                 :            : 
      55                 :            :     /// Return the current position.
      56                 :            :     virtual Xapian::termpos get_position() const = 0;
      57                 :            : 
      58                 :            :     /** Advance to the next entry in the positionlist.
      59                 :            :      *
      60                 :            :      *  The list starts before the first entry, so next() or skip_to() must be
      61                 :            :      *  called before get_position().
      62                 :            :      *
      63                 :            :      *  @return true if we're on a valid entry; false if we've reached the end
      64                 :            :      *          of the list.
      65                 :            :      */
      66                 :            :     virtual bool next() = 0;
      67                 :            : 
      68                 :            :     /** Skip forward to the specified position.
      69                 :            :      *
      70                 :            :      *  If the specified position isn't in the list, position ourselves on the
      71                 :            :      *  first entry after it.
      72                 :            :      *
      73                 :            :      *  @return true if we're on a valid entry; false if we've reached the end
      74                 :            :      *          of the list.
      75                 :            :      */
      76                 :            :     virtual bool skip_to(Xapian::termpos termpos) = 0;
      77                 :            : };
      78                 :            : 
      79                 :            : }
      80                 :            : 
      81                 :            : typedef Xapian::PositionIterator::Internal PositionList;
      82                 :            : 
      83                 :            : #endif // XAPIAN_INCLUDED_POSITIONLIST_H

Generated by: LCOV version 1.11