1 /** @file
2  * @brief Custom Lua exception handling.
3  */
4 /* Warning: This file is generated by ./generate-lua-exceptions
5  * - do not modify directly!
6  *
7  * Copyright (C) 2003,2004,2006,2007,2008,2011,2012 Olly Betts
8  * Copyright (C) 2007 Lemur Consulting Ltd
9  * Copyright (C) 2007 Richard Boulton
10  * Copyright (C) 2011 Xiaona Han
11  *
12  * This program is free software; you can redistribute it and/or
13  * modify it under the terms of the GNU General Public License as
14  * published by the Free Software Foundation; either version 2 of the
15  * License, or (at your option) any later version.
16  *
17  * This program is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20  * GNU General Public License for more details.
21  *
22  * You should have received a copy of the GNU General Public License
23  * along with this program; if not, write to the Free Software
24  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
25  */
26 
27 %ignore Xapian::Error::Error(const Error&);
28 %include "xapian/error.h"
29 
30 %{
31 namespace Xapian {
handle_exception(lua_State * L)32 void handle_exception(lua_State* L) {
33     try {
34 	throw;
35     } catch (const Xapian::DatabaseClosedError &e) {
36 	SWIG_NewPointerObj(L, (void *)new DatabaseClosedError(e), SWIGTYPE_p_Xapian__DatabaseClosedError, 1);
37     } catch (const Xapian::DatabaseNotFoundError &e) {
38 	SWIG_NewPointerObj(L, (void *)new DatabaseNotFoundError(e), SWIGTYPE_p_Xapian__DatabaseNotFoundError, 1);
39     } catch (const Xapian::WildcardError &e) {
40 	SWIG_NewPointerObj(L, (void *)new WildcardError(e), SWIGTYPE_p_Xapian__WildcardError, 1);
41     } catch (const Xapian::RangeError &e) {
42 	SWIG_NewPointerObj(L, (void *)new RangeError(e), SWIGTYPE_p_Xapian__RangeError, 1);
43     } catch (const Xapian::SerialisationError &e) {
44 	SWIG_NewPointerObj(L, (void *)new SerialisationError(e), SWIGTYPE_p_Xapian__SerialisationError, 1);
45     } catch (const Xapian::QueryParserError &e) {
46 	SWIG_NewPointerObj(L, (void *)new QueryParserError(e), SWIGTYPE_p_Xapian__QueryParserError, 1);
47     } catch (const Xapian::NetworkTimeoutError &e) {
48 	SWIG_NewPointerObj(L, (void *)new NetworkTimeoutError(e), SWIGTYPE_p_Xapian__NetworkTimeoutError, 1);
49     } catch (const Xapian::NetworkError &e) {
50 	SWIG_NewPointerObj(L, (void *)new NetworkError(e), SWIGTYPE_p_Xapian__NetworkError, 1);
51     } catch (const Xapian::InternalError &e) {
52 	SWIG_NewPointerObj(L, (void *)new InternalError(e), SWIGTYPE_p_Xapian__InternalError, 1);
53     } catch (const Xapian::FeatureUnavailableError &e) {
54 	SWIG_NewPointerObj(L, (void *)new FeatureUnavailableError(e), SWIGTYPE_p_Xapian__FeatureUnavailableError, 1);
55     } catch (const Xapian::DocNotFoundError &e) {
56 	SWIG_NewPointerObj(L, (void *)new DocNotFoundError(e), SWIGTYPE_p_Xapian__DocNotFoundError, 1);
57     } catch (const Xapian::DatabaseVersionError &e) {
58 	SWIG_NewPointerObj(L, (void *)new DatabaseVersionError(e), SWIGTYPE_p_Xapian__DatabaseVersionError, 1);
59     } catch (const Xapian::DatabaseOpeningError &e) {
60 	SWIG_NewPointerObj(L, (void *)new DatabaseOpeningError(e), SWIGTYPE_p_Xapian__DatabaseOpeningError, 1);
61     } catch (const Xapian::DatabaseModifiedError &e) {
62 	SWIG_NewPointerObj(L, (void *)new DatabaseModifiedError(e), SWIGTYPE_p_Xapian__DatabaseModifiedError, 1);
63     } catch (const Xapian::DatabaseLockError &e) {
64 	SWIG_NewPointerObj(L, (void *)new DatabaseLockError(e), SWIGTYPE_p_Xapian__DatabaseLockError, 1);
65     } catch (const Xapian::DatabaseCreateError &e) {
66 	SWIG_NewPointerObj(L, (void *)new DatabaseCreateError(e), SWIGTYPE_p_Xapian__DatabaseCreateError, 1);
67     } catch (const Xapian::DatabaseCorruptError &e) {
68 	SWIG_NewPointerObj(L, (void *)new DatabaseCorruptError(e), SWIGTYPE_p_Xapian__DatabaseCorruptError, 1);
69     } catch (const Xapian::DatabaseError &e) {
70 	SWIG_NewPointerObj(L, (void *)new DatabaseError(e), SWIGTYPE_p_Xapian__DatabaseError, 1);
71     } catch (const Xapian::UnimplementedError &e) {
72 	SWIG_NewPointerObj(L, (void *)new UnimplementedError(e), SWIGTYPE_p_Xapian__UnimplementedError, 1);
73     } catch (const Xapian::InvalidOperationError &e) {
74 	SWIG_NewPointerObj(L, (void *)new InvalidOperationError(e), SWIGTYPE_p_Xapian__InvalidOperationError, 1);
75     } catch (const Xapian::InvalidArgumentError &e) {
76 	SWIG_NewPointerObj(L, (void *)new InvalidArgumentError(e), SWIGTYPE_p_Xapian__InvalidArgumentError, 1);
77     } catch (const Xapian::AssertionError &e) {
78 	SWIG_NewPointerObj(L, (void *)new AssertionError(e), SWIGTYPE_p_Xapian__AssertionError, 1);
79     } catch (const Xapian::RuntimeError &e) {
80 	SWIG_NewPointerObj(L, (void *)new RuntimeError(e), SWIGTYPE_p_Xapian__RuntimeError, 1);
81     } catch (const Xapian::LogicError &e) {
82 	SWIG_NewPointerObj(L, (void *)new LogicError(e), SWIGTYPE_p_Xapian__LogicError, 1);
83     } catch (const std::exception& e) {
84 	lua_pushfstring(L, "std::exception: %s", e.what());
85     } catch (...) {
86 	lua_pushstring(L, "Unknown exception");
87     }
88 }
89 }
90 %}
91 
92 /* Functions and methods which are marked as "nothrow": */
93 %exception Xapian::Compactor::~Compactor;
94 %exception Xapian::Compactor::get_constinfo_();
95 %exception Xapian::Database::~Database;
96 %exception Xapian::Database::postlist_end(const std::string &) const;
97 %exception Xapian::Database::termlist_end(Xapian::docid) const;
98 %exception Xapian::Database::positionlist_end(Xapian::docid, const std::string &) const;
99 %exception Xapian::Database::allterms_end(const std::string & = std::string()) const;
100 %exception Xapian::Database::valuestream_end(Xapian::valueno) const;
101 %exception Xapian::Database::spellings_end() const;
102 %exception Xapian::Database::synonyms_end(const std::string &) const;
103 %exception Xapian::Database::synonym_keys_end(const std::string & = std::string()) const;
104 %exception Xapian::Database::metadata_keys_end(const std::string & = std::string()) const;
105 %exception Xapian::WritableDatabase::~WritableDatabase;
106 %exception Xapian::Document::~Document;
107 %exception Xapian::Document::termlist_end() const;
108 %exception Xapian::Document::values_end() const;
109 %exception Xapian::RSet::~RSet;
110 %exception Xapian::MatchDecider::~MatchDecider;
111 %exception Xapian::Enquire::~Enquire;
112 %exception Xapian::Enquire::get_matching_terms_end(Xapian::docid  ) const;
113 %exception Xapian::Enquire::get_matching_terms_end(const MSetIterator & ) const;
114 %exception Xapian::Error::~Error;
115 %exception Xapian::Error::get_type() const;
116 %exception Xapian::Error::get_msg() const;
117 %exception Xapian::Error::get_context() const;
118 %exception Xapian::LogicError::~LogicError;
119 %exception Xapian::RuntimeError::~RuntimeError;
120 %exception Xapian::AssertionError::~AssertionError;
121 %exception Xapian::InvalidArgumentError::~InvalidArgumentError;
122 %exception Xapian::InvalidOperationError::~InvalidOperationError;
123 %exception Xapian::UnimplementedError::~UnimplementedError;
124 %exception Xapian::DatabaseError::~DatabaseError;
125 %exception Xapian::DatabaseCorruptError::~DatabaseCorruptError;
126 %exception Xapian::DatabaseCreateError::~DatabaseCreateError;
127 %exception Xapian::DatabaseLockError::~DatabaseLockError;
128 %exception Xapian::DatabaseModifiedError::~DatabaseModifiedError;
129 %exception Xapian::DatabaseOpeningError::~DatabaseOpeningError;
130 %exception Xapian::DatabaseVersionError::~DatabaseVersionError;
131 %exception Xapian::DocNotFoundError::~DocNotFoundError;
132 %exception Xapian::FeatureUnavailableError::~FeatureUnavailableError;
133 %exception Xapian::InternalError::~InternalError;
134 %exception Xapian::NetworkError::~NetworkError;
135 %exception Xapian::NetworkTimeoutError::~NetworkTimeoutError;
136 %exception Xapian::QueryParserError::~QueryParserError;
137 %exception Xapian::SerialisationError::~SerialisationError;
138 %exception Xapian::RangeError::~RangeError;
139 %exception Xapian::WildcardError::~WildcardError;
140 %exception Xapian::DatabaseNotFoundError::~DatabaseNotFoundError;
141 %exception Xapian::DatabaseClosedError::~DatabaseClosedError;
142 %exception Xapian::ErrorHandler::~ErrorHandler;
143 %exception Xapian::ErrorHandler::ErrorHandler();
144 %exception Xapian::ESet::~ESet;
145 %exception Xapian::ESetIterator::~ESetIterator;
146 %exception Xapian::ESetIterator::operator==(const ESetIterator &a, const ESetIterator &b);
147 %exception Xapian::ESetIterator::operator!=(const ESetIterator &a, const ESetIterator &b);
148 %exception Xapian::ESetIterator::operator<(const ESetIterator &a, const ESetIterator &b);
149 %exception Xapian::ESetIterator::operator>(const ESetIterator &a, const ESetIterator &b);
150 %exception Xapian::ESetIterator::operator>=(const ESetIterator &a, const ESetIterator &b);
151 %exception Xapian::ESetIterator::operator<=(const ESetIterator &a, const ESetIterator &b);
152 %exception Xapian::ExpandDecider::~ExpandDecider;
153 %exception Xapian::ExpandDeciderAnd::~ExpandDeciderAnd;
154 %exception Xapian::ExpandDeciderFilterTerms::~ExpandDeciderFilterTerms;
155 %exception Xapian::ExpandDeciderFilterPrefix::~ExpandDeciderFilterPrefix;
156 %exception Xapian::ExpandDeciderFilterPrefix::miles_to_metres(double miles);
157 %exception Xapian::ExpandDeciderFilterPrefix::metres_to_miles(double metres);
158 %exception Xapian::ExpandDeciderFilterPrefix::LatLongCoord();
159 %exception Xapian::ExpandDeciderFilterPrefix::operator<(const LatLongCoord & other) const;
160 %exception Xapian::LatLongCoordsIterator::~LatLongCoordsIterator;
161 %exception Xapian::LatLongCoords::~LatLongCoords;
162 %exception Xapian::LatLongMetric::~LatLongMetric;
163 %exception Xapian::GreatCircleMetric::~GreatCircleMetric;
164 %exception Xapian::LatLongDistancePostingSource::~LatLongDistancePostingSource;
165 %exception Xapian::LatLongDistanceKeyMaker::~LatLongDistanceKeyMaker;
166 %exception Xapian::opt_intrusive_base::~opt_intrusive_base;
167 %exception Xapian::KeyMaker::~KeyMaker;
168 %exception Xapian::MultiValueKeyMaker::~MultiValueKeyMaker;
169 %exception Xapian::MatchSpy::~MatchSpy;
170 %exception Xapian::MatchSpy::MatchSpy();
171 %exception Xapian::ValueCountMatchSpy::~ValueCountMatchSpy;
172 %exception Xapian::ValueCountMatchSpy::get_total() const;
173 %exception Xapian::ValueCountMatchSpy::values_end() const;
174 %exception Xapian::ValueCountMatchSpy::top_values_end(size_t) const;
175 %exception Xapian::MSet::~MSet;
176 %exception Xapian::MSetIterator::~MSetIterator;
177 %exception Xapian::MSetIterator::operator==(const MSetIterator &a, const MSetIterator &b);
178 %exception Xapian::MSetIterator::operator!=(const MSetIterator &a, const MSetIterator &b);
179 %exception Xapian::MSetIterator::operator<(const MSetIterator &a, const MSetIterator &b);
180 %exception Xapian::MSetIterator::operator>(const MSetIterator &a, const MSetIterator &b);
181 %exception Xapian::MSetIterator::operator>=(const MSetIterator &a, const MSetIterator &b);
182 %exception Xapian::MSetIterator::operator<=(const MSetIterator &a, const MSetIterator &b);
183 %exception Xapian::PositionIterator::~PositionIterator;
184 %exception Xapian::PositionIterator::PositionIterator();
185 %exception Xapian::PositionIterator::operator==(const PositionIterator &a, const PositionIterator &b);
186 %exception Xapian::PositionIterator::operator!=(const PositionIterator &a, const PositionIterator &b);
187 %exception Xapian::PostingIterator::~PostingIterator;
188 %exception Xapian::PostingIterator::PostingIterator();
189 %exception Xapian::PostingIterator::positionlist_end() const;
190 %exception Xapian::PostingIterator::operator==(const PostingIterator &a, const PostingIterator &b);
191 %exception Xapian::PostingIterator::operator!=(const PostingIterator &a, const PostingIterator &b);
192 %exception Xapian::PostingSource::~PostingSource;
193 %exception Xapian::PostingSource::PostingSource();
194 %exception Xapian::PostingSource::get_maxweight() const;
195 %exception Xapian::ValuePostingSource::~ValuePostingSource;
196 %exception Xapian::ValueWeightPostingSource::~ValueWeightPostingSource;
197 %exception Xapian::DecreasingValueWeightPostingSource::~DecreasingValueWeightPostingSource;
198 %exception Xapian::ValueMapPostingSource::~ValueMapPostingSource;
199 %exception Xapian::FixedWeightPostingSource::~FixedWeightPostingSource;
200 %exception Xapian::Query::~Query;
201 %exception Xapian::Query::Query();
202 %exception Xapian::Query::get_terms_end() const;
203 %exception Xapian::Query::get_unique_terms_end() const;
204 %exception Xapian::Query::get_length() const;
205 %exception Xapian::Query::empty() const;
206 %exception Xapian::Query::get_type() const;
207 %exception Xapian::Query::get_num_subqueries() const;
208 %exception Xapian::Query::Internal();
209 %exception Xapian::Query::get_length() const;
210 %exception Xapian::Query::get_type() const;
211 %exception Xapian::Query::get_num_subqueries() const;
212 %exception Xapian::Stopper::~Stopper;
213 %exception Xapian::SimpleStopper::~SimpleStopper;
214 %exception Xapian::RangeProcessor::~RangeProcessor;
215 %exception Xapian::DateRangeProcessor::~DateRangeProcessor;
216 %exception Xapian::NumberRangeProcessor::~NumberRangeProcessor;
217 %exception Xapian::ValueRangeProcessor::~ValueRangeProcessor;
218 %exception Xapian::FieldProcessor::~FieldProcessor;
219 %exception Xapian::QueryParser::~QueryParser;
220 %exception Xapian::QueryParser::stoplist_end() const;
221 %exception Xapian::QueryParser::unstem_end(const std::string &) const;
222 %exception Xapian::QueryParser::sortable_serialise_(double value, char * buf);
223 %exception Xapian::QueryParser::sortable_unserialise(const std::string & serialised);
224 %exception Xapian::Registry::~Registry;
225 %exception Xapian::StemImplementation::~StemImplementation;
226 %exception Xapian::Stem::~Stem;
227 %exception Xapian::TermGenerator::~TermGenerator;
228 %exception Xapian::TermIterator::~TermIterator;
229 %exception Xapian::TermIterator::TermIterator();
230 %exception Xapian::TermIterator::positionlist_end() const;
231 %exception Xapian::TermIterator::operator==(const TermIterator &a, const TermIterator &b);
232 %exception Xapian::TermIterator::operator!=(const TermIterator &a, const TermIterator &b);
233 %exception Xapian::Utf8Iterator::~Utf8Iterator;
234 %exception Xapian::Utf8Iterator::calculate_sequence_length() const;
235 %exception Xapian::Utf8Iterator::Utf8Iterator();
236 %exception Xapian::Utf8Iterator::operator*() const;
237 %exception Xapian::Utf8Iterator::strict_deref() const;
238 %exception Xapian::Utf8Iterator::operator==(const Utf8Iterator& other) const;
239 %exception Xapian::Utf8Iterator::operator!=(const Utf8Iterator& other) const;
240 %exception Xapian::Utf8Iterator::get_character_info(unsigned ch);
241 %exception Xapian::ValueIterator::~ValueIterator;
242 %exception Xapian::ValueIterator::ValueIterator();
243 %exception Xapian::ValueIterator::operator==(const ValueIterator &a, const ValueIterator &b);
244 %exception Xapian::ValueIterator::operator!=(const ValueIterator &a, const ValueIterator &b);
245 %exception Xapian::ValueSetMatchDecider::~ValueSetMatchDecider;
246 %exception Xapian::Weight::~Weight;
247 %exception Xapian::BoolWeight::~BoolWeight;
248 %exception Xapian::TfIdfWeight::~TfIdfWeight;
249 %exception Xapian::BM25Weight::~BM25Weight;
250 %exception Xapian::BM25PlusWeight::~BM25PlusWeight;
251 %exception Xapian::TradWeight::~TradWeight;
252 %exception Xapian::InL2Weight::~InL2Weight;
253 %exception Xapian::IfB2Weight::~IfB2Weight;
254 %exception Xapian::IneB2Weight::~IneB2Weight;
255 %exception Xapian::BB2Weight::~BB2Weight;
256 %exception Xapian::DLHWeight::~DLHWeight;
257 %exception Xapian::PL2Weight::~PL2Weight;
258 %exception Xapian::PL2PlusWeight::~PL2PlusWeight;
259 %exception Xapian::DPHWeight::~DPHWeight;
260 %exception Xapian::LMWeight::~LMWeight;
261 %exception Xapian::CoordWeight::~CoordWeight;
262 
263 %exception {
264     try {
265 	$action
catch(...)266     } catch (...) {
267 	Xapian::handle_exception(L);
268 	SWIG_fail;
269     }
270 }
271