LCOV - code coverage report
Current view: top level - api - ompositionlistiterator.cc (source / functions) Hit Total Coverage
Test: Test Coverage for xapian-core r Lines: 28 28 100.0 %
Date: 2011-08-21 Functions: 9 13 69.2 %
Branches: 8 12 66.7 %

           Branch data     Line data    Source code
       1                 :            : /* ompositionlistiterator.cc
       2                 :            :  *
       3                 :            :  * Copyright 1999,2000,2001 BrightStation PLC
       4                 :            :  * Copyright 2003,2004,2008 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
      19                 :            :  * USA
      20                 :            :  */
      21                 :            : 
      22                 :            : #include <config.h>
      23                 :            : #include <xapian/positioniterator.h>
      24                 :            : #include "positionlist.h"
      25                 :            : #include "debuglog.h"
      26                 :            : #include "omassert.h"
      27                 :            : 
      28                 :   12747008 : Xapian::PositionIterator::PositionIterator(Internal *internal_)
      29                 :   12747008 :         : internal(internal_)
      30                 :            : {
      31   [ +  +  #  # ]:   12747008 :     if (internal.get()) {
      32                 :    4575893 :         internal->next();
      33   [ +  +  #  # ]:    4575893 :         if (internal->at_end()) internal = 0;
      34                 :            :     }
      35                 :   12747008 : }
      36                 :            : 
      37                 :    1308547 : Xapian::PositionIterator::PositionIterator() : internal(0)
      38                 :            : {
      39                 :    1308547 : }
      40                 :            : 
      41                 :   15835562 : Xapian::PositionIterator::PositionIterator(const Xapian::PositionIterator &o)
      42                 :   15835562 :         : internal(o.internal)
      43                 :            : {
      44                 :   15835562 : }
      45                 :            : 
      46                 :   29891117 : Xapian::PositionIterator::~PositionIterator()
      47                 :            : {
      48                 :   29891117 : }
      49                 :            : 
      50                 :            : void
      51                 :    1308628 : Xapian::PositionIterator::operator=(const Xapian::PositionIterator &o)
      52                 :            : {
      53                 :    1308628 :     internal = o.internal;
      54                 :    1308628 : }
      55                 :            : 
      56                 :            : Xapian::termpos
      57                 :    6281234 : Xapian::PositionIterator::operator *() const
      58                 :            : {
      59                 :            :     LOGCALL(API, Xapian::termpos, "Xapian::PositionIterator::operator*", NO_ARGS);
      60                 :            :     Assert(internal.get());
      61                 :            :     Assert(!internal->at_end());
      62                 :    6281234 :     RETURN(internal->get_position());
      63                 :            : }
      64                 :            : 
      65                 :            : Xapian::PositionIterator &
      66                 :    4948057 : Xapian::PositionIterator::operator++()
      67                 :            : {
      68                 :            :     LOGCALL_VOID(API, "Xapian::PositionIterator::operator++", NO_ARGS);
      69                 :            :     Assert(internal.get());
      70                 :            :     Assert(!internal->at_end());
      71                 :    4948057 :     internal->next();
      72         [ +  + ]:    4948057 :     if (internal->at_end()) internal = 0;
      73                 :    4948057 :     return *this;
      74                 :            : }
      75                 :            : 
      76                 :            : // extra method, not required to be an input_iterator
      77                 :            : void
      78                 :         40 : Xapian::PositionIterator::skip_to(Xapian::termpos pos)
      79                 :            : {
      80                 :            :     LOGCALL_VOID(API, "Xapian::PositionIterator::skip_to", pos);
      81                 :            :     Assert(internal.get());
      82                 :            :     Assert(!internal->at_end());
      83                 :         40 :     internal->skip_to(pos);
      84         [ +  + ]:         40 :     if (internal->at_end()) internal = 0;
      85                 :         40 : }    
      86                 :            : 
      87                 :            : std::string
      88                 :          1 : Xapian::PositionIterator::get_description() const
      89                 :            : {
      90                 :            :     /// \todo display contents of the object
      91                 :          1 :     return "Xapian::PositionIterator()";
      92                 :            : }

Generated by: LCOV version 1.8