LCOV - code coverage report
Current view: top level - tests/harness - index_utils.h (source / functions) Hit Total Coverage
Test: Test Coverage for xapian-core 954b5873a738 Lines: 5 5 100.0 %
Date: 2019-06-30 05:20:33 Functions: 2 2 100.0 %
Branches: 2 4 50.0 %

           Branch data     Line data    Source code
       1                 :            : /** @file index_utils.h
       2                 :            :  * @brief utility functions for indexing testcase data
       3                 :            :  */
       4                 :            : /* Copyright (C) 2005,2007,2013 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_INDEX_UTILS_H
      22                 :            : #define XAPIAN_INCLUDED_INDEX_UTILS_H
      23                 :            : 
      24                 :            : #include <fstream>
      25                 :            : #include <string>
      26                 :            : #include <vector>
      27                 :            : 
      28                 :            : #include <xapian.h>
      29                 :            : 
      30                 :       2378 : class FileIndexer {
      31                 :            :     std::string datadir;
      32                 :            :     std::vector<std::string>::const_iterator file, end;
      33                 :            :     std::ifstream input;
      34                 :            : 
      35                 :            :     void next_file();
      36                 :            : 
      37                 :            :   public:
      38                 :       1189 :     FileIndexer(const std::string & datadir_,
      39                 :            :                 const std::vector<std::string> & files)
      40         [ +  - ]:       1189 :         : datadir(datadir_), file(files.begin()), end(files.end())
      41                 :            :     {
      42         [ +  - ]:       1189 :         next_file();
      43                 :       1189 :     }
      44                 :            : 
      45                 :            :     void index_to(Xapian::WritableDatabase & db);
      46                 :            : };
      47                 :            : 
      48                 :            : #endif /* XAPIAN_INCLUDED_INDEX_UTILS_H */

Generated by: LCOV version 1.11