Update documentation for using SWIG_ConvertPtr example usage
Add a test case to test the example documentation typemaps
This commit is contained in:
parent
268b942865
commit
96015de0dd
8 changed files with 125 additions and 54 deletions
|
|
@ -5208,8 +5208,9 @@ is usually accessed as follows:
|
|||
<div class="code">
|
||||
<pre>
|
||||
Foo *f;
|
||||
if (SWIG_ConvertPtr($input, (void **) &f, SWIGTYPE_p_Foo, SWIG_POINTER_EXCEPTION) == -1)
|
||||
return NULL;
|
||||
if (!SWIG_IsOK(SWIG_ConvertPtr($input, (void **) &f, SWIGTYPE_p_Foo, 0))) {
|
||||
SWIG_exception_fail(SWIG_TypeError, "in method '$symname', expecting type Foo");
|
||||
}
|
||||
|
||||
PyObject *obj;
|
||||
obj = SWIG_NewPointerObj(f, SWIGTYPE_p_Foo, 0);
|
||||
|
|
@ -5224,8 +5225,9 @@ variable <tt>$1_descriptor</tt>. For example:
|
|||
<div class="code">
|
||||
<pre>
|
||||
%typemap(in) Foo * {
|
||||
if ((SWIG_ConvertPtr($input,(void **) &$1, $1_descriptor,SWIG_POINTER_EXCEPTION)) == -1)
|
||||
return NULL;
|
||||
if (!SWIG_IsOK(SWIG_ConvertPtr($input, (void **) &$1, $1_descriptor, 0))) {
|
||||
SWIG_exception_fail(SWIG_TypeError, "in method '$symname', expecting type Foo");
|
||||
}
|
||||
}
|
||||
</pre>
|
||||
</div>
|
||||
|
|
@ -5238,9 +5240,9 @@ For example:
|
|||
<div class="code">
|
||||
<pre>
|
||||
%typemap(in) Foo * {
|
||||
if ((SWIG_ConvertPtr($input,(void **) &$1, $descriptor(Foo *),
|
||||
SWIG_POINTER_EXCEPTION)) == -1)
|
||||
return NULL;
|
||||
if (!SWIG_IsOK(SWIG_ConvertPtr($input, (void **) &$1, $descriptor(Foo *), 0))) {
|
||||
SWIG_exception_fail(SWIG_TypeError, "in method '$symname', expecting type Foo");
|
||||
}
|
||||
}
|
||||
</pre>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue