LCOV - code coverage report
Current view: top level - backends - contiguousalldocspostlist.h (source / functions) Hit Total Coverage
Test: Test Coverage for xapian-core 954b5873a738 Lines: 3 3 100.0 %
Date: 2019-06-30 05:20:33 Functions: 2 2 100.0 %
Branches: 2 4 50.0 %

           Branch data     Line data    Source code
       1                 :            : /** @file contiguousalldocspostlist.h
       2                 :            :  * @brief Iterate all document ids when they form a contiguous range.
       3                 :            :  */
       4                 :            : /* Copyright (C) 2007,2008,2009,2011,2017 Olly Betts
       5                 :            :  * Copyright (C) 2009 Lemur Consulting Ltd
       6                 :            :  *
       7                 :            :  * This program is free software; you can redistribute it and/or modify
       8                 :            :  * it under the terms of the GNU General Public License as published by
       9                 :            :  * the Free Software Foundation; either version 2 of the License, or
      10                 :            :  * (at your option) any later version.
      11                 :            :  *
      12                 :            :  * This program is distributed in the hope that it will be useful,
      13                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      14                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      15                 :            :  * GNU General Public License for more details.
      16                 :            :  *
      17                 :            :  * You should have received a copy of the GNU General Public License
      18                 :            :  * along with this program; if not, write to the Free Software
      19                 :            :  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
      20                 :            :  */
      21                 :            : 
      22                 :            : #ifndef XAPIAN_INCLUDED_CONTIGUOUSALLDOCSPOSTLIST_H
      23                 :            : #define XAPIAN_INCLUDED_CONTIGUOUSALLDOCSPOSTLIST_H
      24                 :            : 
      25                 :            : #include <string>
      26                 :            : 
      27                 :            : #include "api/leafpostlist.h"
      28                 :            : 
      29                 :            : /// A PostList iterating all docids when they form a contiguous range.
      30         [ -  + ]:       1548 : class ContiguousAllDocsPostList : public LeafPostList {
      31                 :            :     /// Don't allow assignment.
      32                 :            :     void operator=(const ContiguousAllDocsPostList &);
      33                 :            : 
      34                 :            :     /// Don't allow copying.
      35                 :            :     ContiguousAllDocsPostList(const ContiguousAllDocsPostList &);
      36                 :            : 
      37                 :            :     /** The current document id.
      38                 :            :      *
      39                 :            :      *  This will be 0 before we start and once we reach the end.
      40                 :            :      */
      41                 :            :     Xapian::docid did;
      42                 :            : 
      43                 :            :     /// The number of documents in the database.
      44                 :            :     Xapian::doccount doccount;
      45                 :            : 
      46                 :            :   public:
      47                 :            :     /// Constructor.
      48                 :            :     explicit
      49                 :        387 :     ContiguousAllDocsPostList(Xapian::doccount doccount_)
      50                 :            :         : LeafPostList(std::string()),
      51         [ +  - ]:        387 :           did(0), doccount(doccount_) { }
      52                 :            : 
      53                 :            :     /** Return the term frequency.
      54                 :            :      *
      55                 :            :      *  For an all documents postlist, this is the number of documents in the
      56                 :            :      *  database.
      57                 :            :      */
      58                 :            :     Xapian::doccount get_termfreq() const;
      59                 :            : 
      60                 :            :     /// Return the current docid.
      61                 :            :     Xapian::docid get_docid() const;
      62                 :            : 
      63                 :            :     /// Always return 1 (wdf isn't totally meaningful for us).
      64                 :            :     Xapian::termcount get_wdf() const;
      65                 :            : 
      66                 :            :     /// Throws InvalidOperationError.
      67                 :            :     PositionList *read_position_list();
      68                 :            : 
      69                 :            :     /// Throws InvalidOperationError.
      70                 :            :     PositionList * open_position_list() const;
      71                 :            : 
      72                 :            :     /// Advance to the next document.
      73                 :            :     PostList * next(double w_min);
      74                 :            : 
      75                 :            :     /// Skip ahead to next document with docid >= target.
      76                 :            :     PostList * skip_to(Xapian::docid target, double w_min);
      77                 :            : 
      78                 :            :     /// Return true if and only if we're off the end of the list.
      79                 :            :     bool at_end() const;
      80                 :            : 
      81                 :            :     /// Return a string description of this object.
      82                 :            :     std::string get_description() const;
      83                 :            : };
      84                 :            : 
      85                 :            : #endif // XAPIAN_INCLUDED_CONTIGUOUSALLDOCSPOSTLIST_H

Generated by: LCOV version 1.11