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

           Branch data     Line data    Source code
       1                 :            : /** @file backendmanager_inmemory.cc
       2                 :            :  * @brief BackendManager subclass for inmemory databases.
       3                 :            :  */
       4                 :            : /* Copyright (C) 2007,2009,2018 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 "backendmanager_inmemory.h"
      24                 :            : 
      25                 :            : using namespace std;
      26                 :            : 
      27                 :            : std::string
      28                 :         26 : BackendManagerInMemory::get_dbtype() const
      29                 :            : {
      30         [ +  - ]:         26 :     return "inmemory";
      31                 :            : }
      32                 :            : 
      33                 :            : Xapian::Database
      34                 :        274 : BackendManagerInMemory::do_get_database(const vector<string>& files)
      35                 :            : {
      36 [ +  - ][ +  - ]:        274 :     Xapian::WritableDatabase wdb(string(), Xapian::DB_BACKEND_INMEMORY);
      37         [ +  - ]:        274 :     index_files_to_database(wdb, files);
      38         [ +  - ]:        274 :     return std::move(wdb);
      39                 :            : }
      40                 :            : 
      41                 :            : Xapian::WritableDatabase
      42                 :         92 : BackendManagerInMemory::get_writable_database(const string&,
      43                 :            :                                               const string& file)
      44                 :            : {
      45         [ +  - ]:         92 :     Xapian::WritableDatabase wdb(string(), Xapian::DB_BACKEND_INMEMORY);
      46 [ +  - ][ +  - ]:         92 :     index_files_to_database(wdb, vector<string>(1, file));
      47                 :         92 :     return wdb;
      48                 :            : }
      49                 :            : 
      50                 :            : string
      51                 :         25 : BackendManagerInMemory::get_generated_database_path(const std::string&)
      52                 :            : {
      53                 :         25 :     return string();
      54                 :            : }

Generated by: LCOV version 1.11