LCOV - code coverage report
Current view: top level - harness - index_utils.h (source / functions) Hit Total Coverage
Test: Test Coverage for xapian-core r Lines: 7 7 100.0 %
Date: 2011-08-21 Functions: 3 3 100.0 %
Branches: 6 6 100.0 %

           Branch data     Line data    Source code
       1                 :            : /* index_utils.h - utility functions for indexing testcase data
       2                 :            :  *
       3                 :            :  * Copyright (C) 2005,2007 Olly Betts
       4                 :            :  *
       5                 :            :  * This program is free software; you can redistribute it and/or modify
       6                 :            :  * it under the terms of the GNU General Public License as published by
       7                 :            :  * the Free Software Foundation; either version 2 of the License, or
       8                 :            :  * (at your option) any later version.
       9                 :            :  *
      10                 :            :  * This program is distributed in the hope that it will be useful,
      11                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      12                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      13                 :            :  * GNU General Public License for more details.
      14                 :            :  *
      15                 :            :  * You should have received a copy of the GNU General Public License
      16                 :            :  * along with this program; if not, write to the Free Software
      17                 :            :  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
      18                 :            :  */
      19                 :            : 
      20                 :            : #ifndef XAPIAN_HGUARD_INDEX_UTILS_H
      21                 :            : #define XAPIAN_HGUARD_INDEX_UTILS_H
      22                 :            : 
      23                 :            : #include <fstream>
      24                 :            : #include <string>
      25                 :            : #include <vector>
      26                 :            : 
      27                 :            : #include <xapian.h>
      28                 :            : 
      29                 :            : std::string munge_term(const std::string &term);
      30                 :            : 
      31                 :       1107 : class FileIndexer {
      32                 :            :     std::string datadir;
      33                 :            :     std::vector<std::string>::const_iterator file, end;
      34                 :            :     std::ifstream input;
      35                 :            : 
      36                 :            :     void next_file();
      37                 :            : 
      38                 :            :   public:
      39                 :       1107 :     FileIndexer(const std::string & datadir_,
      40                 :            :                 const std::vector<std::string> & files)
      41                 :       1107 :         : datadir(datadir_), file(files.begin()), end(files.end())
      42                 :            :     {
      43                 :       1107 :         next_file();
      44                 :       1107 :     }
      45                 :            : 
      46                 :      33364 :     operator bool() {
      47 [ +  + ][ +  + ]:      33364 :         return !(file == end && (!input.is_open() || input.eof()));
                 [ +  + ]
      48                 :            :     }
      49                 :            : 
      50                 :            :     Xapian::Document next();
      51                 :            : };
      52                 :            : 
      53                 :            : #endif /* XAPIAN_HGUARD_INDEX_UTILS_H */

Generated by: LCOV version 1.8