New typemaps csinterfaces_base and csinterfaces_derived replace
the javainterfaces typemap. Also fixes the peculiarity of all classes in an inheritance chain individually deriving from the IDisposable interface. git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@4884 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
965af85915
commit
6b4726769b
2 changed files with 11 additions and 10 deletions
|
|
@ -425,7 +425,8 @@ $1 = &temp; %}
|
||||||
%typemap(javaclassmodifiers) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE [], SWIGTYPE (CLASS::*) "public"
|
%typemap(javaclassmodifiers) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE [], SWIGTYPE (CLASS::*) "public"
|
||||||
%typemap(javacode) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE [], SWIGTYPE (CLASS::*) ""
|
%typemap(javacode) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE [], SWIGTYPE (CLASS::*) ""
|
||||||
%typemap(javaimports) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE [], SWIGTYPE (CLASS::*) "using System;"
|
%typemap(javaimports) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE [], SWIGTYPE (CLASS::*) "using System;"
|
||||||
%typemap(javainterfaces) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE [], SWIGTYPE (CLASS::*) ""
|
%typemap(csinterfaces_base) SWIGTYPE "IDisposable"
|
||||||
|
%typemap(csinterfaces_derived) SWIGTYPE *, SWIGTYPE &, SWIGTYPE [], SWIGTYPE (CLASS::*) ""
|
||||||
%typemap(javaptrconstructormodifiers) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE [], SWIGTYPE (CLASS::*) "internal"
|
%typemap(javaptrconstructormodifiers) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE [], SWIGTYPE (CLASS::*) "internal"
|
||||||
|
|
||||||
%typemap(csfinalize) SWIGTYPE %{
|
%typemap(csfinalize) SWIGTYPE %{
|
||||||
|
|
|
||||||
|
|
@ -1047,23 +1047,23 @@ class CSHARP : public Language {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Pure Java interfaces
|
// Pure Java interfaces
|
||||||
const String *pure_java_interfaces = javaTypemapLookup("javainterfaces", classDeclarationName, WARN_NONE);
|
const String *pure_java_interfaces = javaTypemapLookup(derived ? "csinterfaces_derived" : "csinterfaces_base", classDeclarationName, WARN_NONE);
|
||||||
|
|
||||||
// Start writing the shadow class
|
// Start writing the shadow class
|
||||||
Printv(shadow_classdef,
|
Printv(shadow_classdef,
|
||||||
javaTypemapLookup("javaimports", classDeclarationName, WARN_NONE), // Import statements
|
javaTypemapLookup("javaimports", classDeclarationName, WARN_NONE), // Import statements
|
||||||
"\n",
|
"\n",
|
||||||
javaTypemapLookup("javaclassmodifiers", classDeclarationName, WARN_JAVA_TYPEMAP_CLASSMOD_UNDEF), // Class modifiers
|
javaTypemapLookup("javaclassmodifiers", classDeclarationName, WARN_JAVA_TYPEMAP_CLASSMOD_UNDEF), // Class modifiers
|
||||||
" class $javaclassname : ", // Class name and bases
|
" class $javaclassname", // Class name and bases
|
||||||
|
(derived || *Char(pure_java_baseclass) || *Char(pure_java_interfaces)) ?
|
||||||
|
" : " :
|
||||||
|
"",
|
||||||
baseclass,
|
baseclass,
|
||||||
pure_java_baseclass,
|
pure_java_baseclass,
|
||||||
(derived || *Char(pure_java_baseclass)) ?
|
((derived || *Char(pure_java_baseclass)) && *Char(pure_java_interfaces)) ? // Pure Java interfaces
|
||||||
", " :
|
", " :
|
||||||
"",
|
"",
|
||||||
pure_java_interfaces,
|
pure_java_interfaces,
|
||||||
*Char(pure_java_interfaces) ? // Pure Java interfaces
|
|
||||||
", IDisposable" :
|
|
||||||
"IDisposable",
|
|
||||||
" {\n",
|
" {\n",
|
||||||
" private IntPtr swigCPtr;\n", // Member variables for memory handling
|
" private IntPtr swigCPtr;\n", // Member variables for memory handling
|
||||||
derived ?
|
derived ?
|
||||||
|
|
@ -1088,7 +1088,7 @@ class CSHARP : public Language {
|
||||||
NIL);
|
NIL);
|
||||||
}
|
}
|
||||||
|
|
||||||
// C++ destructor is wrapped by the delete method
|
// C++ destructor is wrapped by the Dispose method
|
||||||
String *destruct = NewString("");
|
String *destruct = NewString("");
|
||||||
const String *tm = NULL;
|
const String *tm = NULL;
|
||||||
if (derived)
|
if (derived)
|
||||||
|
|
@ -1096,7 +1096,7 @@ class CSHARP : public Language {
|
||||||
else
|
else
|
||||||
tm = javaTypemapLookup("csdestruct_base", classDeclarationName, WARN_NONE);
|
tm = javaTypemapLookup("csdestruct_base", classDeclarationName, WARN_NONE);
|
||||||
|
|
||||||
// Emit the finalize and delete methods
|
// Emit the finalize and Dispose methods
|
||||||
if (*Char(destructor_call) && tm) {
|
if (*Char(destructor_call) && tm) {
|
||||||
Printv(destruct, tm, NIL);
|
Printv(destruct, tm, NIL);
|
||||||
Replaceall(destruct, "$jnicall", destructor_call);
|
Replaceall(destruct, "$jnicall", destructor_call);
|
||||||
|
|
@ -1105,7 +1105,7 @@ class CSHARP : public Language {
|
||||||
javaTypemapLookup("csfinalize", classDeclarationName, WARN_NONE),
|
javaTypemapLookup("csfinalize", classDeclarationName, WARN_NONE),
|
||||||
"\n",
|
"\n",
|
||||||
NIL);
|
NIL);
|
||||||
// delete method
|
// Dispose method
|
||||||
if (*Char(destruct)) {
|
if (*Char(destruct)) {
|
||||||
Printv(shadow_classdef, " public ", derived ? "override" : "virtual", " void Dispose() ", destruct, "\n", NIL);
|
Printv(shadow_classdef, " public ", derived ? "override" : "virtual", " void Dispose() ", destruct, "\n", NIL);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue