Branch data Line data Source code
1 : : /** @file honey_document.h
2 : : * @brief A document read from a HoneyDatabase.
3 : : */
4 : : /* Copyright (C) 2008,2009,2010,2011,2017 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 : : #ifndef XAPIAN_INCLUDED_HONEY_DOCUMENT_H
22 : : #define XAPIAN_INCLUDED_HONEY_DOCUMENT_H
23 : :
24 : : #include "honey_docdata.h"
25 : : #include "honey_values.h"
26 : : #include "backends/databaseinternal.h"
27 : : #include "backends/documentinternal.h"
28 : :
29 : : /// A document read from a HoneyDatabase.
30 [ - + ]: 136416 : class HoneyDocument : public Xapian::Document::Internal {
31 : : /// Don't allow assignment.
32 : : void operator=(const HoneyDocument &);
33 : :
34 : : /// Don't allow copying.
35 : : HoneyDocument(const HoneyDocument &);
36 : :
37 : : /// Used for lazy access to document values.
38 : : const HoneyValueManager *value_manager;
39 : :
40 : : /// Used for lazy access to document data.
41 : : const HoneyDocDataTable *docdata_table;
42 : :
43 : : /// HoneyDatabase::open_document() needs to call our private constructor.
44 : : friend class HoneyDatabase;
45 : :
46 : : /// Private constructor - only called by HoneyDatabase::open_document().
47 : 34104 : HoneyDocument(const Xapian::Database::Internal* db,
48 : : Xapian::docid did_,
49 : : const HoneyValueManager *value_manager_,
50 : : const HoneyDocDataTable *docdata_table_)
51 : : : Xapian::Document::Internal(db, did_),
52 [ + - ]: 34104 : value_manager(value_manager_), docdata_table(docdata_table_) { }
53 : :
54 : : protected:
55 : : /** Implementation of virtual methods @{ */
56 : : string fetch_value(Xapian::valueno slot) const;
57 : : void fetch_all_values(map<Xapian::valueno, string> & values_) const;
58 : : string fetch_data() const;
59 : : /** @} */
60 : : };
61 : :
62 : : #endif // XAPIAN_INCLUDED_HONEY_DOCUMENT_H
|