Branch data Line data Source code
1 : : /** @file slowvaluelist.h
2 : : * @brief Slow implementation for backends which don't streamed values.
3 : : */
4 : : /* Copyright (C) 2007,2008 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_SLOWVALUELIST_H
22 : : #define XAPIAN_INCLUDED_SLOWVALUELIST_H
23 : :
24 : : #include "valuelist.h"
25 : :
26 : : #include "xapian/database.h"
27 : :
28 : : /** Slow implementation for backends which don't streamed values.
29 : : *
30 : : * Used by flint, inmemory, and remote backends.
31 : : */
32 [ + - ][ # # ]: 8751 : class SlowValueList : public ValueList {
33 : : /// Don't allow assignment.
34 : : void operator=(const SlowValueList &);
35 : :
36 : : /// Don't allow copying.
37 : : SlowValueList(const SlowValueList &);
38 : :
39 : : /// The database.
40 : : Xapian::Database db;
41 : :
42 : : /// The last docid in the database, or 0 if we're at_end.
43 : : Xapian::docid last_docid;
44 : :
45 : : /// The value slot we're iterating over.
46 : : Xapian::valueno slot;
47 : :
48 : : /// The value at the current position.
49 : : std::string current_value;
50 : :
51 : : /// The document id at the current position.
52 : : Xapian::docid current_did;
53 : :
54 : : public:
55 : 8751 : SlowValueList(const Xapian::Database &db_, Xapian::valueno slot_)
56 : 8751 : : db(db_), last_docid(db.get_lastdocid()), slot(slot_), current_did(0)
57 : 8751 : { }
58 : :
59 : : Xapian::docid get_docid() const;
60 : :
61 : : std::string get_value() const;
62 : :
63 : : Xapian::valueno get_valueno() const;
64 : :
65 : : bool at_end() const;
66 : :
67 : : void next();
68 : :
69 : : void skip_to(Xapian::docid);
70 : :
71 : : bool check(Xapian::docid did);
72 : :
73 : : std::string get_description() const;
74 : : };
75 : :
76 : : #endif // XAPIAN_INCLUDED_SLOWVALUELIST_H
|