LCOV - code coverage report
Current view: top level - backends/flint - flint_values.h (source / functions) Hit Total Coverage
Test: Test Coverage for xapian-core r Lines: 3 3 100.0 %
Date: 2011-08-21 Functions: 2 2 100.0 %
Branches: 0 0 -

           Branch data     Line data    Source code
       1                 :            : /* flint_values.h: Values in flint databases
       2                 :            :  *
       3                 :            :  * Copyright 1999,2000,2001 BrightStation PLC
       4                 :            :  * Copyright 2002 Ananova Ltd
       5                 :            :  * Copyright 2002,2003,2004,2008 Olly Betts
       6                 :            :  *
       7                 :            :  * This program is free software; you can redistribute it and/or
       8                 :            :  * modify it under the terms of the GNU General Public License as
       9                 :            :  * published by the Free Software Foundation; either version 2 of the
      10                 :            :  * License, or (at your option) any later version.
      11                 :            :  *
      12                 :            :  * This program is distributed in the hope that it will be useful,
      13                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      14                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      15                 :            :  * GNU General Public License for more details.
      16                 :            :  *
      17                 :            :  * You should have received a copy of the GNU General Public License
      18                 :            :  * along with this program; if not, write to the Free Software
      19                 :            :  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301
      20                 :            :  * USA
      21                 :            :  */
      22                 :            : 
      23                 :            : #ifndef OM_HGUARD_FLINT_VALUES_H
      24                 :            : #define OM_HGUARD_FLINT_VALUES_H
      25                 :            : 
      26                 :            : #include <map>
      27                 :            : #include <string>
      28                 :            : 
      29                 :            : #include <xapian/types.h>
      30                 :            : #include <xapian/valueiterator.h>
      31                 :            : #include "flint_table.h"
      32                 :            : 
      33                 :            : using namespace std;
      34                 :            : 
      35                 :       2193 : class FlintValueTable : public FlintTable {
      36                 :            :     private:
      37                 :            :         /** Read an entry from position.  Throw appropriate exceptions if
      38                 :            :          *  data runs out.
      39                 :            :          */
      40                 :            :         static void unpack_entry(const char ** pos,
      41                 :            :                                  const char * end,
      42                 :            :                                  Xapian::valueno * this_value_no,
      43                 :            :                                  string & this_value);
      44                 :            : 
      45                 :            :     public:
      46                 :            :         /** Create a new table object.
      47                 :            :          *
      48                 :            :          *  This does not create the table on disk - the create() method must
      49                 :            :          *  be called before the table is created on disk
      50                 :            :          *
      51                 :            :          *  This also does not open the table - the open() method must be
      52                 :            :          *  called before use is made of the table.
      53                 :            :          *
      54                 :            :          *  @param path_          - Path at which the table is stored.
      55                 :            :          *  @param readonly_      - whether to open the table for read only
      56                 :            :          *                          access.
      57                 :            :          */
      58                 :       2193 :         FlintValueTable(const string & path_, bool readonly_)
      59                 :       2193 :             : FlintTable("value", path_ + "/value.", readonly_, DONT_COMPRESS, true) { }
      60                 :            : 
      61                 :            :         /** Encode values as a string ready to add to the table.
      62                 :            :          */
      63                 :            :         void encode_values(string & s,
      64                 :            :                            Xapian::ValueIterator it,
      65                 :            :                            const Xapian::ValueIterator & end);
      66                 :            : 
      67                 :            :         /** Set values for document @a did encoded as a string. */
      68                 :            :         void set_encoded_values(Xapian::docid did, const string & enc);
      69                 :            : 
      70                 :            :         /** Get a value.
      71                 :            :          *
      72                 :            :          *  @return The value if found, a null value otherwise.
      73                 :            :          */
      74                 :            :         void get_value(string & value, Xapian::docid did,
      75                 :            :                        Xapian::valueno valueno) const;
      76                 :            : 
      77                 :            :         /** Get all values.
      78                 :            :          *
      79                 :            :          *  @param values  A map to be filled with all the values
      80                 :            :          *                     for the specified document.
      81                 :            :          *
      82                 :            :          */
      83                 :            :         void get_all_values(map<Xapian::valueno, string> & values,
      84                 :            :                             Xapian::docid did) const;
      85                 :            : 
      86                 :            :         /** Remove all values.
      87                 :            :          *
      88                 :            :          *  @param did  The document id for which to remove the values.
      89                 :            :          *
      90                 :            :          */
      91                 :            :         void delete_all_values(Xapian::docid did);
      92                 :            : };
      93                 :            : 
      94                 :            : #endif /* OM_HGUARD_FLINT_VALUES_H */

Generated by: LCOV version 1.8