Documentation for attribute support in $typemap.
This commit is contained in:
parent
5afc813842
commit
28036e5a16
3 changed files with 52 additions and 4 deletions
|
|
@ -7,6 +7,25 @@ the issue number to the end of the URL: https://github.com/swig/swig/issues/
|
|||
Version 4.1.0 (in progress)
|
||||
===========================
|
||||
|
||||
2022-06-04: sethrj
|
||||
Enhance $typemap to support typemap attributes.
|
||||
|
||||
$typemap(method:attribute, typepattern)
|
||||
|
||||
For example:
|
||||
|
||||
%typemap(cstype, out="object") XClass "XClass"
|
||||
%typemap(cscode) BarClass %{
|
||||
$typemap(cstype:out, XClass) bar() {
|
||||
return null;
|
||||
}
|
||||
|
||||
which expands to
|
||||
|
||||
object bar() {
|
||||
return null;
|
||||
}
|
||||
|
||||
2022-05-30: wsfulton
|
||||
[C#, D] Add new special variable expansion: $imfuncname.
|
||||
Expands to the function name called in the intermediary class.
|
||||
|
|
|
|||
|
|
@ -524,6 +524,7 @@
|
|||
<ul>
|
||||
<li><a href="Typemaps.html#Typemaps_special_macro_descriptor">$descriptor(type)</a>
|
||||
<li><a href="Typemaps.html#Typemaps_special_macro_typemap">$typemap(method, typepattern)</a>
|
||||
<li><a href="Typemaps.html#Typemaps_special_macro_typemap_attribute">$typemap(method:attribute, typepattern)</a>
|
||||
</ul>
|
||||
<li><a href="Typemaps.html#Typemaps_special_variable_attributes">Special variables and typemap attributes</a>
|
||||
<li><a href="Typemaps.html#Typemaps_special_variables_and_macros">Special variables combined with special variable macros</a>
|
||||
|
|
|
|||
|
|
@ -48,6 +48,7 @@
|
|||
<ul>
|
||||
<li><a href="#Typemaps_special_macro_descriptor">$descriptor(type)</a>
|
||||
<li><a href="#Typemaps_special_macro_typemap">$typemap(method, typepattern)</a>
|
||||
<li><a href="#Typemaps_special_macro_typemap_attribute">$typemap(method:attribute, typepattern)</a>
|
||||
</ul>
|
||||
<li><a href="#Typemaps_special_variable_attributes">Special variables and typemap attributes</a>
|
||||
<li><a href="#Typemaps_special_variables_and_macros">Special variables combined with special variable macros</a>
|
||||
|
|
@ -2457,13 +2458,40 @@ The result is the following expansion
|
|||
</pre>
|
||||
</div>
|
||||
|
||||
<H4><a name="Typemaps_special_macro_typemap_attribute">14.4.4.3 $typemap(method:attribute, typepattern)</a></H4>
|
||||
|
||||
|
||||
<p>
|
||||
The first argument, the typemap method, can look up the attribute of a
|
||||
typemap by appending a colon and the keyword. For example,
|
||||
<tt>$typemap(directorin:descriptor, $type)</tt> would be replaced by <tt>"D"</tt> if <tt>type</tt> is a <tt>double</tt>.
|
||||
An enhanced version of <tt>$typemap</tt> provides access to typemap attributes by
|
||||
appending a colon and the attribute name after the method name. In the example below,
|
||||
"cstype" is the typemap method and "out" is the typemap attribute.
|
||||
</p>
|
||||
|
||||
<div class="code">
|
||||
<pre>
|
||||
%typemap(cstype, out="object") XClass "XClass"
|
||||
%typemap(cscode) BarClass %{
|
||||
$typemap(cstype:out, XClass) bar()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
</pre>
|
||||
</div>
|
||||
<p>
|
||||
<em>New in SWIG 4.1.</em>
|
||||
which expands to
|
||||
</p>
|
||||
<div class="code">
|
||||
<pre>
|
||||
object bar()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
<p>
|
||||
<b>Compatibility note: </b> Support for typemap attributes in <tt>$typemap</tt>
|
||||
was introduced in SWIG-4.1.0.
|
||||
</p>
|
||||
|
||||
<H3><a name="Typemaps_special_variable_attributes">14.4.5 Special variables and typemap attributes</a></H3>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue