fix and expand doc for %naturalvar

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@8564 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Marcelo Matus 2006-01-26 18:13:59 +00:00
commit dc11cae49a

View file

@ -655,19 +655,23 @@ Version 1.3.28 (unreleased).
variables in a more natural way, ie, similar to the global variables in a more natural way, ie, similar to the global
variable behavior. variable behavior.
If you use You cam use it in a global way via the command line
swig -naturalvar ... swig -naturalvar ...
or or the module mode option
%module(naturalvar="1") %module(naturalvar=1)
or both forms make swig to treat all the member variables in the
same way it treats global variables.
%naturalvar std::string Also, you can use it in a case by case approach for
specific member variables using the directive form:
then, in the following case: %naturalvar Bar::s;
Then, in the following case for example:
std::string s; std::string s;
struct Bar { struct Bar {
@ -691,12 +695,11 @@ Version 1.3.28 (unreleased).
Hence, for 'naturalvar' to work, each target language Hence, for 'naturalvar' to work, each target language
must implement 'typemap(in/out) const Type&' properly. must implement 'typemap(in/out) const Type&' properly.
The 'naturalvar' option makes (little dangerous) The 'naturalvar' option replaces or makes workarounds such as:
workarounds such as:
%apply(const std::string &) { std::string *} %apply const std::string & { std::string *}
obsoletes. unnecessary.
Note1: If your interface has other kind of workarounds to Note1: If your interface has other kind of workarounds to
deal with the old 'unnatural' way to deal with member deal with the old 'unnatural' way to deal with member