Java wstring throws typemap improvements
Unicode still not working, but works now for ASCII charset.
This commit is contained in:
parent
fd846be18b
commit
a598abe23d
1 changed files with 12 additions and 6 deletions
|
|
@ -88,7 +88,10 @@ class wstring;
|
||||||
//%typemap(typecheck) wstring = wchar_t *;
|
//%typemap(typecheck) wstring = wchar_t *;
|
||||||
|
|
||||||
%typemap(throws) wstring
|
%typemap(throws) wstring
|
||||||
%{ std::string message($1.begin(), $1.end());
|
%{std::string message($1.size(), '\0');
|
||||||
|
for (size_t i = 0; i < $1.size(); ++i) {
|
||||||
|
message[i] = (char)$1[i];
|
||||||
|
}
|
||||||
SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, message.c_str());
|
SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, message.c_str());
|
||||||
return $null; %}
|
return $null; %}
|
||||||
|
|
||||||
|
|
@ -166,7 +169,10 @@ class wstring;
|
||||||
//%typemap(typecheck) const wstring & = wchar_t *;
|
//%typemap(typecheck) const wstring & = wchar_t *;
|
||||||
|
|
||||||
%typemap(throws) const wstring &
|
%typemap(throws) const wstring &
|
||||||
%{ std::string message($1.begin(), $1.end());
|
%{std::string message($1.size(), '\0');
|
||||||
|
for (size_t i = 0; i < $1.size(); ++i) {
|
||||||
|
message[i] = (char)$1[i];
|
||||||
|
}
|
||||||
SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, message.c_str());
|
SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, message.c_str());
|
||||||
return $null; %}
|
return $null; %}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue