xapian-inspect: Support glass instead of chert
[xapian.git] / xapian-bindings / xapian-head.i
blobc079f93027d240d33ac3caa5bc7b72a62813ba8a
1 %{
2 /** @file xapian-head.i
3 * @brief Header for SWIG interface file for Xapian.
4 */
5 /* Copyright (C) 2005,2006,2007,2008,2009,2011,2012,2013,2014,2015,2016 Olly Betts
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License as
9 * published by the Free Software Foundation; either version 2 of the
10 * License, or (at your option) any later version.
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.
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
20 * USA
23 // Disable any deprecation warnings for Xapian methods/functions/classes.
24 #define XAPIAN_DEPRECATED(D) D
26 #include <xapian.h>
28 #include <fstream>
29 #include <iostream>
30 #include <string>
31 #include <vector>
33 using namespace std;
35 // If a backend has been disabled in xapian-core (manually or automatically) we
36 // include a stub definition here so the bindings can still be built.
37 namespace Xapian {
39 #ifndef XAPIAN_BINDINGS_SKIP_DEPRECATED_DB_FACTORIES
42 #ifndef XAPIAN_HAS_CHERT_BACKEND
43 namespace Chert {
44 static Database open(const string &) {
45 throw FeatureUnavailableError("Chert backend not supported");
47 static WritableDatabase open(const string &, int, int = 0) {
48 throw FeatureUnavailableError("Chert backend not supported");
51 #endif
53 #ifndef XAPIAN_HAS_INMEMORY_BACKEND
54 namespace InMemory {
55 static WritableDatabase open() {
56 throw FeatureUnavailableError("InMemory backend not supported");
59 #endif
62 #endif
65 #ifndef XAPIAN_HAS_REMOTE_BACKEND
66 namespace Remote {
67 static Database open(const string &, unsigned int, useconds_t = 0, useconds_t = 0) {
68 throw FeatureUnavailableError("Remote backend not supported");
71 static WritableDatabase open_writable(const string &, unsigned int, useconds_t = 0, useconds_t = 0, int = 0) {
72 throw FeatureUnavailableError("Remote backend not supported");
75 static Database open(const string &, const string &, useconds_t = 0) {
76 throw FeatureUnavailableError("Remote backend not supported");
79 static WritableDatabase open_writable(const string &, const string &, useconds_t = 0, int = 0) {
80 throw FeatureUnavailableError("Remote backend not supported");
83 #endif
88 using namespace std;
90 %include exception.i
91 %include stl.i
93 // Disable errors about not including headers individually.
94 #define XAPIAN_IN_XAPIAN_H
96 // Define these away for SWIG's parser.
97 #define XAPIAN_DEPRECATED(D) D
98 #define XAPIAN_DEPRECATED_EX(D) D
99 #define XAPIAN_DEPRECATED_CLASS
100 #define XAPIAN_DEPRECATED_CLASS_EX
101 #define XAPIAN_VISIBILITY_DEFAULT
102 #define XAPIAN_CONST_FUNCTION
103 #define XAPIAN_PURE_FUNCTION
104 #define XAPIAN_NOEXCEPT
105 #define XAPIAN_NOTHROW(D) D
107 // Ignore these which SWIG seems to add pointless type entries for due them
108 // being used in the SWIG typemap for std::pair.
109 %ignore first_type;
110 %ignore second_type;
112 // Treat POSIX useconds_t as unsigned.
113 %apply unsigned { useconds_t };