diff options
author | William S Fulton <wsf@fultondesigns.co.uk> | 2003-09-04 23:12:20 +0000 |
---|---|---|
committer | William S Fulton <wsf@fultondesigns.co.uk> | 2003-09-04 23:12:20 +0000 |
commit | c8d535b30bddf96df99638d532cd166664bd9463 (patch) | |
tree | e53e8c0d8a69bd61633e51e01d136a8f12bf64be /Lib/java/std_string.i | |
parent | 9abd2e79155aacb14ca640c5b1395dc720c3c16c (diff) | |
download | swig-c8d535b30bddf96df99638d532cd166664bd9463.tar.gz |
Directors implementation contributed by Scott Michel.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@5074 626c5289-ae23-0410-ae9c-e8d60b6d4f22
Diffstat (limited to 'Lib/java/std_string.i')
-rw-r--r-- | Lib/java/std_string.i | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/Lib/java/std_string.i b/Lib/java/std_string.i index 27a9d91f0..9fe839fd0 100644 --- a/Lib/java/std_string.i +++ b/Lib/java/std_string.i @@ -28,6 +28,8 @@ class string; %typemap(jni) string "jstring" %typemap(jtype) string "String" %typemap(jstype) string "String" +%typemap(directorin) string "$jniinput" +%typemap(directorout) string "$javacall" %typemap(in) string %{if($input) { @@ -41,6 +43,9 @@ class string; return $null; } %} +%typemap(inv,parse="Ljava/lang/String;") string +%{ $input = jenv->NewStringUTF($1.c_str()); %} + %typemap(out) string %{ $result = jenv->NewStringUTF($1.c_str()); %} @@ -56,6 +61,8 @@ class string; %typemap(jni) const string & "jstring" %typemap(jtype) const string & "String" %typemap(jstype) const string & "String" +%typemap(directorin) const string & "$jniinput" +%typemap(directorout) const string & "$javacall" %typemap(in) const string & %{$1 = NULL; @@ -73,6 +80,9 @@ class string; %typemap(freearg) const string & %{ delete $1; %} +%typemap(inv,parse="Ljava/lang/String;") const string & +%{ $input = jenv->NewStringUTF($1.c_str()); %} + %typemap(out) const string & %{ $result = jenv->NewStringUTF($1->c_str()); %} @@ -109,6 +119,8 @@ class wstring; %typemap(jni) wstring "jstring" %typemap(jtype) wstring "String" %typemap(jstype) wstring "String" +%typemap(directorin) wstring "$jniinput" +%typemap(directorout) wstring "$javacall" %typemap(in) wstring %{if($input) { @@ -130,6 +142,15 @@ class wstring; return $null; } %} +%typemap(inv,parse="Ljava/lang/String;") wstring +%{jsize len = $1.length(); + jchar *conv_buf = new jchar[len]; + for (jsize i = 0; i < len; ++i) { + conv_buf[i] = (jchar)$1[i]; + } + $input = jenv->NewString(conv_buf, len); + delete [] conv_buf; %} + %typemap(out) wstring %{jsize len = $1.length(); jchar *conv_buf = new jchar[len]; @@ -149,6 +170,8 @@ class wstring; %typemap(jni) const wstring & "jstring" %typemap(jtype) const wstring & "String" %typemap(jstype) const wstring & "String" +%typemap(directorin) const wstring & "$jniinput" +%typemap(directorout) const wstring & "$javacall" %typemap(in) const wstring & %{$1 = NULL; @@ -171,6 +194,15 @@ class wstring; return $null; } %} +%typemap(inv,parse="Ljava/lang/String;") const wstring & +%{jsize len = $1->length(); + jchar *conv_buf = new jchar[len]; + for (jsize i = 0; i < len; ++i) { + conv_buf[i] = (jchar)(*$1)[i]; + } + $input = jenv->NewString(conv_buf, len); + delete [] conv_buf; %} + %typemap(out) const wstring & %{jsize len = $1->length(); jchar *conv_buf = new jchar[len]; |