Fix director typemap searching so that a typemap specified with a name will be correctly matched. Previously the name was ignored during the typemap search. Implemented by ensuring the 'type' attribute in the Node is set up correctly and using the usual Swig_typemap_lookup on the Node.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@13873 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
c4e4b4b610
commit
f6229d4b73
12 changed files with 201 additions and 348 deletions
48
Examples/test-suite/typemap_directorout.i
Normal file
48
Examples/test-suite/typemap_directorout.i
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
// Test named output typemaps used in directors are found during the typematch search
|
||||
%module(directors="1") typemap_directorout
|
||||
|
||||
%warnfilter(SWIGWARN_TYPEMAP_THREAD_UNSAFE,SWIGWARN_TYPEMAP_DIRECTOROUT_PTR) Class1;
|
||||
|
||||
%feature("director");
|
||||
|
||||
%typemap(out) MyType & %{ WILL_NOT_COMPILE %}
|
||||
%typemap(out) MyType &USEME = SWIGTYPE &;
|
||||
%typemap(out) MyType &Class1::foo2, MyType &foo1 %{ /* special start */ $typemap(out, MyType &USEME) /* special end */ %}
|
||||
|
||||
%typemap(directorout) MyType & %{ WILL_NOT_COMPILE %}
|
||||
// Can't use the %typemap(directorout) MyType & = SWIGTYPE & approach as non-director languages don't define any directorout typemaps
|
||||
%typemap(directorout) MyType &Class1::foo2, MyType &foo1 %{ /* special start */ $input = 0; /* special end */ %}
|
||||
|
||||
|
||||
#ifdef SWIGCSHARP
|
||||
%typemap(csdirectorout) MyType & %{ WILL_NOT_COMPILE %}
|
||||
%typemap(csdirectorout) MyType &USEME = SWIGTYPE &;
|
||||
%typemap(csdirectorout) MyType &Class1::foo2, MyType &foo1 %{ /* special start */ $typemap(csdirectorout, MyType &USEME) /* special end */ %}
|
||||
#endif
|
||||
|
||||
#ifdef SWIGD
|
||||
%typemap(ddirectorout) MyType & %{ WILL_NOT_COMPILE %}
|
||||
%typemap(ddirectorout) MyType &USEME = SWIGTYPE &;
|
||||
%typemap(ddirectorout) MyType &Class1::foo2, MyType &foo1 %{ /* special start */ $typemap(ddirectorout, MyType &USEME) /* special end */ %}
|
||||
#endif
|
||||
|
||||
#ifdef SWIGJAVA
|
||||
%typemap(javadirectorout) MyType & %{ WILL_NOT_COMPILE %}
|
||||
%typemap(javadirectorout) MyType &USEME = SWIGTYPE &;
|
||||
%typemap(javadirectorout) MyType &Class1::foo2, MyType &foo1 %{ /* special start */ $typemap(javadirectorout, MyType &USEME) /* special end */ %}
|
||||
#endif
|
||||
|
||||
%inline %{
|
||||
typedef int MyType;
|
||||
class Class1
|
||||
{
|
||||
MyType mt;
|
||||
public:
|
||||
Class1() : mt() {}
|
||||
virtual MyType & foo1() { return mt; }
|
||||
virtual MyType & foo2(int parm1) { return mt; }
|
||||
virtual MyType & foo2() { return mt; }
|
||||
virtual ~Class1() {}
|
||||
};
|
||||
%}
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue