LCOV - code coverage report
Current view: top level - backends/remote - remote_termlist.h (source / functions) Hit Total Coverage
Test: Test Coverage for xapian-core 7028d852e609 Lines: 3 3 100.0 %
Date: 2019-02-17 14:59:59 Functions: 2 2 100.0 %
Branches: 3 6 50.0 %

           Branch data     Line data    Source code
       1                 :            : /** @file remote_termlist.h
       2                 :            :  * @brief Iterate terms in a remote document
       3                 :            :  */
       4                 :            : /* Copyright (C) 2007,2008,2011,2018 Olly Betts
       5                 :            :  *
       6                 :            :  * This program is free software; you can redistribute it and/or modify
       7                 :            :  * it under the terms of the GNU General Public License as published by
       8                 :            :  * the Free Software Foundation; either version 2 of the License, or
       9                 :            :  * (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_REMOTE_TERMLIST_H
      22                 :            : #define XAPIAN_INCLUDED_REMOTE_TERMLIST_H
      23                 :            : 
      24                 :            : #include "api/termlist.h"
      25                 :            : 
      26                 :            : class RemoteDatabase;
      27                 :            : 
      28                 :            : /// Iterate terms in a remote document.
      29         [ -  + ]:       3440 : class RemoteTermList : public TermList {
      30                 :            :     /// Don't allow assignment.
      31                 :            :     void operator=(const RemoteTermList &) = delete;
      32                 :            : 
      33                 :            :     /// Don't allow copying.
      34                 :            :     RemoteTermList(const RemoteTermList &) = delete;
      35                 :            : 
      36                 :            :     std::string current_term;
      37                 :            : 
      38                 :            :     Xapian::termcount current_wdf;
      39                 :            : 
      40                 :            :     Xapian::doccount current_termfreq;
      41                 :            : 
      42                 :            :     Xapian::termcount num_entries;
      43                 :            : 
      44                 :            :     Xapian::termcount doclen;
      45                 :            : 
      46                 :            :     Xapian::doccount db_size;
      47                 :            : 
      48                 :            :     Xapian::Internal::intrusive_ptr<const RemoteDatabase> db;
      49                 :            : 
      50                 :            :     Xapian::docid did;
      51                 :            : 
      52                 :            :     std::string data;
      53                 :            : 
      54                 :            :     const char* p = NULL;
      55                 :            : 
      56                 :            :   public:
      57                 :            :     /// Construct.
      58                 :        860 :     RemoteTermList(Xapian::termcount num_entries_,
      59                 :            :                    Xapian::termcount doclen_,
      60                 :            :                    Xapian::doccount db_size_,
      61                 :            :                    const RemoteDatabase* db_,
      62                 :            :                    Xapian::docid did_,
      63                 :            :                    std::string&& data_)
      64                 :            :         : num_entries(num_entries_),
      65                 :            :           doclen(doclen_),
      66                 :            :           db_size(db_size_),
      67                 :            :           db(db_),
      68                 :            :           did(did_),
      69 [ +  - ][ +  - ]:        860 :           data(data_) {}
      70                 :            : 
      71                 :            :     /// Return approximate size of this termlist.
      72                 :            :     Xapian::termcount get_approx_size() const;
      73                 :            : 
      74                 :            :     void accumulate_stats(Xapian::Internal::ExpandStats& stats) const;
      75                 :            : 
      76                 :            :     /// Return the termname at the current position.
      77                 :            :     std::string get_termname() const;
      78                 :            : 
      79                 :            :     /// Return the wdf for the term at the current position.
      80                 :            :     Xapian::termcount get_wdf() const;
      81                 :            : 
      82                 :            :     /// Return the term frequency for the term at the current position.
      83                 :            :     Xapian::doccount get_termfreq() const;
      84                 :            : 
      85                 :            :     /// Advance the current position to the next term in the termlist.
      86                 :            :     TermList* next();
      87                 :            : 
      88                 :            :     /** Skip forward to the specified term.
      89                 :            :      *
      90                 :            :      *  If the specified term isn't in the list, position ourselves on the
      91                 :            :      *  first term after @a term (or at_end() if no terms after @a term exist).
      92                 :            :      */
      93                 :            :     TermList* skip_to(const std::string& term);
      94                 :            : 
      95                 :            :     /// Return true if the current position is past the last term in this list.
      96                 :            :     bool at_end() const;
      97                 :            : 
      98                 :            :     /// Return the length of the position list for the current position.
      99                 :            :     Xapian::termcount positionlist_count() const;
     100                 :            : 
     101                 :            :     /// Return PositionList for the current position.
     102                 :            :     PositionList* positionlist_begin() const;
     103                 :            : };
     104                 :            : 
     105                 :            : #endif // XAPIAN_INCLUDED_REMOTE_TERMLIST_H

Generated by: LCOV version 1.11