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:
William S Fulton 2003-06-10 23:09:47 +00:00
commit 6b4726769b
2 changed files with 11 additions and 10 deletions

View file

@ -1047,23 +1047,23 @@ class CSHARP : public Language {
}
// 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
Printv(shadow_classdef,
javaTypemapLookup("javaimports", classDeclarationName, WARN_NONE), // Import statements
"\n",
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,
pure_java_baseclass,
(derived || *Char(pure_java_baseclass)) ?
((derived || *Char(pure_java_baseclass)) && *Char(pure_java_interfaces)) ? // Pure Java interfaces
", " :
"",
pure_java_interfaces,
*Char(pure_java_interfaces) ? // Pure Java interfaces
", IDisposable" :
"IDisposable",
" {\n",
" private IntPtr swigCPtr;\n", // Member variables for memory handling
derived ?
@ -1088,7 +1088,7 @@ class CSHARP : public Language {
NIL);
}
// C++ destructor is wrapped by the delete method
// C++ destructor is wrapped by the Dispose method
String *destruct = NewString("");
const String *tm = NULL;
if (derived)
@ -1096,7 +1096,7 @@ class CSHARP : public Language {
else
tm = javaTypemapLookup("csdestruct_base", classDeclarationName, WARN_NONE);
// Emit the finalize and delete methods
// Emit the finalize and Dispose methods
if (*Char(destructor_call) && tm) {
Printv(destruct, tm, NIL);
Replaceall(destruct, "$jnicall", destructor_call);
@ -1105,7 +1105,7 @@ class CSHARP : public Language {
javaTypemapLookup("csfinalize", classDeclarationName, WARN_NONE),
"\n",
NIL);
// delete method
// Dispose method
if (*Char(destruct)) {
Printv(shadow_classdef, " public ", derived ? "override" : "virtual", " void Dispose() ", destruct, "\n", NIL);
}