diff options
author | William S Fulton <wsf@fultondesigns.co.uk> | 2016-02-11 19:37:31 +0000 |
---|---|---|
committer | William S Fulton <wsf@fultondesigns.co.uk> | 2016-02-11 19:37:31 +0000 |
commit | abccc13a4a167f7074b56ad8cf392ce3df38d917 (patch) | |
tree | 305f436d5b3ac31b1590c798869a302cd745b993 /Lib/java | |
parent | 290e2d3a5c1195faeeacb110eb64a92f4dc6360e (diff) | |
parent | 3931b5800c8d11ef8566d7fc88c2bd4c40d8352b (diff) | |
download | swig-abccc13a4a167f7074b56ad8cf392ce3df38d917.tar.gz |
Merge branch 'interfaces' into interfaces2
* interfaces:
Remove unnecessary interfaces for concrete classes
cosmetic code formatting changes
Correct interface name attributes that are internal
interface macro changes to support templates
Test non-virtual method in Derived classes
interface tests for a most derived class inheriting the interfaces further up the chain
Rename GetCPtr/getCPtr to SWIGInterfaceUpcast
interface feature support for const ref pointers (used by the STL)
Interface feature support for arrays
More interface feature testing for return values
interface feature support for passing by value
interface feature support for references
Multiple inheritance parameters as pointers testing
Simplify multiple_inheritance_abstract Java runtime test
Warning fixes
Rename test functions in multiple_inheritance_abstract testcase
Formatting fixes in generated code for interface feature
Cosmetic spacing changes in test case
interface feature typemap corrections to handle NULL pointers
interface test added
javadirectorin fix
interface implementation visibility
interface inheritance (2)
interface inheritance (1)
feature:interface ported to Java
propagate non-abstract "interface" base methods (3)
propagate non-abstract "interface" base methods (2)
propagate non-abstract "interface" base methods (1)
namespace support added GetCPtr now returns HandleRef "feature:interface:name" is now mandatory attribute
interfaces (1)
interfaces (1)
Conflicts:
Source/Modules/csharp.cxx
Source/Modules/java.cxx
Diffstat (limited to 'Lib/java')
-rw-r--r-- | Lib/java/feature_interface.i | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/Lib/java/feature_interface.i b/Lib/java/feature_interface.i new file mode 100644 index 000000000..e6dd9ba27 --- /dev/null +++ b/Lib/java/feature_interface.i @@ -0,0 +1,31 @@ +%define DECLARE_INTERFACE_(INTERFACE, IMPL, CTYPE...) +%feature("interface", name = "INTERFACE", cptr = #INTERFACE ## "_SWIGInterfaceUpcast") CTYPE; +%typemap(jtype, nopgcpp="1") CTYPE, CTYPE *, CTYPE *const&, CTYPE [], CTYPE & "long" +%typemap(jstype) CTYPE, CTYPE *, CTYPE *const&, CTYPE [], CTYPE & "INTERFACE" +%typemap(javain) CTYPE, CTYPE & "$javainput." ## #INTERFACE ## "_SWIGInterfaceUpcast()" +%typemap(javain) CTYPE *, CTYPE *const&, CTYPE [] "($javainput == null) ? 0 : $javainput." ## #INTERFACE ## "_SWIGInterfaceUpcast()" +%typemap(javaout) CTYPE { + return (INTERFACE)new IMPL($jnicall, true); + } +%typemap(javaout) CTYPE & { + return (INTERFACE)new IMPL($jnicall, $owner); + } +%typemap(javaout) CTYPE *, CTYPE *const&, CTYPE [] { + long cPtr = $jnicall; + return (cPtr == 0) ? null : (INTERFACE)new IMPL(cPtr, $owner); + } +%typemap(javadirectorin) CTYPE, CTYPE & "(INTERFACE)new IMPL($jniinput, false)" +%typemap(javadirectorin) CTYPE *, CTYPE *const&, CTYPE [] "($jniinput == 0) ? null : (INTERFACE)new IMPL($jniinput, false)" +%typemap(javadirectorout) CTYPE, CTYPE *, CTYPE *const&, CTYPE [], CTYPE & "$javacall." ## #INTERFACE ## "_SWIGInterfaceUpcast()" +SWIG_JAVABODY_PROXY(public, protected, CTYPE) +%enddef + +%define DECLARE_INTERFACE_RENAME(INTERFACE, IMPL, CTYPE...) +%rename (IMPL) CTYPE; +DECLARE_INTERFACE_(INTERFACE, IMPL, CTYPE) +%enddef + +%define DECLARE_INTERFACE(INTERFACE, CTYPE...) +DECLARE_INTERFACE_(INTERFACE, CTYPE, CTYPE) +%enddef + |