LCOV - code coverage report
Current view: top level - api - vectortermlist.cc (source / functions) Hit Total Coverage
Test: Test Coverage for xapian-core 954b5873a738 Lines: 11 24 45.8 %
Date: 2019-06-30 05:20:33 Functions: 3 9 33.3 %
Branches: 3 28 10.7 %

           Branch data     Line data    Source code
       1                 :            : /** @file vectortermlist.cc
       2                 :            :  * @brief A vector-like container of terms which can be iterated.
       3                 :            :  */
       4                 :            : /* Copyright (C) 2011,2015 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                 :            : #include <config.h>
      22                 :            : 
      23                 :            : #include "vectortermlist.h"
      24                 :            : 
      25                 :            : #include "omassert.h"
      26                 :            : #include "pack.h"
      27                 :            : #include "xapian/error.h"
      28                 :            : 
      29                 :            : using namespace std;
      30                 :            : 
      31                 :            : Xapian::termcount
      32                 :          0 : VectorTermList::get_approx_size() const
      33                 :            : {
      34                 :          0 :     return num_terms;
      35                 :            : }
      36                 :            : 
      37                 :            : string
      38                 :     547047 : VectorTermList::get_termname() const
      39                 :            : {
      40                 :            :     // Check we've started but not reached the end.
      41                 :            :     Assert(p != data.data());
      42                 :            :     Assert(!VectorTermList::at_end());
      43                 :     547047 :     return current_term;
      44                 :            : }
      45                 :            : 
      46                 :            : Xapian::termcount
      47                 :          0 : VectorTermList::get_wdf() const
      48                 :            : {
      49                 :            :     // Check we've started but not reached the end.
      50                 :            :     Assert(p != data.data());
      51                 :            :     Assert(!VectorTermList::at_end());
      52                 :          0 :     return 1;
      53                 :            : }
      54                 :            : 
      55                 :            : Xapian::doccount
      56                 :          0 : VectorTermList::get_termfreq() const
      57                 :            : {
      58 [ #  # ][ #  # ]:          0 :     throw Xapian::InvalidOperationError("VectorTermList::get_termfreq() not meaningful");
                 [ #  # ]
      59                 :            : }
      60                 :            : 
      61                 :            : TermList *
      62                 :     869927 : VectorTermList::next()
      63                 :            : {
      64                 :            :     // Check we've not reached the end.
      65                 :            :     Assert(!VectorTermList::at_end());
      66                 :            : 
      67                 :     869927 :     const char * end = data.data() + data.size();
      68         [ +  + ]:     869927 :     if (p == end) {
      69                 :     322712 :         current_term.resize(0);
      70                 :     322712 :         p = NULL;
      71                 :            :     } else {
      72         [ -  + ]:     547215 :         if (!unpack_string(&p, end, current_term)) {
      73                 :          0 :             unpack_throw_serialisation_error(p);
      74                 :            :         }
      75                 :            :     }
      76                 :            : 
      77                 :     869927 :     return NULL;
      78                 :            : }
      79                 :            : 
      80                 :            : TermList *
      81                 :          0 : VectorTermList::skip_to(const string &)
      82                 :            : {
      83                 :            :     // skip_to only makes sense for termlists which are in sorted order.
      84 [ #  # ][ #  # ]:          0 :     throw Xapian::InvalidOperationError("VectorTermList::skip_to() not meaningful");
                 [ #  # ]
      85                 :            : }
      86                 :            : 
      87                 :            : bool
      88                 :     869927 : VectorTermList::at_end() const
      89                 :            : {
      90                 :     869927 :     return p == NULL;
      91                 :            : }
      92                 :            : 
      93                 :            : Xapian::termcount
      94                 :          0 : VectorTermList::positionlist_count() const
      95                 :            : {
      96 [ #  # ][ #  # ]:          0 :     throw Xapian::InvalidOperationError("VectorTermList::positionlist_count() not meaningful");
                 [ #  # ]
      97                 :            : }
      98                 :            : 
      99                 :            : PositionList*
     100                 :          0 : VectorTermList::positionlist_begin() const
     101                 :            : {
     102 [ #  # ][ #  # ]:          0 :     throw Xapian::InvalidOperationError("VectorTermList::positionlist_begin() not meaningful");
                 [ #  # ]
     103                 :            : }

Generated by: LCOV version 1.11