about summary refs log tree commit diff
path: root/xapian-head.i
diff options
context:
space:
mode:
Diffstat (limited to 'xapian-head.i')
-rw-r--r--xapian-head.i80
1 files changed, 30 insertions, 50 deletions
diff --git a/xapian-head.i b/xapian-head.i
index c079f93..65b99df 100644
--- a/xapian-head.i
+++ b/xapian-head.i
@@ -1,8 +1,8 @@
 %{
-/** @file xapian-head.i
+/** @file
  * @brief Header for SWIG interface file for Xapian.
  */
-/* Copyright (C) 2005,2006,2007,2008,2009,2011,2012,2013,2014,2015,2016 Olly Betts
+/* Copyright (C) 2005,2006,2007,2008,2009,2011,2012,2013,2014,2015,2016,2017 Olly Betts
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License as
@@ -15,9 +15,8 @@
  * GNU General Public License for more details.
  *
  * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301
- * USA
+ * along with this program; if not, see
+ * <https://www.gnu.org/licenses/>.
  */
 
 // Disable any deprecation warnings for Xapian methods/functions/classes.
@@ -32,53 +31,28 @@
 
 using namespace std;
 
-// If a backend has been disabled in xapian-core (manually or automatically) we
-// include a stub definition here so the bindings can still be built.
+// If the remote backend has been disabled in xapian-core (manually or
+// automatically) we include a stub definition here so the bindings can still
+// be built.
 namespace Xapian {
-%}
-#ifndef XAPIAN_BINDINGS_SKIP_DEPRECATED_DB_FACTORIES
-%{
-
-#ifndef XAPIAN_HAS_CHERT_BACKEND
-    namespace Chert {
-	static Database open(const string &) {
-	    throw FeatureUnavailableError("Chert backend not supported");
-	}
-	static WritableDatabase open(const string &, int, int = 0) {
-	    throw FeatureUnavailableError("Chert backend not supported");
-	}
-    }
-#endif
-
-#ifndef XAPIAN_HAS_INMEMORY_BACKEND
-    namespace InMemory {
-	static WritableDatabase open() {
-	    throw FeatureUnavailableError("InMemory backend not supported");
-	}
-    }
-#endif
-
-%}
-#endif
-%{
 
 #ifndef XAPIAN_HAS_REMOTE_BACKEND
     namespace Remote {
-	static Database open(const string &, unsigned int, useconds_t = 0, useconds_t = 0) {
-	    throw FeatureUnavailableError("Remote backend not supported");
-	}
+        static Database open(const string &, unsigned int, unsigned = 0, unsigned = 0) {
+            throw FeatureUnavailableError("Remote backend not supported");
+        }
 
-	static WritableDatabase open_writable(const string &, unsigned int, useconds_t = 0, useconds_t = 0, int = 0) {
-	    throw FeatureUnavailableError("Remote backend not supported");
-	}
+        static WritableDatabase open_writable(const string &, unsigned int, unsigned = 0, unsigned = 0, int = 0) {
+            throw FeatureUnavailableError("Remote backend not supported");
+        }
 
-	static Database open(const string &, const string &, useconds_t = 0) {
-	    throw FeatureUnavailableError("Remote backend not supported");
-	}
+        static Database open(const string &, const string &, unsigned = 0) {
+            throw FeatureUnavailableError("Remote backend not supported");
+        }
 
-	static WritableDatabase open_writable(const string &, const string &, useconds_t = 0, int = 0) {
-	    throw FeatureUnavailableError("Remote backend not supported");
-	}
+        static WritableDatabase open_writable(const string &, const string &, unsigned = 0, int = 0) {
+            throw FeatureUnavailableError("Remote backend not supported");
+        }
     }
 #endif
 
@@ -89,6 +63,7 @@ using namespace std;
 
 %include exception.i
 %include stl.i
+%include std_string_view.i
 
 // Disable errors about not including headers individually.
 #define XAPIAN_IN_XAPIAN_H
@@ -99,15 +74,20 @@ using namespace std;
 #define XAPIAN_DEPRECATED_CLASS
 #define XAPIAN_DEPRECATED_CLASS_EX
 #define XAPIAN_VISIBILITY_DEFAULT
+#define XAPIAN_VISIBILITY_INTERNAL
 #define XAPIAN_CONST_FUNCTION
 #define XAPIAN_PURE_FUNCTION
-#define XAPIAN_NOEXCEPT
-#define XAPIAN_NOTHROW(D) D
+
+// This works around buggy behaviour in SWIG's preprocessor, and only works
+// because we currently only use XAPIAN_NONNULL() with an empty argument:
+//
+// https://github.com/swig/swig/pull/1111
+//
+// The correct version is:
+// #define XAPIAN_NONNULL(L)
+#define XAPIAN_NONNULL()
 
 // Ignore these which SWIG seems to add pointless type entries for due them
 // being used in the SWIG typemap for std::pair.
 %ignore first_type;
 %ignore second_type;
-
-// Treat POSIX useconds_t as unsigned.
-%apply unsigned { useconds_t };