LCOV - code coverage report
Current view: top level - backends/remote - remote_alltermslist.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: 3 6 50.0 %

           Branch data     Line data    Source code
       1                 :            : /** @file remote_alltermslist.h
       2                 :            :  * @brief Iterate all terms in a remote database.
       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_ALLTERMSLIST_H
      22                 :            : #define XAPIAN_INCLUDED_REMOTE_ALLTERMSLIST_H
      23                 :            : 
      24                 :            : #include "backends/alltermslist.h"
      25                 :            : 
      26                 :            : /// Iterate all terms in a remote database.
      27         [ -  + ]:        360 : class RemoteAllTermsList : public AllTermsList {
      28                 :            :     /// Don't allow assignment.
      29                 :            :     void operator=(const RemoteAllTermsList &) = delete;
      30                 :            : 
      31                 :            :     /// Don't allow copying.
      32                 :            :     RemoteAllTermsList(const RemoteAllTermsList &) = delete;
      33                 :            : 
      34                 :            :     std::string current_term;
      35                 :            : 
      36                 :            :     Xapian::doccount current_termfreq;
      37                 :            : 
      38                 :            :     std::string data;
      39                 :            : 
      40                 :            :     const char* p = NULL;
      41                 :            : 
      42                 :            :   public:
      43                 :            :     /// Construct.
      44                 :         90 :     RemoteAllTermsList(const std::string& prefix,
      45                 :            :                        std::string&& data_)
      46                 :            :         : current_term(prefix),
      47 [ +  - ][ +  - ]:         90 :           data(data_) {}
      48                 :            : 
      49                 :            :     /// Return approximate size of this termlist.
      50                 :            :     Xapian::termcount get_approx_size() const;
      51                 :            : 
      52                 :            :     /// Return the termname at the current position.
      53                 :            :     std::string get_termname() const;
      54                 :            : 
      55                 :            :     /// Return the term frequency for the term at the current position.
      56                 :            :     Xapian::doccount get_termfreq() const;
      57                 :            : 
      58                 :            :     /// Advance the current position to the next term in the termlist.
      59                 :            :     TermList* next();
      60                 :            : 
      61                 :            :     /** Skip forward to the specified term.
      62                 :            :      *
      63                 :            :      *  If the specified term isn't in the list, position ourselves on the
      64                 :            :      *  first term after @a term (or at_end() if no terms after @a term exist).
      65                 :            :      */
      66                 :            :     TermList* skip_to(const std::string& term);
      67                 :            : 
      68                 :            :     /// Return true if the current position is past the last term in this list.
      69                 :            :     bool at_end() const;
      70                 :            : };
      71                 :            : 
      72                 :            : #endif // XAPIAN_INCLUDED_REMOTE_ALLTERMSLIST_H

Generated by: LCOV version 1.11