add docs about the new directive forms %ref/%unref for the old ref/unref features

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@8554 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Marcelo Matus 2006-01-25 19:07:28 +00:00
commit 5b9da12c6f

View file

@ -1997,7 +1997,8 @@ Object 'RCObj', which implements the ref/unref idiom.
<p> <p>
To tell SWIG that 'RCObj' and all its derived classes are reference To tell SWIG that 'RCObj' and all its derived classes are reference
counted objects, you use the "ref" and "unref" features. For example: counted objects, you use the "ref" and "unref" features, or
<tt>%ref</tt> and <tt>%unref</tt> directives (since 1.3.28). For example:
</p> </p>
@ -2015,8 +2016,27 @@ counted objects, you use the "ref" and "unref" features. For example:
</pre> </pre>
</div> </div>
or, using the directive form:
<div class="code">
<pre>
%module example
...
%ref RCObj "$this->ref();"
%unref RCObj "$this->unref();"
%include "rcobj.h"
%include "A.h"
...
</pre>
</div>
<p> <p>
where the code passed to the "ref" and "unref" methods will be where the code passed to the "ref" and "unref" features will be
executed as needed whenever a new object is passed to python, or when executed as needed whenever a new object is passed to python, or when
python tries to release the shadow object instance, respectively. python tries to release the shadow object instance, respectively.
</p> </p>
@ -2058,7 +2078,7 @@ them as:
<p> <p>
In other words, SWIG will not do anything special when a new object In other words, SWIG will not do anything special when a new object
is passed to python, and it will always 'delete' the object when is passed to python, and it will always 'delete' the object when
python releases the shadow instance. python releases the proxy instance.
</p> </p>