Correct explanation of how to match on class name in %rename.

Replace incorrect documentation of $parentNode from %rename discussion: it
advised using match$parentNode but this doesn't work because the parent node
is not yet set when %rename is parsed.

Document the "fullname" attribute of %rename which can be used to restrict the
match to the given full name of a declaration only.

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12291 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Vadim Zeitlin 2010-11-16 14:08:50 +00:00
commit e30befd138

View file

@ -2002,22 +2002,6 @@ documentation is not exhaustive, see "%rename predicates" section of
<tt>swig.swg</tt> for the full list of supported match expressions.
</p>
<p>
Another important feature of <tt>match</tt> is that it can be applied not
only to the declaration itself but also to its enclosing declaration. So
<tt>match$parentNode$name="SomeClass"</tt> would be true only for members of
the C++ class with the specified name. This can, of course, be combined with
more complicated matches making it possible to write
</p>
<div class="code">
<pre>
%rename("%(lowercase)s", match$parentNode$name="SomeClass", %$isenum) "";
</pre>
</div>
<p>
to rename all enums nested in the given class to lower case.
</p>
<p>
In addition to literally matching some string with <tt>match</tt> you can
also use <tt>regexmatch</tt> or <tt>notregexmatch</tt> to match a string
@ -2039,6 +2023,14 @@ declaration name directly can be preferable and can also be done using
%rename("$ignore", regextarget=1) "Old$";
</pre>
</div>
Notice that the check is done only against the name of the declaration
itself, if you need to match the full name of a C++ declaration you
must use <tt>fullname</tt> attribute:
<div class="code">
<pre>
%rename("$ignore", regextarget=1, fullname=1) "NameSpace::ClassName::.*Old$";
</pre>
</div>
<p>
As for <tt>notregexmatch</tt>, it restricts the match only to the strings not