Fix recent STL exception breakages and add in throws typemaps for most of the std::exception classes
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@8201 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
79c9e57b2c
commit
b858051d51
2 changed files with 29 additions and 14 deletions
|
|
@ -1,20 +1,26 @@
|
||||||
%include <std/std_except.i>
|
|
||||||
|
|
||||||
// Typemaps used by the STL wrappers that throw exceptions.
|
// Typemaps used by the STL wrappers that throw exceptions.
|
||||||
// These typemaps are used when methods are declared with an STL exception specification, such as
|
// These typemaps are used when methods are declared with an STL exception specification, such as
|
||||||
// size_t at() const throw (std::out_of_range);
|
// size_t at() const throw (std::out_of_range);
|
||||||
|
|
||||||
|
%{
|
||||||
|
#include <stdexcept>
|
||||||
|
%}
|
||||||
|
|
||||||
namespace std
|
namespace std
|
||||||
{
|
{
|
||||||
%ignore exception;
|
%ignore exception;
|
||||||
struct exception {};
|
struct exception {};
|
||||||
}
|
}
|
||||||
|
|
||||||
%typemap(throws, canthrow=1) std::out_of_range %{
|
%typemap(throws, canthrow=1) std::bad_exception "SWIG_CSharpSetPendingException(SWIG_CSharpApplicationException, $1.what());\n return $null;"
|
||||||
SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentOutOfRangeException, 0, $1.what());
|
%typemap(throws, canthrow=1) std::domain_error "SWIG_CSharpSetPendingException(SWIG_CSharpApplicationException, $1.what());\n return $null;"
|
||||||
return $null; %}
|
%typemap(throws, canthrow=1) std::exception "SWIG_CSharpSetPendingException(SWIG_CSharpApplicationException, $1.what());\n return $null;"
|
||||||
|
%typemap(throws, canthrow=1) std::invalid_argument "SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentException, $1.what(), \"\");\n return $null;"
|
||||||
%typemap(throws, canthrow=1) std::invalid_argument %{
|
%typemap(throws, canthrow=1) std::length_error "SWIG_CSharpSetPendingException(SWIG_CSharpIndexOutOfRangeException, $1.what());\n return $null;"
|
||||||
SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentException, $1.what(), "");
|
%typemap(throws, canthrow=1) std::logic_error "SWIG_CSharpSetPendingException(SWIG_CSharpApplicationException, $1.what());\n return $null;"
|
||||||
return $null; %}
|
%typemap(throws, canthrow=1) std::out_of_range "SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentOutOfRangeException, 0, $1.what());\n return $null;"
|
||||||
|
%typemap(throws, canthrow=1) std::overflow_error "SWIG_CSharpSetPendingException(SWIG_CSharpOverflowException, $1.what());\n return $null;"
|
||||||
|
%typemap(throws, canthrow=1) std::range_error "SWIG_CSharpSetPendingException(SWIG_CSharpIndexOutOfRangeException, $1.what());\n return $null;"
|
||||||
|
%typemap(throws, canthrow=1) std::runtime_error "SWIG_CSharpSetPendingException(SWIG_CSharpApplicationException, $1.what());\n return $null;"
|
||||||
|
%typemap(throws, canthrow=1) std::underflow_error "SWIG_CSharpSetPendingException(SWIG_CSharpOverflowException, $1.what());\n return $null;"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,10 @@
|
||||||
%include <std/std_except.i>
|
|
||||||
|
|
||||||
// Typemaps used by the STL wrappers that throw exceptions.
|
// Typemaps used by the STL wrappers that throw exceptions.
|
||||||
// These typemaps are used when methods are declared with an STL exception specification, such as
|
// These typemaps are used when methods are declared with an STL exception specification, such as
|
||||||
// size_t at() const throw (std::out_of_range);
|
// size_t at() const throw (std::out_of_range);
|
||||||
|
|
||||||
|
%{
|
||||||
|
#include <stdexcept>
|
||||||
|
%}
|
||||||
|
|
||||||
namespace std
|
namespace std
|
||||||
{
|
{
|
||||||
|
|
@ -11,7 +12,15 @@ namespace std
|
||||||
struct exception {};
|
struct exception {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
%typemap(throws) std::bad_exception "SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, $1.what());\n return $null;"
|
||||||
|
%typemap(throws) std::domain_error "SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, $1.what());\n return $null;"
|
||||||
|
%typemap(throws) std::exception "SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, $1.what());\n return $null;"
|
||||||
|
%typemap(throws) std::invalid_argument "SWIG_JavaThrowException(jenv, SWIG_JavaIllegalArgumentException, $1.what());\n return $null;"
|
||||||
|
%typemap(throws) std::length_error "SWIG_JavaThrowException(jenv, SWIG_JavaIndexOutOfBoundsException, $1.what());\n return $null;"
|
||||||
|
%typemap(throws) std::logic_error "SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, $1.what());\n return $null;"
|
||||||
|
%typemap(throws) std::out_of_range "SWIG_JavaThrowException(jenv, SWIG_JavaIndexOutOfBoundsException, $1.what());\n return $null;"
|
||||||
|
%typemap(throws) std::overflow_error "SWIG_JavaThrowException(jenv, SWIG_JavaArithmeticException, $1.what());\n return $null;"
|
||||||
|
%typemap(throws) std::range_error "SWIG_JavaThrowException(jenv, SWIG_JavaIndexOutOfBoundsException, $1.what());\n return $null;"
|
||||||
|
%typemap(throws) std::runtime_error "SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, $1.what());\n return $null;"
|
||||||
|
%typemap(throws) std::underflow_error "SWIG_JavaThrowException(jenv, SWIG_JavaArithmeticException, $1.what());\n return $null;"
|
||||||
|
|
||||||
%typemap(throws) std::out_of_range %{
|
|
||||||
SWIG_JavaThrowException(jenv, SWIG_JavaIndexOutOfBoundsException, $1.what());
|
|
||||||
return $null; %}
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue