Fix inconsistencies in Java and C# getCPtr() and pointer constructor visibility - change to protected/internal from public. Add SWIG_JAVABODY_PROXY, SWIG_JAVABODY_TYPEWRAPPER and SWIG_CSBODY_PROXY, SWIG_CSBODY_TYPEWRAPPER for users to easily change when using multiple modules.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12843 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
959fdf2053
commit
6a74028e65
9 changed files with 168 additions and 77 deletions
|
|
@ -1116,9 +1116,11 @@ SWIGINTERN const char * SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
|
|||
|
||||
/* javabody typemaps */
|
||||
|
||||
%define SWIG_JAVABODY_METHODS(PTRCTOR_VISIBILITY, CPTR_VISIBILITY, TYPENAME...)
|
||||
%define SWIG_JAVABODY_METHODS(PTRCTOR_VISIBILITY, CPTR_VISIBILITY, TYPE...) SWIG_JAVABODY_PROXY(PTRCTOR_VISIBILITY, CPTR_VISIBILITY, TYPE) %enddef // legacy name
|
||||
|
||||
%define SWIG_JAVABODY_PROXY(PTRCTOR_VISIBILITY, CPTR_VISIBILITY, TYPE...)
|
||||
// Base proxy classes
|
||||
%typemap(javabody) TYPENAME %{
|
||||
%typemap(javabody) TYPE %{
|
||||
private long swigCPtr;
|
||||
protected boolean swigCMemOwn;
|
||||
|
||||
|
|
@ -1133,7 +1135,7 @@ SWIGINTERN const char * SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
|
|||
%}
|
||||
|
||||
// Derived proxy classes
|
||||
%typemap(javabody_derived) TYPENAME %{
|
||||
%typemap(javabody_derived) TYPE %{
|
||||
private long swigCPtr;
|
||||
|
||||
PTRCTOR_VISIBILITY $javaclassname(long cPtr, boolean cMemoryOwn) {
|
||||
|
|
@ -1147,43 +1149,45 @@ SWIGINTERN const char * SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
|
|||
%}
|
||||
%enddef
|
||||
|
||||
/* Set the default for SWIGTYPE: pointer constructor is protected,
|
||||
getCPtr is protected. Season to your own taste! */
|
||||
|
||||
SWIG_JAVABODY_METHODS(public, public, SWIGTYPE)
|
||||
|
||||
%define SWIG_JAVABODY_TYPEWRAPPER(PTRCTOR_VISIBILITY, DEFAULTCTOR_VISIBILITY, CPTR_VISIBILITY, TYPE...)
|
||||
// Typewrapper classes
|
||||
%typemap(javabody) SWIGTYPE *, SWIGTYPE &, SWIGTYPE [] %{
|
||||
%typemap(javabody) TYPE *, TYPE &, TYPE [] %{
|
||||
private long swigCPtr;
|
||||
|
||||
protected $javaclassname(long cPtr, boolean futureUse) {
|
||||
PTRCTOR_VISIBILITY $javaclassname(long cPtr, boolean futureUse) {
|
||||
swigCPtr = cPtr;
|
||||
}
|
||||
|
||||
protected $javaclassname() {
|
||||
DEFAULTCTOR_VISIBILITY $javaclassname() {
|
||||
swigCPtr = 0;
|
||||
}
|
||||
|
||||
protected static long getCPtr($javaclassname obj) {
|
||||
CPTR_VISIBILITY static long getCPtr($javaclassname obj) {
|
||||
return (obj == null) ? 0 : obj.swigCPtr;
|
||||
}
|
||||
%}
|
||||
|
||||
%typemap(javabody) SWIGTYPE (CLASS::*) %{
|
||||
%typemap(javabody) TYPE (CLASS::*) %{
|
||||
private String swigCMemberPtr;
|
||||
|
||||
protected $javaclassname(String cMemberPtr, boolean futureUse) {
|
||||
PTRCTOR_VISIBILITY $javaclassname(String cMemberPtr, boolean futureUse) {
|
||||
swigCMemberPtr = cMemberPtr;
|
||||
}
|
||||
|
||||
protected $javaclassname() {
|
||||
DEFAULTCTOR_VISIBILITY $javaclassname() {
|
||||
swigCMemberPtr = null;
|
||||
}
|
||||
|
||||
protected static String getCMemberPtr($javaclassname obj) {
|
||||
CPTR_VISIBILITY static String getCMemberPtr($javaclassname obj) {
|
||||
return obj.swigCMemberPtr;
|
||||
}
|
||||
%}
|
||||
%enddef
|
||||
|
||||
/* Set the default javabody typemaps to use protected visibility.
|
||||
Use the macros to change to public if using multiple modules. */
|
||||
SWIG_JAVABODY_PROXY(public, public, SWIGTYPE)
|
||||
SWIG_JAVABODY_TYPEWRAPPER(protected, protected, protected, SWIGTYPE)
|
||||
|
||||
%typemap(javafinalize) SWIGTYPE %{
|
||||
protected void finalize() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue