LCOV - code coverage report
Current view: top level - backends/inmemory - inmemory_document.cc (source / functions) Hit Total Coverage
Test: Test Coverage for xapian-core r Lines: 17 17 100.0 %
Date: 2011-08-21 Functions: 3 3 100.0 %
Branches: 5 6 83.3 %

           Branch data     Line data    Source code
       1                 :            : /** @file inmemory_document.cc
       2                 :            :  * @brief A document read from a InMemoryDatabase.
       3                 :            :  */
       4                 :            : /* Copyright (C) 2008,2009 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 "inmemory_document.h"
      24                 :            : 
      25                 :            : #include "inmemory_database.h"
      26                 :            : 
      27                 :            : #include "debuglog.h"
      28                 :            : 
      29                 :            : string
      30                 :     350509 : InMemoryDocument::do_get_value(Xapian::valueno slot) const
      31                 :            : {
      32                 :            :     LOGCALL(DB, string, "InMemoryDocument::do_get_value", slot);
      33                 :            :     const InMemoryDatabase * db;
      34                 :     350509 :     db = static_cast<const InMemoryDatabase*>(database.get());
      35                 :     350509 :     map<Xapian::valueno, string> values_ = db->valuelists[did - 1];
      36                 :     350509 :     map<Xapian::valueno, string>::const_iterator i;
      37                 :     350509 :     i = values_.find(slot);
      38         [ +  + ]:     350509 :     if (i == values_.end())
      39                 :       9288 :         RETURN(string());
      40                 :     350509 :     RETURN(i->second);
      41                 :            : }
      42                 :            : 
      43                 :            : void
      44                 :      12038 : InMemoryDocument::do_get_all_values(map<Xapian::valueno, string> &values_) const
      45                 :            : {
      46                 :            :     LOGCALL_VOID(DB, "InMemoryDocument::do_get_all_values", values_);
      47                 :            :     const InMemoryDatabase * db;
      48                 :      12038 :     db = static_cast<const InMemoryDatabase*>(database.get());
      49         [ -  + ]:      12038 :     if (db->closed) InMemoryDatabase::throw_database_closed();
      50                 :      12038 :     values_ = db->valuelists[did - 1];
      51                 :      12038 : }
      52                 :            : 
      53                 :            : string
      54                 :        692 : InMemoryDocument::do_get_data() const
      55                 :            : {
      56                 :            :     LOGCALL(DB, string, "InMemoryDocument::do_get_data", NO_ARGS);
      57                 :            :     const InMemoryDatabase * db;
      58                 :        692 :     db = static_cast<const InMemoryDatabase*>(database.get());
      59         [ +  + ]:        692 :     if (db->closed) InMemoryDatabase::throw_database_closed();
      60                 :        691 :     RETURN(db->doclists[did - 1]);
      61                 :            : }

Generated by: LCOV version 1.8