Directors implementation contributed by Scott Michel.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@5074 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
9abd2e7915
commit
c8d535b30b
7 changed files with 505 additions and 63 deletions
|
|
@ -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];
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue