LCOV - code coverage report
Current view: top level - api - documenttermlist.h (source / functions) Hit Total Coverage
Test: Test Coverage for xapian-core eba1a2e3082b Lines: 3 3 100.0 %
Date: 2019-06-13 13:35:36 Functions: 2 2 100.0 %
Branches: 1 2 50.0 %

           Branch data     Line data    Source code
       1                 :            : /** @file documenttermlist.h
       2                 :            :  * @brief Iteration over terms in a document
       3                 :            :  */
       4                 :            : /* Copyright 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_DOCUMENTTERMLIST_H
      22                 :            : #define XAPIAN_INCLUDED_DOCUMENTTERMLIST_H
      23                 :            : 
      24                 :            : #include "termlist.h"
      25                 :            : 
      26                 :            : #include "backends/documentinternal.h"
      27                 :            : 
      28                 :            : #include "omassert.h"
      29                 :            : 
      30                 :            : /// Iteration over terms in a document.
      31         [ -  + ]:     736896 : class DocumentTermList : public TermList {
      32                 :            :     /// Don't allow assignment.
      33                 :            :     void operator=(const DocumentTermList&) = delete;
      34                 :            : 
      35                 :            :     /// Don't allow copying.
      36                 :            :     DocumentTermList(const DocumentTermList&) = delete;
      37                 :            : 
      38                 :            :     /// Document internals we're iterating over.
      39                 :            :     Xapian::Internal::intrusive_ptr<const Xapian::Document::Internal> doc;
      40                 :            : 
      41                 :            :     /** Iterator over the map inside @a doc.
      42                 :            :      *
      43                 :            :      *  If we haven't started yet, this will be set to: doc->terms.end()
      44                 :            :      */
      45                 :            :     std::map<std::string, TermInfo>::const_iterator it;
      46                 :            : 
      47                 :            :   public:
      48                 :            :     explicit
      49                 :     184224 :     DocumentTermList(const Xapian::Document::Internal* doc_)
      50                 :     184224 :         : doc(doc_), it(doc->terms->end()) {}
      51                 :            : 
      52                 :            :     Xapian::termcount get_approx_size() const;
      53                 :            : 
      54                 :            :     std::string get_termname() const;
      55                 :            : 
      56                 :            :     Xapian::termcount get_wdf() const;
      57                 :            : 
      58                 :            :     Xapian::doccount get_termfreq() const;
      59                 :            : 
      60                 :            :     const Xapian::VecCOW<Xapian::termpos> * get_vec_termpos() const;
      61                 :            : 
      62                 :            :     PositionList* positionlist_begin() const;
      63                 :            : 
      64                 :            :     Xapian::termcount positionlist_count() const;
      65                 :            : 
      66                 :            :     TermList * next();
      67                 :            : 
      68                 :            :     TermList * skip_to(const std::string& term);
      69                 :            : 
      70                 :            :     bool at_end() const;
      71                 :            : };
      72                 :            : 
      73                 :            : #endif // XAPIAN_INCLUDED_DOCUMENTTERMLIST_H

Generated by: LCOV version 1.11