mirror of https://github.com/swig/swig
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:
parent
f4fbfa65be
commit
ca58db87b6
|
@ -99,7 +99,7 @@ functions like this:
|
|||
class VectorArray {
|
||||
public:
|
||||
...
|
||||
%addmethods {
|
||||
%extend {
|
||||
Vector &get(int index) {
|
||||
return (*self)[index];
|
||||
}
|
||||
|
|
|
@ -42,7 +42,7 @@ template<class T> class vector {
|
|||
v[index] = val;
|
||||
}
|
||||
#ifdef SWIG
|
||||
%addmethods {
|
||||
%extend {
|
||||
T getitem(int index) {
|
||||
return self->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
|
||||
|
|
|
@ -104,7 +104,7 @@ with a pair of set/get functions like this:
|
|||
class VectorArray {
|
||||
public:
|
||||
...
|
||||
%addmethods {
|
||||
%extend {
|
||||
Vector &get(int index) {
|
||||
return (*self)[index];
|
||||
}
|
||||
|
|
|
@ -41,7 +41,7 @@ template<class T> class vector {
|
|||
v[index] = val;
|
||||
}
|
||||
#ifdef SWIG
|
||||
%addmethods {
|
||||
%extend {
|
||||
T getitem(int index) {
|
||||
return self->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>
|
||||
|
||||
|
|
|
@ -104,7 +104,7 @@ with a pair of set/get functions like this:
|
|||
class VectorArray {
|
||||
public:
|
||||
...
|
||||
%addmethods {
|
||||
%extend {
|
||||
Vector &get(int index) {
|
||||
return (*self)[index];
|
||||
}
|
||||
|
|
|
@ -104,7 +104,7 @@ with a pair of set/get functions like this:
|
|||
class VectorArray {
|
||||
public:
|
||||
...
|
||||
%addmethods {
|
||||
%extend {
|
||||
Vector &get(int index) {
|
||||
return (*self)[index];
|
||||
}
|
||||
|
|
|
@ -104,7 +104,7 @@ with a pair of set/get functions like this:
|
|||
class VectorArray {
|
||||
public:
|
||||
...
|
||||
%addmethods {
|
||||
%extend {
|
||||
Vector &get(int index) {
|
||||
return (*self)[index];
|
||||
}
|
||||
|
|
|
@ -104,7 +104,7 @@ with a pair of set/get functions like this:
|
|||
class VectorArray {
|
||||
public:
|
||||
...
|
||||
%addmethods {
|
||||
%extend {
|
||||
Vector &get(int index) {
|
||||
return (*self)[index];
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/* File : example.i */
|
||||
%readonly
|
||||
%immutable;
|
||||
extern int status;
|
||||
extern char path[256];
|
||||
|
||||
|
|
|
@ -76,7 +76,7 @@ Vector addv(Vector &a, Vector &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 &a, Vector &b) {
|
|||
<swigxml:type string="void" />
|
||||
</c:function>
|
||||
</swigxml:child>
|
||||
</swig:addmethods>
|
||||
</swig:extend>
|
||||
</swigxml:child>
|
||||
<swigxml:classtype string="class" />
|
||||
<swigxml:namespace string="VectorArray" />
|
||||
|
|
|
@ -32,7 +32,7 @@ public:
|
|||
int size();
|
||||
|
||||
/* This wrapper provides an alternative to the [] operator */
|
||||
%addmethods {
|
||||
%extend {
|
||||
Vector &get(int index) {
|
||||
return (*self)[index];
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue