xapian-core  1.4.31
api_generated.cc
Go to the documentation of this file.
1 
4 /* Warning: This file is generated by ./generate-api_generated - do not modify directly! */
5 /* Copyright (C) 2007-2026 Olly Betts
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 2 of the License, or
10  * (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 USA
20  */
21 
22 #include <config.h>
23 
24 #include "api_generated.h"
25 
26 #define XAPIAN_DEPRECATED(D) D
27 #include <xapian.h>
28 
29 #include "apitest.h"
30 #include "testutils.h"
31 
32 using namespace std;
33 
35 DEFINE_TESTCASE(defaultctor1, !backend) {
36  Xapian::BB2Weight bb2weight;
37  Xapian::BM25PlusWeight bm25plusweight;
38  Xapian::BM25Weight bm25weight;
39  Xapian::BoolWeight boolweight;
40  Xapian::CoordWeight coordweight;
41  Xapian::DLHWeight dlhweight;
42  Xapian::DPHWeight dphweight;
43  Xapian::DateRangeProcessor daterangeprocessor(0);
44  Xapian::DateValueRangeProcessor datevaluerangeprocessor(0);
45  Xapian::DecreasingValueWeightPostingSource decreasingvalueweightpostingsource(0);
46  TEST(!decreasingvalueweightpostingsource.get_description().empty());
47  Xapian::FixedWeightPostingSource fixedweightpostingsource(0);
48  TEST(!fixedweightpostingsource.get_description().empty());
49  Xapian::IfB2Weight ifb2weight;
50  Xapian::InL2Weight inl2weight;
51  Xapian::IneB2Weight ineb2weight;
52  Xapian::LMWeight lmweight;
53  Xapian::MultiValueKeyMaker multivaluekeymaker;
54  Xapian::NumberRangeProcessor numberrangeprocessor(0, "");
55  Xapian::NumberValueRangeProcessor numbervaluerangeprocessor(0, "");
56  Xapian::PL2PlusWeight pl2plusweight;
57  Xapian::PL2Weight pl2weight;
58  Xapian::RangeProcessor rangeprocessor;
59  Xapian::SimpleStopper simplestopper;
60  TEST(!simplestopper.get_description().empty());
61  Xapian::StringValueRangeProcessor stringvaluerangeprocessor(0);
62  Xapian::TfIdfWeight tfidfweight;
63  Xapian::TradWeight tradweight;
64  Xapian::ValueCountMatchSpy valuecountmatchspy(0);
65  TEST(!valuecountmatchspy.get_description().empty());
66  Xapian::ValueMapPostingSource valuemappostingsource(0);
67  TEST(!valuemappostingsource.get_description().empty());
68  Xapian::ValuePostingSource valuepostingsource(0);
69  TEST(!valuepostingsource.get_description().empty());
70  Xapian::ValueWeightPostingSource valueweightpostingsource(0);
71  TEST(!valueweightpostingsource.get_description().empty());
72 }
73 
75 DEFINE_TESTCASE(copyassign1, !backend) {
76  Xapian::Database database;
77  TEST(!database.get_description().empty());
78  Xapian::Database copy_database(database);
79  TEST(!copy_database.get_description().empty());
80  Xapian::Database move_database(std::move(database));
81  TEST(!move_database.get_description().empty());
82  database = copy_database;
83  TEST(!database.get_description().empty());
84  copy_database = std::move(move_database);
85  TEST(!copy_database.get_description().empty());
86 
87  Xapian::Document document;
88  TEST(!document.get_description().empty());
89  Xapian::Document copy_document(document);
90  TEST(!copy_document.get_description().empty());
91  Xapian::Document move_document(std::move(document));
92  TEST(!move_document.get_description().empty());
93  document = copy_document;
94  TEST(!document.get_description().empty());
95  copy_document = std::move(move_document);
96  TEST(!copy_document.get_description().empty());
97 
98  Xapian::ESet eset;
99  TEST(!eset.get_description().empty());
100  Xapian::ESet copy_eset(eset);
101  TEST(!copy_eset.get_description().empty());
102  Xapian::ESet move_eset(std::move(eset));
103  TEST(!move_eset.get_description().empty());
104  eset = copy_eset;
105  TEST(!eset.get_description().empty());
106  copy_eset = std::move(move_eset);
107  TEST(!copy_eset.get_description().empty());
108 
109  Xapian::ESetIterator esetiterator;
110  TEST(!esetiterator.get_description().empty());
111  Xapian::ESetIterator copy_esetiterator(esetiterator);
112  TEST(!copy_esetiterator.get_description().empty());
113  Xapian::ESetIterator move_esetiterator(std::move(esetiterator));
114  TEST(!move_esetiterator.get_description().empty());
115  esetiterator = copy_esetiterator;
116  TEST(!esetiterator.get_description().empty());
117  copy_esetiterator = std::move(move_esetiterator);
118  TEST(!copy_esetiterator.get_description().empty());
119 
120 #ifdef XAPIAN_HAS_INMEMORY_BACKEND
122  TEST(!enquire.get_description().empty());
123  Xapian::Enquire copy_enquire(enquire);
124  TEST(!copy_enquire.get_description().empty());
125  Xapian::Enquire move_enquire(std::move(enquire));
126  TEST(!move_enquire.get_description().empty());
127  enquire = copy_enquire;
128  TEST(!enquire.get_description().empty());
129  copy_enquire = std::move(move_enquire);
130  TEST(!copy_enquire.get_description().empty());
131 #endif
132 
133  Xapian::MSet mset;
134  TEST(!mset.get_description().empty());
135  Xapian::MSet copy_mset(mset);
136  TEST(!copy_mset.get_description().empty());
137  Xapian::MSet move_mset(std::move(mset));
138  TEST(!move_mset.get_description().empty());
139  mset = copy_mset;
140  TEST(!mset.get_description().empty());
141  copy_mset = std::move(move_mset);
142  TEST(!copy_mset.get_description().empty());
143 
144  Xapian::MSetIterator msetiterator;
145  TEST(!msetiterator.get_description().empty());
146  Xapian::MSetIterator copy_msetiterator(msetiterator);
147  TEST(!copy_msetiterator.get_description().empty());
148  Xapian::MSetIterator move_msetiterator(std::move(msetiterator));
149  TEST(!move_msetiterator.get_description().empty());
150  msetiterator = copy_msetiterator;
151  TEST(!msetiterator.get_description().empty());
152  copy_msetiterator = std::move(move_msetiterator);
153  TEST(!copy_msetiterator.get_description().empty());
154 
155  Xapian::PositionIterator positioniterator;
156  TEST(!positioniterator.get_description().empty());
157  Xapian::PositionIterator copy_positioniterator(positioniterator);
158  TEST(!copy_positioniterator.get_description().empty());
159  Xapian::PositionIterator move_positioniterator(std::move(positioniterator));
160  TEST(!move_positioniterator.get_description().empty());
161  positioniterator = copy_positioniterator;
162  TEST(!positioniterator.get_description().empty());
163  copy_positioniterator = std::move(move_positioniterator);
164  TEST(!copy_positioniterator.get_description().empty());
165 
166  Xapian::PostingIterator postingiterator;
167  TEST(!postingiterator.get_description().empty());
168  Xapian::PostingIterator copy_postingiterator(postingiterator);
169  TEST(!copy_postingiterator.get_description().empty());
170  Xapian::PostingIterator move_postingiterator(std::move(postingiterator));
171  TEST(!move_postingiterator.get_description().empty());
172  postingiterator = copy_postingiterator;
173  TEST(!postingiterator.get_description().empty());
174  copy_postingiterator = std::move(move_postingiterator);
175  TEST(!copy_postingiterator.get_description().empty());
176 
178  TEST(!query.get_description().empty());
179  Xapian::Query copy_query(query);
180  TEST(!copy_query.get_description().empty());
181  Xapian::Query move_query(std::move(query));
182  TEST(!move_query.get_description().empty());
183  query = copy_query;
184  TEST(!query.get_description().empty());
185  copy_query = std::move(move_query);
186  TEST(!copy_query.get_description().empty());
187 
188  Xapian::QueryParser queryparser;
189  TEST(!queryparser.get_description().empty());
190  Xapian::QueryParser copy_queryparser(queryparser);
191  TEST(!copy_queryparser.get_description().empty());
192  Xapian::QueryParser move_queryparser(std::move(queryparser));
193  TEST(!move_queryparser.get_description().empty());
194  queryparser = copy_queryparser;
195  TEST(!queryparser.get_description().empty());
196  copy_queryparser = std::move(move_queryparser);
197  TEST(!copy_queryparser.get_description().empty());
198 
199  Xapian::RSet rset;
200  TEST(!rset.get_description().empty());
201  Xapian::RSet copy_rset(rset);
202  TEST(!copy_rset.get_description().empty());
203  Xapian::RSet move_rset(std::move(rset));
204  TEST(!move_rset.get_description().empty());
205  rset = copy_rset;
206  TEST(!rset.get_description().empty());
207  copy_rset = std::move(move_rset);
208  TEST(!copy_rset.get_description().empty());
209 
210  Xapian::Registry registry;
211  Xapian::Registry copy_registry(registry);
212  Xapian::Registry move_registry(std::move(registry));
213  registry = copy_registry;
214  copy_registry = std::move(move_registry);
215 
216  Xapian::Stem stem;
217  TEST(!stem.get_description().empty());
218  Xapian::Stem copy_stem(stem);
219  TEST(!copy_stem.get_description().empty());
220  Xapian::Stem move_stem(std::move(stem));
221  TEST(!move_stem.get_description().empty());
222  stem = copy_stem;
223  TEST(!stem.get_description().empty());
224  copy_stem = std::move(move_stem);
225  TEST(!copy_stem.get_description().empty());
226 
227  Xapian::TermGenerator termgenerator;
228  TEST(!termgenerator.get_description().empty());
229  Xapian::TermGenerator copy_termgenerator(termgenerator);
230  TEST(!copy_termgenerator.get_description().empty());
231  Xapian::TermGenerator move_termgenerator(std::move(termgenerator));
232  TEST(!move_termgenerator.get_description().empty());
233  termgenerator = copy_termgenerator;
234  TEST(!termgenerator.get_description().empty());
235  copy_termgenerator = std::move(move_termgenerator);
236  TEST(!copy_termgenerator.get_description().empty());
237 
238  Xapian::TermIterator termiterator;
239  TEST(!termiterator.get_description().empty());
240  Xapian::TermIterator copy_termiterator(termiterator);
241  TEST(!copy_termiterator.get_description().empty());
242  Xapian::TermIterator move_termiterator(std::move(termiterator));
243  TEST(!move_termiterator.get_description().empty());
244  termiterator = copy_termiterator;
245  TEST(!termiterator.get_description().empty());
246  copy_termiterator = std::move(move_termiterator);
247  TEST(!copy_termiterator.get_description().empty());
248 
249  Xapian::Utf8Iterator utf8iterator;
250  Xapian::Utf8Iterator copy_utf8iterator(utf8iterator);
251  Xapian::Utf8Iterator move_utf8iterator(std::move(utf8iterator));
252  utf8iterator = copy_utf8iterator;
253  copy_utf8iterator = std::move(move_utf8iterator);
254 
255  Xapian::ValueIterator valueiterator;
256  TEST(!valueiterator.get_description().empty());
257  Xapian::ValueIterator copy_valueiterator(valueiterator);
258  TEST(!copy_valueiterator.get_description().empty());
259  Xapian::ValueIterator move_valueiterator(std::move(valueiterator));
260  TEST(!move_valueiterator.get_description().empty());
261  valueiterator = copy_valueiterator;
262  TEST(!valueiterator.get_description().empty());
263  copy_valueiterator = std::move(move_valueiterator);
264  TEST(!copy_valueiterator.get_description().empty());
265 
266  Xapian::WritableDatabase writabledatabase;
267  TEST(!writabledatabase.get_description().empty());
268  Xapian::WritableDatabase copy_writabledatabase(writabledatabase);
269  TEST(!copy_writabledatabase.get_description().empty());
270  Xapian::WritableDatabase move_writabledatabase(std::move(writabledatabase));
271  TEST(!move_writabledatabase.get_description().empty());
272  writabledatabase = copy_writabledatabase;
273  TEST(!writabledatabase.get_description().empty());
274  copy_writabledatabase = std::move(move_writabledatabase);
275  TEST(!copy_writabledatabase.get_description().empty());
276 
277 }
278 
280 DEFINE_TESTCASE(itortraits1, !backend) {
281  {
282  using traits = iterator_traits<Xapian::ESetIterator>;
283  using pointer_base = std::remove_pointer<traits::pointer>::type;
284  using reference_base = std::remove_reference<traits::reference>::type;
285  static_assert(is_same<decltype(*std::declval<Xapian::ESetIterator>()),
286  pointer_base>::value,
287  "iterator_traits<ESetIterator>::pointer inconsistent with "
288  "type from dereferencing ESetIterator");
289  static_assert(is_same<decltype(*std::declval<Xapian::ESetIterator>()),
290  reference_base>::value,
291  "iterator_traits<ESetIterator>::reference inconsistent with "
292  "type from dereferencing ESetIterator");
293  }
294  {
295  using traits = iterator_traits<Xapian::MSetIterator>;
296  using pointer_base = std::remove_pointer<traits::pointer>::type;
297  using reference_base = std::remove_reference<traits::reference>::type;
298  static_assert(is_same<decltype(*std::declval<Xapian::MSetIterator>()),
299  pointer_base>::value,
300  "iterator_traits<MSetIterator>::pointer inconsistent with "
301  "type from dereferencing MSetIterator");
302  static_assert(is_same<decltype(*std::declval<Xapian::MSetIterator>()),
303  reference_base>::value,
304  "iterator_traits<MSetIterator>::reference inconsistent with "
305  "type from dereferencing MSetIterator");
306  }
307  {
308  using traits = iterator_traits<Xapian::PositionIterator>;
309  using pointer_base = std::remove_pointer<traits::pointer>::type;
310  using reference_base = std::remove_reference<traits::reference>::type;
311  static_assert(is_same<decltype(*std::declval<Xapian::PositionIterator>()),
312  pointer_base>::value,
313  "iterator_traits<PositionIterator>::pointer inconsistent with "
314  "type from dereferencing PositionIterator");
315  static_assert(is_same<decltype(*std::declval<Xapian::PositionIterator>()),
316  reference_base>::value,
317  "iterator_traits<PositionIterator>::reference inconsistent with "
318  "type from dereferencing PositionIterator");
319  }
320  {
321  using traits = iterator_traits<Xapian::PostingIterator>;
322  using pointer_base = std::remove_pointer<traits::pointer>::type;
323  using reference_base = std::remove_reference<traits::reference>::type;
324  static_assert(is_same<decltype(*std::declval<Xapian::PostingIterator>()),
325  pointer_base>::value,
326  "iterator_traits<PostingIterator>::pointer inconsistent with "
327  "type from dereferencing PostingIterator");
328  static_assert(is_same<decltype(*std::declval<Xapian::PostingIterator>()),
329  reference_base>::value,
330  "iterator_traits<PostingIterator>::reference inconsistent with "
331  "type from dereferencing PostingIterator");
332  }
333  {
334  using traits = iterator_traits<Xapian::TermIterator>;
335  using pointer_base = std::remove_pointer<traits::pointer>::type;
336  using reference_base = std::remove_reference<traits::reference>::type;
337  static_assert(is_same<decltype(*std::declval<Xapian::TermIterator>()),
338  pointer_base>::value,
339  "iterator_traits<TermIterator>::pointer inconsistent with "
340  "type from dereferencing TermIterator");
341  static_assert(is_same<decltype(*std::declval<Xapian::TermIterator>()),
342  reference_base>::value,
343  "iterator_traits<TermIterator>::reference inconsistent with "
344  "type from dereferencing TermIterator");
345  }
346  {
347  using traits = iterator_traits<Xapian::Utf8Iterator>;
348  using pointer_base = std::remove_pointer<traits::pointer>::type;
349  using reference_base = std::remove_reference<traits::reference>::type;
350  static_assert(is_same<decltype(*std::declval<Xapian::Utf8Iterator>()),
351  pointer_base>::value,
352  "iterator_traits<Utf8Iterator>::pointer inconsistent with "
353  "type from dereferencing Utf8Iterator");
354  static_assert(is_same<decltype(*std::declval<Xapian::Utf8Iterator>()),
355  reference_base>::value,
356  "iterator_traits<Utf8Iterator>::reference inconsistent with "
357  "type from dereferencing Utf8Iterator");
358  }
359  {
360  using traits = iterator_traits<Xapian::ValueIterator>;
361  using pointer_base = std::remove_pointer<traits::pointer>::type;
362  using reference_base = std::remove_reference<traits::reference>::type;
363  static_assert(is_same<decltype(*std::declval<Xapian::ValueIterator>()),
364  pointer_base>::value,
365  "iterator_traits<ValueIterator>::pointer inconsistent with "
366  "type from dereferencing ValueIterator");
367  static_assert(is_same<decltype(*std::declval<Xapian::ValueIterator>()),
368  reference_base>::value,
369  "iterator_traits<ValueIterator>::reference inconsistent with "
370  "type from dereferencing ValueIterator");
371  }
372 }
373 
375 DEFINE_TESTCASE(containertraits1, !backend) {
376  {
377  using pointer_base =
378  std::remove_pointer<Xapian::ESet::pointer>::type;
379  using reference_base =
380  std::remove_reference<Xapian::ESet::reference>::type;
381  using value_type = Xapian::ESet::value_type;
382  static_assert(is_same<value_type, pointer_base>::value,
383  "Xapian::ESet::pointer inconsistent with "
384  "Xapian::ESet::value_type");
385  static_assert(is_same<value_type, reference_base>::value,
386  "Xapian::ESet::reference inconsistent with "
387  "Xapian::ESet::value_type");
388  }
389  {
390  using pointer_base =
391  std::remove_pointer<Xapian::MSet::pointer>::type;
392  using reference_base =
393  std::remove_reference<Xapian::MSet::reference>::type;
394  using value_type = Xapian::MSet::value_type;
395  static_assert(is_same<value_type, pointer_base>::value,
396  "Xapian::MSet::pointer inconsistent with "
397  "Xapian::MSet::value_type");
398  static_assert(is_same<value_type, reference_base>::value,
399  "Xapian::MSet::reference inconsistent with "
400  "Xapian::MSet::value_type");
401  }
402 }
static Xapian::Query query(Xapian::Query::op op, const string &t1=string(), const string &t2=string(), const string &t3=string(), const string &t4=string(), const string &t5=string(), const string &t6=string(), const string &t7=string(), const string &t8=string(), const string &t9=string(), const string &t10=string())
Definition: api_anydb.cc:63
DEFINE_TESTCASE(defaultctor1, !backend)
Check uncopyable API classes which should have a default ctor actually do.
test functionality of the Xapian API
This class implements the BB2 weighting scheme.
Definition: weight.h:1060
Xapian::Weight subclass implementing the BM25+ probabilistic formula.
Definition: weight.h:650
Xapian::Weight subclass implementing the BM25 probabilistic formula.
Definition: weight.h:546
Class implementing a "boolean" weighting scheme.
Definition: weight.h:433
Xapian::Weight subclass implementing Coordinate Matching.
Definition: weight.h:1516
This class implements the DLH weighting scheme, which is a representative scheme of the Divergence fr...
Definition: weight.h:1136
This class implements the DPH weighting scheme.
Definition: weight.h:1359
This class is used to access a database, or a group of databases.
Definition: database.h:68
virtual std::string get_description() const
Return a string describing this object.
Definition: omdatabase.cc:548
Handle a date range.
Definition: queryparser.h:255
Handle a date range.
Definition: queryparser.h:539
Read weights from a value which is known to decrease as docid increases.
std::string get_description() const
Return a string describing this object.
A handle representing a document in a Xapian database.
Definition: document.h:61
std::string get_description() const
Return a string describing this object.
Definition: omdocument.cc:101
Iterator over a Xapian::ESet.
Definition: eset.h:160
std::string get_description() const
Return a string describing this object.
Class representing a list of search results.
Definition: eset.h:43
std::string get_description() const
Return a string describing this object.
Xapian::ESetIterator value_type
Definition: eset.h:125
This class provides an interface to the information retrieval system for the purpose of searching.
Definition: enquire.h:152
std::string get_description() const
Return a string describing this object.
Definition: omenquire.cc:969
A posting source which returns a fixed weight for all documents.
std::string get_description() const
Return a string describing this object.
This class implements the IfB2 weighting scheme.
Definition: weight.h:915
This class implements the InL2 weighting scheme.
Definition: weight.h:844
This class implements the IneB2 weighting scheme.
Definition: weight.h:988
Xapian::Weight subclass implementing the Language Model formula.
Definition: weight.h:1413
Iterator over a Xapian::MSet.
Definition: mset.h:368
std::string get_description() const
Return a string describing this object.
Definition: omenquire.cc:500
Class representing a list of search results.
Definition: mset.h:44
Xapian::MSetIterator value_type
Definition: mset.h:333
std::string get_description() const
Return a string describing this object.
Definition: omenquire.cc:325
KeyMaker subclass which combines several values.
Definition: keymaker.h:104
Handle a number range.
Definition: queryparser.h:362
Handle a number range.
Definition: queryparser.h:681
Xapian::Weight subclass implementing the PL2+ probabilistic formula.
Definition: weight.h:1263
This class implements the PL2 weighting scheme.
Definition: weight.h:1196
Class for iterating over term positions.
std::string get_description() const
Return a string describing this object.
Class for iterating over a list of terms.
std::string get_description() const
Return a string describing this object.
virtual std::string get_description() const
Return a string describing this object.
Build a Xapian::Query object from a user query string.
Definition: queryparser.h:797
std::string get_description() const
Return a string describing this object.
Definition: queryparser.cc:267
Class representing a query.
Definition: query.h:56
std::string get_description() const
Return a string describing this object.
Definition: query.cc:232
A relevance set (R-Set).
Definition: enquire.h:60
std::string get_description() const
Return a string describing this object.
Definition: omenquire.cc:123
Base class for range processors.
Definition: queryparser.h:141
Registry for user subclasses.
Definition: registry.h:47
Simple implementation of Stopper class - this will suit most users.
Definition: queryparser.h:100
virtual std::string get_description() const
Return a string describing this object.
Definition: queryparser.cc:48
Class representing a stemming algorithm.
Definition: stem.h:62
std::string get_description() const
Return a string describing this object.
Definition: stem.cc:147
Handle a string range.
Definition: queryparser.h:485
Parses a piece of text and generate terms.
Definition: termgenerator.h:48
std::string get_description() const
Return a string describing this object.
Class for iterating over a list of terms.
Definition: termiterator.h:41
std::string get_description() const
Return a string describing this object.
Xapian::Weight subclass implementing the tf-idf weighting scheme.
Definition: weight.h:458
Xapian::Weight subclass implementing the traditional probabilistic formula.
Definition: weight.h:774
An iterator which returns Unicode character values from a UTF-8 encoded string.
Definition: unicode.h:38
Class for counting the frequencies of values in the matching documents.
Definition: matchspy.h:205
virtual std::string get_description() const
Return a string describing this object.
Definition: matchspy.cc:402
Class for iterating over document values.
Definition: valueiterator.h:40
std::string get_description() const
Return a string describing this object.
A posting source which looks up weights in a map using values as the key.
std::string get_description() const
Return a string describing this object.
A posting source which generates weights from a value slot.
A posting source which reads weights from a value slot.
std::string get_description() const
Return a string describing this object.
This class provides read/write access to a database.
Definition: database.h:795
std::string get_description() const
Return a string describing this object.
Definition: omdatabase.cc:1066
const int DB_BACKEND_INMEMORY
Use the "in memory" backend.
Definition: constants.h:195
#define TEST(a)
Test a condition, without an additional explanation for failure.
Definition: testsuite.h:275
Xapian-specific test helper functions and macros.
Public interfaces for the Xapian library.