Update lingering uses of %addmethods

This was renamed to %extend 21 years ago!

The remaining uses are either in docs for the reference example or in
xml examples (which can't actually be run because they the SWIG command
line syntax they try to use is wrong).
This commit is contained in:
Olly Betts 2023-05-29 11:40:53 +12:00
parent f4fbfa65be
commit ca58db87b6
11 changed files with 14 additions and 14 deletions

View File

@ -99,7 +99,7 @@ functions like this:
class VectorArray {
public:
...
%addmethods {
%extend {
Vector &get(int index) {
return (*self)[index];
}

View File

@ -42,7 +42,7 @@ template<class T> class vector {
v[index] = val;
}
#ifdef SWIG
%addmethods {
%extend {
T getitem(int index) {
return self-&gt;get(index);
}
@ -54,7 +54,7 @@ template<class T> class vector {
};
</pre>
</blockquote>
The %addmethods is used for a neater interface from Go as the
The %extend is used for a neater interface from Go as the
functions <tt>get</tt> and <tt>set</tt> use C++ references to
primitive types. These are tricky to use from Go as they end up as
pointers, which only work when the C++ and Go types correspond

View File

@ -104,7 +104,7 @@ with a pair of set/get functions like this:
class VectorArray {
public:
...
%addmethods {
%extend {
Vector &amp;get(int index) {
return (*self)[index];
}

View File

@ -41,7 +41,7 @@ template<class T> class vector {
v[index] = val;
}
#ifdef SWIG
%addmethods {
%extend {
T getitem(int index) {
return self-&gt;get(index);
}
@ -53,7 +53,7 @@ template<class T> class vector {
};
</pre>
</blockquote>
The %addmethods is used for a neater interface from Java as the functions <tt>get</tt> and <tt>set</tt> use C++ references to primitive types. These are tricky to use from Java as they end up as a pointer in Java (Java long).
The %extend is used for a neater interface from Java as the functions <tt>get</tt> and <tt>set</tt> use C++ references to primitive types. These are tricky to use from Java as they end up as a pointer in Java (Java long).
<h2>The SWIG interface</h2>

View File

@ -104,7 +104,7 @@ with a pair of set/get functions like this:
class VectorArray {
public:
...
%addmethods {
%extend {
Vector &amp;get(int index) {
return (*self)[index];
}

View File

@ -104,7 +104,7 @@ with a pair of set/get functions like this:
class VectorArray {
public:
...
%addmethods {
%extend {
Vector &amp;get(int index) {
return (*self)[index];
}

View File

@ -104,7 +104,7 @@ with a pair of set/get functions like this:
class VectorArray {
public:
...
%addmethods {
%extend {
Vector &amp;get(int index) {
return (*self)[index];
}

View File

@ -104,7 +104,7 @@ with a pair of set/get functions like this:
class VectorArray {
public:
...
%addmethods {
%extend {
Vector &amp;get(int index) {
return (*self)[index];
}

View File

@ -1,5 +1,5 @@
/* File : example.i */
%readonly
%immutable;
extern int status;
extern char path[256];

View File

@ -76,7 +76,7 @@ Vector addv(Vector &amp;a, Vector &amp;b) {
<c:function name="size" >
<swigxml:type string="int" />
</c:function>
<swig:addmethods >
<swig:extend >
<swigxml:child >
<c:function name="get" >
<swigxml:parms >
@ -106,7 +106,7 @@ Vector addv(Vector &amp;a, Vector &amp;b) {
<swigxml:type string="void" />
</c:function>
</swigxml:child>
</swig:addmethods>
</swig:extend>
</swigxml:child>
<swigxml:classtype string="class" />
<swigxml:namespace string="VectorArray" />

View File

@ -32,7 +32,7 @@ public:
int size();
/* This wrapper provides an alternative to the [] operator */
%addmethods {
%extend {
Vector &get(int index) {
return (*self)[index];
}