document directorout typemap
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@9468 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
3c24cacfbd
commit
74c8c6db4d
2 changed files with 47 additions and 2 deletions
|
|
@ -133,6 +133,8 @@ jtype -> imtype
|
||||||
jstype -> cstype
|
jstype -> cstype
|
||||||
javain -> csin
|
javain -> csin
|
||||||
javaout -> csout
|
javaout -> csout
|
||||||
|
javadirectorin -> csdirectorin
|
||||||
|
javadirectorout -> csdirectorout
|
||||||
javainterfaces -> csinterfaces and csinterfaces_derived
|
javainterfaces -> csinterfaces and csinterfaces_derived
|
||||||
javabase -> csbase
|
javabase -> csbase
|
||||||
javaclassmodifiers -> csclassmodifiers
|
javaclassmodifiers -> csclassmodifiers
|
||||||
|
|
|
||||||
|
|
@ -4388,11 +4388,19 @@ The most important of these implement the mapping of C/C++ types to Java types:
|
||||||
<tr>
|
<tr>
|
||||||
<td>directorin</td>
|
<td>directorin</td>
|
||||||
<td>Conversion from C++ type to jni type for director methods.
|
<td>Conversion from C++ type to jni type for director methods.
|
||||||
These are C++ typemaps which converts the parameters used in the C++ director method to the appropriate JNI intermediary type.
|
These are C++ typemaps which convert the parameters used in the C++ director method to the appropriate JNI intermediary type.
|
||||||
The conversion is done in JNI code prior to calling the Java function from the JNI code.
|
The conversion is done in JNI code prior to calling the Java function from the JNI code.
|
||||||
See <a href="#java_directors_typemaps">Director typemaps</a>. </td>
|
See <a href="#java_directors_typemaps">Director typemaps</a>. </td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td>directorout</td>
|
||||||
|
<td>Conversion from jni type to C++ type for director methods.
|
||||||
|
These are C++ typemaps which convert the JNI return type used in the C++ director method to the appropriate C++ return type.
|
||||||
|
The conversion is done in JNI code after calling the Java function from the JNI code.
|
||||||
|
See <a href="#java_directors_typemaps">Director typemaps</a>. </td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
|
|
@ -4980,7 +4988,7 @@ Again this is the same that is in "<tt>java.swg</tt>", barring the method modifi
|
||||||
|
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
The Java directors feature requires the "javadirectorin", "javadirectorout" and the "directorin" typemaps in order to work properly.
|
The Java directors feature requires the "javadirectorin", "javadirectorout", "directorin" and the "directorout" typemaps in order to work properly.
|
||||||
The "javapackage" typemap is an optional typemap used to identify the Java package path for individual SWIG generated proxy classes.
|
The "javapackage" typemap is an optional typemap used to identify the Java package path for individual SWIG generated proxy classes.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
|
@ -5024,6 +5032,41 @@ If the ';' is left out, Java will generate a "method not found" runtime error.
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<p><tt>%typemap(directorout)</tt></p>
|
||||||
|
<div class="indent">
|
||||||
|
|
||||||
|
<p>
|
||||||
|
The "directorout" typemap is used for converting the JNI return type in the C++ director class to the appropriate C++ type after the upcall to Java.
|
||||||
|
For example, integers are converted as follows:
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<div class="code">
|
||||||
|
<pre>
|
||||||
|
%typemap(directorout) int %{ $result = (int)$input; %}
|
||||||
|
</pre>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
<code>$input</code> is the SWIG name of the JNI temporary variable returned from Java after the upcall.
|
||||||
|
<code>$result</code> is the resulting output.
|
||||||
|
A typemap for C character strings is:
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<div class="code">
|
||||||
|
<pre>
|
||||||
|
%typemap(directorout) char * {
|
||||||
|
$1 = 0;
|
||||||
|
if ($input) {
|
||||||
|
$result = (char *)jenv->GetStringUTFChars($input, 0);
|
||||||
|
if (!$1) return $null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</pre>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<p><tt>%typemap(javadirectorin)</tt></p>
|
<p><tt>%typemap(javadirectorin)</tt></p>
|
||||||
<div class="indent">
|
<div class="indent">
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue