Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(741)

Unified Diff: swig/Lib/std_except.i

Issue 553095: Checkin swig binaries for win, linux and Mac... (Closed) Base URL: svn://chrome-svn/chrome/trunk/deps/third_party/
Patch Set: '' Created 10 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « swig/Lib/std/std_wstring.i ('k') | swig/Lib/stdint.i » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: swig/Lib/std_except.i
===================================================================
--- swig/Lib/std_except.i (revision 0)
+++ swig/Lib/std_except.i (revision 0)
@@ -0,0 +1,58 @@
+/* -----------------------------------------------------------------------------
+ * See the LICENSE file for information on copyright, usage and redistribution
+ * of SWIG, and the README file for authors - http://www.swig.org/release.html.
+ *
+ * std_except.i
+ *
+ * SWIG library file with typemaps to handle and throw STD exceptions in a
+ * language and STL independent way, i.e., the target language doesn't
+ * require to support STL but only the 'exception.i' mechanism.
+ *
+ * These typemaps are used when methods are declared with an STD
+ * exception specification, such as
+ *
+ * size_t at() const throw (std::out_of_range);
+ *
+ * The typemaps here are based on the language independent
+ * 'exception.i' library. If that is working in your target language,
+ * this file will work.
+ *
+ * If the target language doesn't implement a robust 'exception.i'
+ * mechanism, or you prefer other ways to map the STD exceptions, write
+ * a new std_except.i file in the target library directory.
+ * ----------------------------------------------------------------------------- */
+
+#if defined(SWIGJAVA) || defined(SWIGCSHARP) || defined(SWIGGUILE) || defined(SWIGUTL)
+#error "This version of std_except.i should not be used"
+#endif
+
+%{
+#include <stdexcept>
+%}
+
+%include <exception.i>
+
+
+%define %std_exception_map(Exception, Code)
+ %typemap(throws,noblock=1) Exception {
+ SWIG_exception(Code, $1.what());
+ }
+ %ignore Exception;
+ struct Exception {
+ };
+%enddef
+
+namespace std {
+ %std_exception_map(bad_exception, SWIG_SystemError);
+ %std_exception_map(domain_error, SWIG_ValueError);
+ %std_exception_map(exception, SWIG_SystemError);
+ %std_exception_map(invalid_argument, SWIG_ValueError);
+ %std_exception_map(length_error, SWIG_IndexError);
+ %std_exception_map(logic_error, SWIG_RuntimeError);
+ %std_exception_map(out_of_range, SWIG_IndexError);
+ %std_exception_map(overflow_error, SWIG_OverflowError);
+ %std_exception_map(range_error, SWIG_OverflowError);
+ %std_exception_map(runtime_error, SWIG_RuntimeError);
+ %std_exception_map(underflow_error, SWIG_OverflowError);
+}
+
« no previous file with comments | « swig/Lib/std/std_wstring.i ('k') | swig/Lib/stdint.i » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698