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
|
|
@ -1,7 +1,16 @@
|
|||
// Users can provide their own SWIG_INTRUSIVE_PTR_TYPEMAPS or SWIG_INTRUSIVE_PTR_TYPEMAPS_NO_WRAP macros before including this file to change the
|
||||
// visibility of the constructor and getCPtr method if desired to public if using multiple modules.
|
||||
#ifndef SWIG_INTRUSIVE_PTR_TYPEMAPS
|
||||
#define SWIG_INTRUSIVE_PTR_TYPEMAPS(CONST, TYPE...) SWIG_INTRUSIVE_PTR_TYPEMAPS_IMPLEMENTATION(internal, internal, CONST, TYPE)
|
||||
#endif
|
||||
#ifndef SWIG_INTRUSIVE_PTR_TYPEMAPS_NO_WRAP
|
||||
#define SWIG_INTRUSIVE_PTR_TYPEMAPS_NO_WRAP(CONST, TYPE...) SWIG_INTRUSIVE_PTR_TYPEMAPS_NO_WRAP_IMPLEMENTATION(internal, internal, CONST, TYPE)
|
||||
#endif
|
||||
|
||||
%include <intrusive_ptr.i>
|
||||
|
||||
// Language specific macro implementing all the customisations for handling the smart pointer
|
||||
%define SWIG_INTRUSIVE_PTR_TYPEMAPS(CONST, TYPE...)
|
||||
%define SWIG_INTRUSIVE_PTR_TYPEMAPS_IMPLEMENTATION(PTRCTOR_VISIBILITY, CPTR_VISIBILITY, CONST, TYPE...)
|
||||
|
||||
// %naturalvar is as documented for member variables
|
||||
%naturalvar TYPE;
|
||||
|
|
@ -280,12 +289,12 @@
|
|||
private HandleRef swigCPtr;
|
||||
private bool swigCMemOwnBase;
|
||||
|
||||
public $csclassname(IntPtr cPtr, bool cMemoryOwn) {
|
||||
PTRCTOR_VISIBILITY $csclassname(IntPtr cPtr, bool cMemoryOwn) {
|
||||
swigCMemOwnBase = cMemoryOwn;
|
||||
swigCPtr = new HandleRef(this, cPtr);
|
||||
}
|
||||
|
||||
internal static HandleRef getCPtr($csclassname obj) {
|
||||
CPTR_VISIBILITY static HandleRef getCPtr($csclassname obj) {
|
||||
return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
|
||||
}
|
||||
%}
|
||||
|
|
@ -295,14 +304,12 @@
|
|||
private HandleRef swigCPtr;
|
||||
private bool swigCMemOwnDerived;
|
||||
|
||||
public $csclassname(IntPtr cPtr, bool cMemoryOwn)
|
||||
: base($imclassname.$csclazznameSWIGSmartPtrUpcast(cPtr), true) {
|
||||
|
||||
PTRCTOR_VISIBILITY $csclassname(IntPtr cPtr, bool cMemoryOwn) : base($imclassname.$csclazznameSWIGSmartPtrUpcast(cPtr), true) {
|
||||
swigCMemOwnDerived = cMemoryOwn;
|
||||
swigCPtr = new HandleRef(this, cPtr);
|
||||
}
|
||||
|
||||
internal static HandleRef getCPtr($csclassname obj) {
|
||||
CPTR_VISIBILITY static HandleRef getCPtr($csclassname obj) {
|
||||
return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
|
||||
}
|
||||
%}
|
||||
|
|
@ -349,7 +356,7 @@
|
|||
|
||||
%include <shared_ptr.i>
|
||||
|
||||
%define SWIG_INTRUSIVE_PTR_TYPEMAPS_NO_WRAP(CONST, TYPE...)
|
||||
%define SWIG_INTRUSIVE_PTR_TYPEMAPS_NO_WRAP_IMPLEMENTATION(PTRCTOR_VISIBILITY, CPTR_VISIBILITY, CONST, TYPE...)
|
||||
|
||||
%naturalvar TYPE;
|
||||
%naturalvar SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >;
|
||||
|
|
@ -441,12 +448,12 @@
|
|||
private HandleRef swigCPtr;
|
||||
private bool swigCMemOwnBase;
|
||||
|
||||
public $csclassname(IntPtr cPtr, bool cMemoryOwn) {
|
||||
PTRCTOR_VISIBILITY $csclassname(IntPtr cPtr, bool cMemoryOwn) {
|
||||
swigCMemOwnBase = cMemoryOwn;
|
||||
swigCPtr = new HandleRef(this, cPtr);
|
||||
}
|
||||
|
||||
internal static HandleRef getCPtr($csclassname obj) {
|
||||
CPTR_VISIBILITY static HandleRef getCPtr($csclassname obj) {
|
||||
return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
|
||||
}
|
||||
%}
|
||||
|
|
@ -456,14 +463,12 @@
|
|||
private HandleRef swigCPtr;
|
||||
private bool swigCMemOwnDerived;
|
||||
|
||||
public $csclassname(IntPtr cPtr, bool cMemoryOwn)
|
||||
: base($imclassname.$csclazznameSWIGSmartPtrUpcast(cPtr), true) {
|
||||
|
||||
PTRCTOR_VISIBILITY $csclassname(IntPtr cPtr, bool cMemoryOwn) : base($imclassname.$csclazznameSWIGSmartPtrUpcast(cPtr), true) {
|
||||
swigCMemOwnDerived = cMemoryOwn;
|
||||
swigCPtr = new HandleRef(this, cPtr);
|
||||
}
|
||||
|
||||
internal static HandleRef getCPtr($csclassname obj) {
|
||||
CPTR_VISIBILITY static HandleRef getCPtr($csclassname obj) {
|
||||
return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
|
||||
}
|
||||
%}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,13 @@
|
|||
// Users can provide their own SWIG_SHARED_PTR_TYPEMAPS macro before including this file to change the
|
||||
// visibility of the constructor and getCPtr method if desired to public if using multiple modules.
|
||||
#ifndef SWIG_SHARED_PTR_TYPEMAPS
|
||||
#define SWIG_SHARED_PTR_TYPEMAPS(CONST, TYPE...) SWIG_SHARED_PTR_TYPEMAPS_IMPLEMENTATION(internal, internal, CONST, TYPE)
|
||||
#endif
|
||||
|
||||
%include <shared_ptr.i>
|
||||
|
||||
// Language specific macro implementing all the customisations for handling the smart pointer
|
||||
%define SWIG_SHARED_PTR_TYPEMAPS(CONST, TYPE...)
|
||||
%define SWIG_SHARED_PTR_TYPEMAPS_IMPLEMENTATION(PTRCTOR_VISIBILITY, CPTR_VISIBILITY, CONST, TYPE...)
|
||||
|
||||
// %naturalvar is as documented for member variables
|
||||
%naturalvar TYPE;
|
||||
|
|
@ -175,12 +181,12 @@
|
|||
private HandleRef swigCPtr;
|
||||
private bool swigCMemOwnBase;
|
||||
|
||||
internal $csclassname(IntPtr cPtr, bool cMemoryOwn) {
|
||||
PTRCTOR_VISIBILITY $csclassname(IntPtr cPtr, bool cMemoryOwn) {
|
||||
swigCMemOwnBase = cMemoryOwn;
|
||||
swigCPtr = new HandleRef(this, cPtr);
|
||||
}
|
||||
|
||||
internal static HandleRef getCPtr($csclassname obj) {
|
||||
CPTR_VISIBILITY static HandleRef getCPtr($csclassname obj) {
|
||||
return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
|
||||
}
|
||||
%}
|
||||
|
|
@ -190,12 +196,12 @@
|
|||
private HandleRef swigCPtr;
|
||||
private bool swigCMemOwnDerived;
|
||||
|
||||
internal $csclassname(IntPtr cPtr, bool cMemoryOwn) : base($imclassname.$csclazznameSWIGSmartPtrUpcast(cPtr), true) {
|
||||
PTRCTOR_VISIBILITY $csclassname(IntPtr cPtr, bool cMemoryOwn) : base($imclassname.$csclazznameSWIGSmartPtrUpcast(cPtr), true) {
|
||||
swigCMemOwnDerived = cMemoryOwn;
|
||||
swigCPtr = new HandleRef(this, cPtr);
|
||||
}
|
||||
|
||||
internal static HandleRef getCPtr($csclassname obj) {
|
||||
CPTR_VISIBILITY static HandleRef getCPtr($csclassname obj) {
|
||||
return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
|
||||
}
|
||||
%}
|
||||
|
|
|
|||
|
|
@ -820,66 +820,78 @@ SWIGINTERN const char * SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
|
|||
%typemap(csinterfaces) SWIGTYPE *, SWIGTYPE &, SWIGTYPE [], SWIGTYPE (CLASS::*) ""
|
||||
%typemap(csinterfaces_derived) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE [], SWIGTYPE (CLASS::*) ""
|
||||
|
||||
|
||||
// csbody typemaps... these are in macros so that the visibility of the methods can be easily changed by users.
|
||||
|
||||
%define SWIG_CSBODY_PROXY(PTRCTOR_VISIBILITY, CPTR_VISIBILITY, TYPE...)
|
||||
// Proxy classes (base classes, ie, not derived classes)
|
||||
%typemap(csbody) SWIGTYPE %{
|
||||
%typemap(csbody) TYPE %{
|
||||
private HandleRef swigCPtr;
|
||||
protected bool swigCMemOwn;
|
||||
|
||||
internal $csclassname(IntPtr cPtr, bool cMemoryOwn) {
|
||||
PTRCTOR_VISIBILITY $csclassname(IntPtr cPtr, bool cMemoryOwn) {
|
||||
swigCMemOwn = cMemoryOwn;
|
||||
swigCPtr = new HandleRef(this, cPtr);
|
||||
}
|
||||
|
||||
internal static HandleRef getCPtr($csclassname obj) {
|
||||
CPTR_VISIBILITY static HandleRef getCPtr($csclassname obj) {
|
||||
return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
|
||||
}
|
||||
%}
|
||||
|
||||
// Derived proxy classes
|
||||
%typemap(csbody_derived) SWIGTYPE %{
|
||||
%typemap(csbody_derived) TYPE %{
|
||||
private HandleRef swigCPtr;
|
||||
|
||||
internal $csclassname(IntPtr cPtr, bool cMemoryOwn) : base($imclassname.$csclazznameSWIGUpcast(cPtr), cMemoryOwn) {
|
||||
PTRCTOR_VISIBILITY $csclassname(IntPtr cPtr, bool cMemoryOwn) : base($imclassname.$csclazznameSWIGUpcast(cPtr), cMemoryOwn) {
|
||||
swigCPtr = new HandleRef(this, cPtr);
|
||||
}
|
||||
|
||||
internal static HandleRef getCPtr($csclassname obj) {
|
||||
CPTR_VISIBILITY static HandleRef getCPtr($csclassname obj) {
|
||||
return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
|
||||
}
|
||||
%}
|
||||
%enddef
|
||||
|
||||
%define SWIG_CSBODY_TYPEWRAPPER(PTRCTOR_VISIBILITY, DEFAULTCTOR_VISIBILITY, CPTR_VISIBILITY, TYPE...)
|
||||
// Typewrapper classes
|
||||
%typemap(csbody) SWIGTYPE *, SWIGTYPE &, SWIGTYPE [] %{
|
||||
%typemap(csbody) TYPE *, TYPE &, TYPE [] %{
|
||||
private HandleRef swigCPtr;
|
||||
|
||||
internal $csclassname(IntPtr cPtr, bool futureUse) {
|
||||
PTRCTOR_VISIBILITY $csclassname(IntPtr cPtr, bool futureUse) {
|
||||
swigCPtr = new HandleRef(this, cPtr);
|
||||
}
|
||||
|
||||
protected $csclassname() {
|
||||
DEFAULTCTOR_VISIBILITY $csclassname() {
|
||||
swigCPtr = new HandleRef(null, IntPtr.Zero);
|
||||
}
|
||||
|
||||
internal static HandleRef getCPtr($csclassname obj) {
|
||||
CPTR_VISIBILITY static HandleRef getCPtr($csclassname obj) {
|
||||
return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
|
||||
}
|
||||
%}
|
||||
|
||||
%typemap(csbody) SWIGTYPE (CLASS::*) %{
|
||||
%typemap(csbody) TYPE (CLASS::*) %{
|
||||
private string swigCMemberPtr;
|
||||
|
||||
internal $csclassname(string cMemberPtr, bool futureUse) {
|
||||
PTRCTOR_VISIBILITY $csclassname(string cMemberPtr, bool futureUse) {
|
||||
swigCMemberPtr = cMemberPtr;
|
||||
}
|
||||
|
||||
protected $csclassname() {
|
||||
DEFAULTCTOR_VISIBILITY $csclassname() {
|
||||
swigCMemberPtr = null;
|
||||
}
|
||||
|
||||
internal static string getCMemberPtr($csclassname obj) {
|
||||
CPTR_VISIBILITY static string getCMemberPtr($csclassname obj) {
|
||||
return obj.swigCMemberPtr;
|
||||
}
|
||||
%}
|
||||
%enddef
|
||||
|
||||
/* Set the default csbody typemaps to use internal visibility.
|
||||
Use the macros to change to public if using multiple modules. */
|
||||
SWIG_CSBODY_PROXY(internal, internal, SWIGTYPE)
|
||||
SWIG_CSBODY_TYPEWRAPPER(internal, protected, internal, SWIGTYPE)
|
||||
|
||||
%typemap(csfinalize) SWIGTYPE %{
|
||||
~$csclassname() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue