diff --git a/Doc/Manual/Contents.html b/Doc/Manual/Contents.html index 6db478d61..a3d0dcb4e 100644 --- a/Doc/Manual/Contents.html +++ b/Doc/Manual/Contents.html @@ -171,7 +171,7 @@
Closely related to %rename is the %ignore directive. %ignore instructs SWIG to ignore declarations that match a given identifier. For example: @@ -1915,57 +1918,6 @@ This directive is still supported, but it is deprecated and should probably be a directive is more powerful and better supports wrapping of raw header file information.
--Suppose there is a method in a class that you need to replace. You -can do the following to replace the myfunc() method: - -
-%extend MyClass {
- void myfunc() {
- std::cout << "swig myfunc" << std::endl;
- }
-}
-
-%ignore MyClass::myfunc;
-
-%inline %{
-class MyClass {
-public:
- void myfunc() {
- std::cout << "class myfunc" << std::endl;
- }
-};
-%}
-
--Or if your code organization makes more sense to put -the %extend after the class definition, you would need to following: -
- -
-%rename("") MyClass::myfunc;
-
--before the %extend or SWIG will continue to ignore -the myfunc() method, even in an %extend. -
- --Note that you can call the class method from the method -in %extend, just use self->myfunc() and it will call -the class method, not the one in %extend. -
- -+Suppose there is a method in a class that you need to replace and keep the method name the same. +This can be achieved combining the %extend and %ignore directives covered earlier. +Here is an example to replace the MyClass::mymethod(): + +
+%extend MyClass {
+ void mymethod() {
+ std::cout << "swig mymethod" << std::endl;
+ }
+}
+
+%ignore MyClass::mymethod;
+
+%inline %{
+class MyClass {
+public:
+ void mymethod() {
+ std::cout << "class mymethod" << std::endl;
+ }
+};
+%}
+
++Or if your code organization makes more sense to put +the %extend after the class definition, you would need the following: +
+ +
+%rename("") MyClass::mymethod; // unignores the method
+
++before the %extend or SWIG will continue to ignore +mymethod(), even in an %extend. +
+ ++Note that you can call the class method from the method +in %extend, just use self->mymethod() and it will call +the class method, not the one in %extend. +
+ + +