clarify the use of std_except.i, now it has nothing to do with supporting the STD/STL namespace
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@8236 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
9367fa255d
commit
fc0ee40ae2
1 changed files with 18 additions and 30 deletions
|
|
@ -1,46 +1,36 @@
|
||||||
#if defined(SWIGJAVA)
|
// Typemaps used to handle and throw STD exceptions in a language
|
||||||
%include <java/std_except.i>
|
// and STL independent way, i.e., the target language doesn't
|
||||||
#elif defined(SWIGCSHARP)
|
// require to support STL but only the 'exception.i' mechanism.
|
||||||
%include <csharp/std_except.i>
|
//
|
||||||
#else
|
// These typemaps are used when methods are declared with an STD
|
||||||
|
|
||||||
|
|
||||||
/* avoid to include std/std_except.i unless we really need it */
|
|
||||||
#if !defined(SWIG_STD_EXCEPTIONS_AS_CLASSES)
|
|
||||||
%{
|
|
||||||
#include <stdexcept>
|
|
||||||
%}
|
|
||||||
#else
|
|
||||||
%include <std/std_except.i>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
// Typemaps used by the STL wrappers that throw exceptions.
|
|
||||||
// These typemaps are used when methods are declared with an STL
|
|
||||||
// exception specification, such as
|
// exception specification, such as
|
||||||
//
|
//
|
||||||
// size_t at() const throw (std::out_of_range);
|
// size_t at() const throw (std::out_of_range);
|
||||||
//
|
//
|
||||||
|
//
|
||||||
|
// As was said, the typemaps here are based in 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.
|
||||||
|
//
|
||||||
|
|
||||||
|
%{
|
||||||
|
#include <stdexcept>
|
||||||
|
%}
|
||||||
|
|
||||||
%include <exception.i>
|
%include <exception.i>
|
||||||
|
|
||||||
/*
|
|
||||||
Mark all of std exception classes as "exception classes" via
|
|
||||||
the "exceptionclass" feature.
|
|
||||||
|
|
||||||
If needed, you can disable it by using %noexceptionclass.
|
|
||||||
*/
|
|
||||||
|
|
||||||
%define %std_exception_map(Exception, Code)
|
%define %std_exception_map(Exception, Code)
|
||||||
%exceptionclass Exception;
|
|
||||||
#if !defined(SWIG_STD_EXCEPTIONS_AS_CLASSES)
|
|
||||||
%typemap(throws,noblock=1) Exception {
|
%typemap(throws,noblock=1) Exception {
|
||||||
SWIG_exception(Code, $1.what());
|
SWIG_exception(Code, $1.what());
|
||||||
}
|
}
|
||||||
%ignore Exception;
|
%ignore Exception;
|
||||||
struct Exception {
|
struct Exception {
|
||||||
};
|
};
|
||||||
#endif
|
|
||||||
%enddef
|
%enddef
|
||||||
|
|
||||||
namespace std {
|
namespace std {
|
||||||
|
|
@ -57,5 +47,3 @@ namespace std {
|
||||||
%std_exception_map(underflow_error, SWIG_OverflowError);
|
%std_exception_map(underflow_error, SWIG_OverflowError);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue