From f1090f5a5c52c9ddab1551dbe3259a3b4ebccd2a Mon Sep 17 00:00:00 2001 From: William S Fulton Date: Thu, 3 Jun 2004 22:26:27 +0000 Subject: [PATCH] javagetcptr and javaptrconstructormodifiers typemap replaced by the javabody/javabody_derived typemap javaclassmodifiers typemap now contains the class type git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@5965 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- Lib/java/java.swg | 58 ++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 50 insertions(+), 8 deletions(-) diff --git a/Lib/java/java.swg b/Lib/java/java.swg index e37f27526..68d3b8835 100644 --- a/Lib/java/java.swg +++ b/Lib/java/java.swg @@ -878,11 +878,56 @@ /* Typemaps used for the generation of proxy and type wrapper class code */ %typemap(javabase) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE [], SWIGTYPE (CLASS::*) "" -%typemap(javaclassmodifiers) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE [], SWIGTYPE (CLASS::*) "public" +%typemap(javaclassmodifiers) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE [], SWIGTYPE (CLASS::*) "public class" %typemap(javacode) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE [], SWIGTYPE (CLASS::*) "" %typemap(javaimports) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE [], SWIGTYPE (CLASS::*) "" %typemap(javainterfaces) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE [], SWIGTYPE (CLASS::*) "" -%typemap(javaptrconstructormodifiers) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE [], SWIGTYPE (CLASS::*) "protected" + +// Proxy classes (base classes, ie, not derived classes) +%typemap(javabody) SWIGTYPE %{ + private long swigCPtr; + protected boolean swigCMemOwn; + + protected $javaclassname(long cPtr, boolean cMemoryOwn) { + swigCMemOwn = cMemoryOwn; + swigCPtr = cPtr; + } + + protected static long getCPtr($javaclassname obj) { + return (obj == null) ? 0 : obj.swigCPtr; + } +%} + +// Derived proxy classes +%typemap(javabody_derived) SWIGTYPE %{ + private long swigCPtr; + + protected $javaclassname(long cPtr, boolean cMemoryOwn) { + super($moduleJNI.SWIG$javaclassnameUpcast(cPtr), cMemoryOwn); + swigCPtr = cPtr; + } + + protected static long getCPtr($javaclassname obj) { + return (obj == null) ? 0 : obj.swigCPtr; + } +%} + +// Typewrapper classes +%typemap(javabody) SWIGTYPE *, SWIGTYPE &, SWIGTYPE [], SWIGTYPE (CLASS::*) %{ + private long swigCPtr; + + protected $javaclassname(long cPtr, boolean bFutureUse) { + swigCPtr = cPtr; + } + + protected $javaclassname() { + swigCPtr = 0; + } + + protected static long getCPtr($javaclassname obj) { + return (obj == null) ? 0 : obj.swigCPtr; + } +%} %typemap(javafinalize) SWIGTYPE %{ protected void finalize() { @@ -907,17 +952,14 @@ super.delete(); } -%typemap(javagetcptr) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE [], SWIGTYPE (CLASS::*) %{ - protected static long getCPtr($javaclassname obj) { - return (obj == null) ? 0 : obj.swigCPtr; - } -%} - /* Java specific directives */ #define %javaconst(flag) %feature("java:const","flag") #define %javaenum(wrapapproach) %feature("java:enum","wrapapproach") #define %javamethodmodifiers %feature("java:methodmodifiers") +%pragma(java) jniclassclassmodifiers="class" +%pragma(java) moduleclassmodifiers="public class" + /* Some ANSI C typemaps */ %apply long { size_t };