Add support for throwing wstring exceptions

Throw an ApplicationException for std::wstring and wchar_t * strings
This commit is contained in:
William S Fulton 2022-04-27 18:41:24 +01:00
commit 79a9389355
4 changed files with 106 additions and 7 deletions

View file

@ -81,8 +81,7 @@ class wstring;
%typemap(typecheck) wstring = wchar_t *;
%typemap(throws, canthrow=1) wstring
%{ std::string message($1.begin(), $1.end());
SWIG_CSharpSetPendingException(SWIG_CSharpApplicationException, message.c_str());
%{ SWIG_csharp_ApplicationException_callback($1.c_str(), (int)$1.size());
return $null; %}
// const wstring &
@ -136,8 +135,7 @@ class wstring;
%typemap(typecheck) const wstring & = wchar_t *;
%typemap(throws, canthrow=1) const wstring &
%{ std::string message($1.begin(), $1.end());
SWIG_CSharpSetPendingException(SWIG_CSharpApplicationException, message.c_str());
%{ SWIG_csharp_ApplicationException_callback($1.c_str(), (int)$1.size());
return $null; %}
}