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