diff --git a/Doc/Manual/Contents.html b/Doc/Manual/Contents.html index 4211d8ab8..97db5f11c 100644 --- a/Doc/Manual/Contents.html +++ b/Doc/Manual/Contents.html @@ -239,8 +239,8 @@
-The name matching rules outlined in the Ambiguity resolution and renaming +The name matching rules outlined in the Renaming and ambiguity resolution section applies to all %feature directives. In fact the %rename directive is just a special form of %feature. The matching rules mean that features are very flexible and can be applied with diff --git a/Doc/Manual/SWIG.html b/Doc/Manual/SWIG.html index 9956f834c..de9e2ec31 100644 --- a/Doc/Manual/SWIG.html +++ b/Doc/Manual/SWIG.html @@ -1737,41 +1737,14 @@ careful about namespaces and your use of modules, you can usually avoid these problems.
-%rename directive respects function parameters and discriminates default parameters from non-default, -which is essential for some languages including Python. Be careful renaming functions having default parameters: +When wrapping C code, simple use of identifiers/symbols with %rename usually suffices. +When wrapping C++ code, simple use of simple identifiers/symbols with %rename might be too +limiting when using C++ features such as function overloading, default arguments, namespaces, template specialization etc. +If you are using the %rename directive and C++, make sure you read the +SWIG and C++ chapter and in particular the section on +Renaming and ambiguity resolution +for method overloading and default arguments.
-
-%rename(toFFVal) to_val(FileFormat, bool bin=false);
-int to_val(FileFormat flag, bool bin=false)
-{
- return 0;
-}
-
-%rename(toDFVal) to_val(DirFormat, bool bin);
-int to_val(DirFormat flag, bool bin=false)
-{
- return 0;
-}
-
-%rename(toLFVal) to_val(FolderFormat, bool bin);
-int to_val(FolderFormat flag, bool bin=false)
-{
- return 0;
-}
-
-The SWIG generator yields the following warning for the last renaming:
-
-rename.i:36: Warning 509: Overloaded method to_val(FolderFormat) effectively ignored,
-rename.i:26: Warning 509: as it is shadowed by to_val(DirFormat).
-
-The renaming performed for the int to_val(FolderFormat flag, bool bin),
-but not for the int to_val(FolderFormat flag), where the second parameter bool bin
-is omitted taking the default value false. See details about the default
-parameters processing in the Default Arguments section.
-
Closely related to %rename is the %ignore directive. %ignore instructs SWIG @@ -2115,7 +2088,7 @@ except those consisting of capital letters only:
Finally, variants of %rename and %ignore directives can be used to help wrap C++ overloaded functions and methods or C++ methods which use default arguments. This is described in the -Ambiguity resolution and renaming section in the C++ chapter. +Renaming and ambiguity resolution section in the C++ chapter.
diff --git a/Doc/Manual/SWIGPlus.html b/Doc/Manual/SWIGPlus.html index 693c13aae..18059b40d 100644 --- a/Doc/Manual/SWIGPlus.html +++ b/Doc/Manual/SWIGPlus.html @@ -42,8 +42,8 @@The wrappers produced are exactly the same as if the above code was instead fed into SWIG. -Details of this are covered later in the Overloaded functions and methods section. +Details of this are covered in the next section Overloaded functions and methods. This approach allows SWIG to wrap all possible default arguments, but can be verbose. For example if a method has ten default arguments, then eleven wrapper methods are generated.
@@ -1780,7 +1780,7 @@ For example if a method has ten default arguments, then eleven wrapper methods aPlease see the Features and default arguments section for more information on using %feature with functions with default arguments. -The Ambiguity resolution and renaming section +The Renaming and ambiguity resolution section also deals with using %rename and %ignore on methods with default arguments. If you are writing your own typemaps for types used in methods with default arguments, you may also need to write a typecheck typemap. See the Typemaps and overloading section for details or otherwise @@ -2031,7 +2031,7 @@ checked in the same order as they appear in this ranking. If you're still confused, don't worry about it---SWIG is probably doing the right thing.
-@@ -2149,7 +2149,7 @@ it means that the target language module has not yet implemented support for ove functions and methods. The only way to fix the problem is to read the next section.
-@@ -2562,8 +2562,7 @@ exactly matches the wrapped method:
The C++ method can then be called from the target language with the new name no matter how many arguments are specified, for example: newbar(2, 2.0), newbar(2) or newbar(). -However, if the %rename does not contain the default arguments, it will only apply to the single equivalent target language overloaded method. -So if instead we have: +However, if the %rename does not contain the default arguments:
+then only one of the three equivalent overloaded methods will be renamed and wrapped as if SWIG parsed: +
+ ++void Spam::newbar(int i, double d); +void Spam::bar(int i); +void Spam::bar(); ++
The C++ method must then be called from the target language with the new name newbar(2, 2.0) when both arguments are supplied or with the original name as bar(2) (one argument) or bar() (no arguments). +
+ +In fact it is possible to use %rename on the equivalent overloaded methods, to rename all the equivalent overloaded methods: