xapian-core  2.0.0
rset.h
Go to the documentation of this file.
1 
4 /* Copyright (C) 2015,2016,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, see
18  * <https://www.gnu.org/licenses/>.
19  */
20 
21 #ifndef XAPIAN_INCLUDED_RSET_H
22 #define XAPIAN_INCLUDED_RSET_H
23 
24 #if !defined XAPIAN_IN_XAPIAN_H && !defined XAPIAN_LIB_BUILD
25 # error Never use <xapian/rset.h> directly; include <xapian.h> instead.
26 #endif
27 
28 #include <xapian/attributes.h>
29 #include <xapian/intrusive_ptr.h>
30 #include <xapian/mset.h>
31 #include <xapian/types.h>
32 #include <xapian/visibility.h>
33 
34 namespace Xapian {
35 
36 class ESetIterator;
37 
40  public:
42  class Internal;
45 
50  RSet(const RSet & o);
51 
56  RSet & operator=(const RSet & o);
57 
59  RSet(RSet && o);
60 
62  RSet & operator=(RSet && o);
63 
68  RSet();
69 
72  explicit RSet(Internal* internal_);
73 
75  ~RSet();
76 
78  Xapian::doccount size() const;
79 
81  bool empty() const { return size() == 0; }
82 
84  void swap(RSet & o) { internal.swap(o.internal); }
85 
90  void add_document(Xapian::docid did);
91 
97  add_document(*it);
98  }
99 
104  void remove_document(Xapian::docid did);
105 
111  remove_document(*it);
112  }
113 
115  bool contains(Xapian::docid did) const;
116 
118  bool contains(const Xapian::MSetIterator& it) const {
119  return contains(*it);
120  }
121 
123  std::string get_description() const;
124 };
125 
126 }
127 
128 #endif // XAPIAN_INCLUDED_RSET_H
Compiler attribute macros.
A smart pointer that uses intrusive reference counting.
Definition: intrusive_ptr.h:83
Iterator over a Xapian::MSet.
Definition: mset.h:535
Class representing a set of documents judged as relevant.
Definition: rset.h:39
void remove_document(const Xapian::MSetIterator &it)
Unmark a document as relevant.
Definition: rset.h:110
RSet(const RSet &o)
Copying is allowed.
Xapian::Internal::intrusive_ptr< Internal > internal
Definition: rset.h:42
bool contains(const Xapian::MSetIterator &it) const
Check if a document is marked as relevant.
Definition: rset.h:118
RSet(RSet &&o)
Move constructor.
void add_document(const Xapian::MSetIterator &it)
Mark a document as relevant.
Definition: rset.h:96
RSet & operator=(RSet &&o)
Move assignment operator.
RSet & operator=(const RSet &o)
Copying is allowed.
bool empty() const
Return true if this RSet object is empty.
Definition: rset.h:81
void swap(RSet &o)
Efficiently swap this RSet object with another.
Definition: rset.h:84
Class representing a list of search results.
The Xapian namespace contains public interfaces for the Xapian library.
Definition: compactor.cc:82
unsigned XAPIAN_DOCID_BASE_TYPE doccount
A count of documents.
Definition: types.h:37
unsigned XAPIAN_DOCID_BASE_TYPE docid
A unique identifier for a document.
Definition: types.h:51
bool contains(std::string_view s, char substring)
Definition: stringutils.h:104
typedefs for Xapian
Define XAPIAN_VISIBILITY_* macros.
#define XAPIAN_VISIBILITY_DEFAULT
Definition: visibility.h:28
#define XAPIAN_VISIBILITY_INTERNAL
Definition: visibility.h:29