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:
William S Fulton 2006-10-20 22:54:49 +00:00
commit 74c8c6db4d
2 changed files with 47 additions and 2 deletions

View file

@ -4388,11 +4388,19 @@ The most important of these implement the mapping of C/C++ types to Java types:
<tr>
<td>directorin</td>
<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.
See <a href="#java_directors_typemaps">Director typemaps</a>. </td>
</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>
<p>
@ -4980,7 +4988,7 @@ Again this is the same that is in "<tt>java.swg</tt>", barring the method modifi
<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.
</p>
@ -5024,6 +5032,41 @@ If the ';' is left out, Java will generate a "method not found" runtime error.
</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-&gt;GetStringUTFChars($input, 0);
if (!$1) return $null;
}
}
</pre>
</div>
</div>
<p><tt>%typemap(javadirectorin)</tt></p>
<div class="indent">