Create javainterfacecode and csinterfacecode typemaps

The interface feature is no longer hard coded and can
be controlled by a user via these new typemaps.
This commit is contained in:
William S Fulton 2016-02-23 06:54:37 +00:00
commit e7bb3afa0c
5 changed files with 136 additions and 50 deletions

View file

@ -1,5 +1,5 @@
%define DECLARE_INTERFACE_(INTERFACE, IMPL, CTYPE...)
%feature("interface", name = "INTERFACE", cptr = "SWIGInterfaceUpcast") CTYPE;
%feature("interface", name="INTERFACE") CTYPE;
%typemap(cstype) CTYPE, CTYPE *, CTYPE [], CTYPE &, CTYPE *const& "INTERFACE"
%typemap(csin) CTYPE, CTYPE & "$csinput.SWIGInterfaceUpcast()"
%typemap(csin) CTYPE *, CTYPE *const&, CTYPE [] "$csinput == null ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : $csinput.SWIGInterfaceUpcast()"
@ -19,6 +19,12 @@
%typemap(csdirectorin) CTYPE, CTYPE & "(INTERFACE)new IMPL($iminput, false)"
%typemap(csdirectorin) CTYPE *, CTYPE *const&, CTYPE [] "($iminput == global::System.IntPtr.Zero) ? null : (INTERFACE)new IMPL($iminput, false)"
%typemap(csdirectorout) CTYPE, CTYPE *, CTYPE *const&, CTYPE [], CTYPE & "$cscall.SWIGInterfaceUpcast()"
%typemap(csinterfacecode, declaration=" [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]\n global::System.Runtime.InteropServices.HandleRef SWIGInterfaceUpcast();\n", cptrmethod="$interfacename_SWIGInterfaceUpcast") CTYPE %{
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
global::System.Runtime.InteropServices.HandleRef $interfacename.SWIGInterfaceUpcast() {
return new global::System.Runtime.InteropServices.HandleRef(($interfacename)this, $imclassname.$csclazzname$interfacename_SWIGInterfaceUpcast(swigCPtr.Handle));
}
%}
%enddef
%define DECLARE_INTERFACE_RENAME(INTERFACE, IMPL, CTYPE...)