1 /** @file orpositionlist.h
2 * @brief Merge two PositionList objects using an OR operation.
4 /* Copyright (C) 2007,2010,2017 Olly Betts
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.
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.
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
21 #ifndef XAPIAN_INCLUDED_ORPOSITIONLIST_H
22 #define XAPIAN_INCLUDED_ORPOSITIONLIST_H
24 #include "backends/positionlist.h"
25 #include "api/postlist.h"
27 #include "xapian/error.h"
31 class OrPositionList
: public PositionList
{
32 /// The PositionList sub-objects.
33 std::vector
<PositionList
*> pls
;
35 /** Current positions of the subobjects.
37 * This will be empty when this position list hasn't yet started.
39 std::vector
<Xapian::termpos
> current
;
41 /// Current position of this object.
42 Xapian::termpos current_pos
;
47 PositionList
* gather(PostList
* pl
) {
50 pl
->gather_position_lists(this);
56 void add_poslist(PositionList
* poslist
) {
57 pls
.push_back(poslist
);
60 Xapian::termcount
get_approx_size() const;
62 Xapian::termpos
get_position() const;
66 bool skip_to(Xapian::termpos termpos
);
69 #endif // XAPIAN_INCLUDED_ORPOSITIONLIST_H