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
|
|
@ -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