import source from 1.3.40
[external/swig.git] / Lib / csharp / std_except.i
1 /* -----------------------------------------------------------------------------
2  * See the LICENSE file for information on copyright, usage and redistribution
3  * of SWIG, and the README file for authors - http://www.swig.org/release.html.
4  *
5  * std_except.i
6  *
7  * Typemaps used by the STL wrappers that throw exceptions. These typemaps are
8  * used when methods are declared with an STL exception specification, such as
9  *   size_t at() const throw (std::out_of_range);
10  * ----------------------------------------------------------------------------- */
11
12 %{
13 #include <stdexcept>
14 %}
15
16 namespace std 
17 {
18   %ignore exception;
19   struct exception {};
20 }
21
22 %typemap(throws, canthrow=1) std::bad_exception     "SWIG_CSharpSetPendingException(SWIG_CSharpApplicationException, $1.what());\n return $null;"
23 %typemap(throws, canthrow=1) std::domain_error      "SWIG_CSharpSetPendingException(SWIG_CSharpApplicationException, $1.what());\n return $null;"
24 %typemap(throws, canthrow=1) std::exception         "SWIG_CSharpSetPendingException(SWIG_CSharpApplicationException, $1.what());\n return $null;"
25 %typemap(throws, canthrow=1) std::invalid_argument  "SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentException, $1.what(), \"\");\n return $null;"
26 %typemap(throws, canthrow=1) std::length_error      "SWIG_CSharpSetPendingException(SWIG_CSharpIndexOutOfRangeException, $1.what());\n return $null;"
27 %typemap(throws, canthrow=1) std::logic_error       "SWIG_CSharpSetPendingException(SWIG_CSharpApplicationException, $1.what());\n return $null;"
28 %typemap(throws, canthrow=1) std::out_of_range      "SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentOutOfRangeException, 0, $1.what());\n return $null;"
29 %typemap(throws, canthrow=1) std::overflow_error    "SWIG_CSharpSetPendingException(SWIG_CSharpOverflowException, $1.what());\n return $null;"
30 %typemap(throws, canthrow=1) std::range_error       "SWIG_CSharpSetPendingException(SWIG_CSharpIndexOutOfRangeException, $1.what());\n return $null;"
31 %typemap(throws, canthrow=1) std::runtime_error     "SWIG_CSharpSetPendingException(SWIG_CSharpApplicationException, $1.what());\n return $null;"
32 %typemap(throws, canthrow=1) std::underflow_error   "SWIG_CSharpSetPendingException(SWIG_CSharpOverflowException, $1.what());\n return $null;"
33