Interface macros: %interface %interface_impl %interface_custom
This commit is contained in:
parent
14d2341512
commit
3000824c94
5 changed files with 41 additions and 29 deletions
|
|
@ -3,9 +3,9 @@
|
|||
|
||||
#if defined(SWIGJAVA) || defined(SWIGCSHARP)
|
||||
%include "feature_interface.i"
|
||||
DECLARE_INTERFACE_RENAME(ABase1, SWIGTYPE_ABase1, Space::ABase1)
|
||||
DECLARE_INTERFACE_RENAME(CBase1, SWIGTYPE_CBase1, Space::CBase1)
|
||||
DECLARE_INTERFACE_RENAME(CBase2, SWIGTYPE_CBase2, Space::CBase2)
|
||||
%interface_custom("SWIGTYPE_ABase1", "ABase1", Space::ABase1)
|
||||
%interface_custom("SWIGTYPE_CBase1", "CBase1", Space::CBase1)
|
||||
%interface_custom("SWIGTYPE_CBase2", "CBase2", Space::CBase2)
|
||||
#endif
|
||||
|
||||
%inline %{
|
||||
|
|
|
|||
|
|
@ -2,9 +2,9 @@
|
|||
|
||||
#if defined(SWIGJAVA) || defined(SWIGCSHARP)
|
||||
%include "feature_interface.i"
|
||||
DECLARE_INTERFACE_RENAME(IA, A, IA)
|
||||
DECLARE_INTERFACE_RENAME(IB, B, IB)
|
||||
DECLARE_INTERFACE_RENAME(IC, C, IC)
|
||||
%interface_custom("A", "IA", IA)
|
||||
%interface_custom("B", "IB", IB)
|
||||
%interface_custom("%(strip:[I])s", "I%s", IC) // same as %interface_custom("C", "IC", IC)
|
||||
#endif
|
||||
%inline %{
|
||||
struct IA {
|
||||
|
|
@ -19,9 +19,9 @@ struct E : D {};
|
|||
%}
|
||||
|
||||
#if defined(SWIGJAVA) || defined(SWIGCSHARP)
|
||||
DECLARE_INTERFACE_RENAME(IJ, J, IJ)
|
||||
DECLARE_INTERFACE_RENAME(IK, K, IK)
|
||||
DECLARE_INTERFACE_RENAME(IL, L, IL)
|
||||
%interface_custom("J", "IJ", IJ)
|
||||
%interface_custom("K", "IK", IK)
|
||||
%interface_custom("L", "IL", IL)
|
||||
#endif
|
||||
%inline %{
|
||||
struct IJ { virtual void ij() {} };
|
||||
|
|
@ -31,7 +31,7 @@ struct M : IL {};
|
|||
%}
|
||||
|
||||
#if defined(SWIGJAVA) || defined(SWIGCSHARP)
|
||||
DECLARE_INTERFACE_RENAME(IQ, Q, IQ)
|
||||
%interface_custom("Q", "IQ", IQ)
|
||||
#endif
|
||||
%inline %{
|
||||
struct P { virtual void p() {}; };
|
||||
|
|
|
|||
|
|
@ -8,9 +8,9 @@
|
|||
|
||||
#if defined(SWIGJAVA) || defined(SWIGCSHARP)
|
||||
%include "feature_interface.i"
|
||||
DECLARE_INTERFACE_RENAME(ABase1, SWIGTYPE_ABase1, Space::ABase1)
|
||||
DECLARE_INTERFACE_RENAME(CBase1, SWIGTYPE_CBase1, Space::CBase1)
|
||||
DECLARE_INTERFACE_RENAME(CBase2, SWIGTYPE_CBase2, Space::CBase2)
|
||||
%interface_custom("SWIGTYPE_ABase1", "ABase1", Space::ABase1)
|
||||
%interface_custom("SWIGTYPE_CBase1", "CBase1", Space::CBase1)
|
||||
%interface_custom("SWIGTYPE_CBase2", "CBase2", Space::CBase2)
|
||||
#endif
|
||||
|
||||
#if defined(SWIGJAVA)
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
%define DECLARE_INTERFACE_(INTERFACE, CTYPE...)
|
||||
%feature("interface", name="INTERFACE") CTYPE;
|
||||
%define INTERFACE_TYPEMAPS(CTYPE...)
|
||||
%typemap(cstype) CTYPE "$&csinterfacename"
|
||||
%typemap(cstype) CTYPE *, CTYPE [], CTYPE & "$csinterfacename"
|
||||
%typemap(cstype) CTYPE *const& "$*csinterfacename"
|
||||
|
|
@ -36,12 +35,20 @@
|
|||
%}
|
||||
%enddef
|
||||
|
||||
%define DECLARE_INTERFACE_RENAME(INTERFACE, IMPL, CTYPE...)
|
||||
%rename (IMPL) CTYPE;
|
||||
DECLARE_INTERFACE_(INTERFACE, CTYPE)
|
||||
%define %interface(CTYPE...)
|
||||
%feature("interface", name="I%s") CTYPE;
|
||||
INTERFACE_TYPEMAPS(CTYPE)
|
||||
%enddef
|
||||
|
||||
%define DECLARE_INTERFACE(INTERFACE, CTYPE...)
|
||||
DECLARE_INTERFACE_(INTERFACE, CTYPE, CTYPE)
|
||||
%define %interface_impl(CTYPE...)
|
||||
%rename("%sSwigImpl") CTYPE;
|
||||
%feature("interface", name="%(regex:/(.*)SwigImpl$/\\1/)s") CTYPE;
|
||||
INTERFACE_TYPEMAPS(CTYPE)
|
||||
%enddef
|
||||
|
||||
%define %interface_custom(IMPL, INTERFACE, CTYPE...)
|
||||
%rename(IMPL) CTYPE;
|
||||
%feature("interface", name=INTERFACE) CTYPE;
|
||||
INTERFACE_TYPEMAPS(CTYPE)
|
||||
%enddef
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,4 @@
|
|||
%define DECLARE_INTERFACE_(INTERFACE, CTYPE...)
|
||||
%feature("interface", name="INTERFACE") CTYPE;
|
||||
//%feature("interface", name="%(rstrip:[Impl])s") CTYPE;
|
||||
//%feature("interface", name="%(regex:/(.*)Impl$/\\1/)s") CTYPE;
|
||||
%define INTERFACE_TYPEMAPS(CTYPE...)
|
||||
%typemap(jtype) CTYPE, CTYPE *, CTYPE *const&, CTYPE [], CTYPE & "long"
|
||||
%typemap(jstype) CTYPE "$&javainterfacename"
|
||||
%typemap(jstype) CTYPE *, CTYPE [], CTYPE & "$javainterfacename"
|
||||
|
|
@ -49,12 +46,20 @@
|
|||
%}
|
||||
%enddef
|
||||
|
||||
%define DECLARE_INTERFACE_RENAME(INTERFACE, IMPL, CTYPE...)
|
||||
%rename (IMPL) CTYPE;
|
||||
DECLARE_INTERFACE_(INTERFACE, CTYPE)
|
||||
%define %interface(CTYPE...)
|
||||
%feature("interface", name="I%s") CTYPE;
|
||||
INTERFACE_TYPEMAPS(CTYPE)
|
||||
%enddef
|
||||
|
||||
%define DECLARE_INTERFACE(INTERFACE, CTYPE...)
|
||||
DECLARE_INTERFACE_(INTERFACE, CTYPE)
|
||||
%define %interface_impl(CTYPE...)
|
||||
%rename("%sSwigImpl") CTYPE;
|
||||
%feature("interface", name="%(regex:/(.*)SwigImpl$/\\1/)s") CTYPE;
|
||||
INTERFACE_TYPEMAPS(CTYPE)
|
||||
%enddef
|
||||
|
||||
%define %interface_custom(IMPL, INTERFACE, CTYPE...)
|
||||
%rename(IMPL) CTYPE;
|
||||
%feature("interface", name=INTERFACE) CTYPE;
|
||||
INTERFACE_TYPEMAPS(CTYPE)
|
||||
%enddef
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue