Virtual methods in C# proxy classes now use the appropriate keyword, virtual or override.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@4526 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
6abbf36a8f
commit
8bb8521a46
1 changed files with 41 additions and 39 deletions
|
|
@ -1087,9 +1087,9 @@ class CSHARP : public Language {
|
||||||
derived?javaTypemapLookup("cildisposeoverride", shadow_classname, WARN_NONE):
|
derived?javaTypemapLookup("cildisposeoverride", shadow_classname, WARN_NONE):
|
||||||
javaTypemapLookup("cildispose", shadow_classname, WARN_NONE), // finalize method
|
javaTypemapLookup("cildispose", shadow_classname, WARN_NONE), // finalize method
|
||||||
"\n",
|
"\n",
|
||||||
*Char(destructor_call) ?
|
*Char(destructor_call) ? " protected " : " private ",
|
||||||
" protected void delete() {\n" :
|
derived ? "override" : "virtual",
|
||||||
" private void delete() {\n",
|
" void delete() {\n",
|
||||||
" if(swigCPtr != IntPtr.Zero && swigCMemOwn) {\n",
|
" if(swigCPtr != IntPtr.Zero && swigCMemOwn) {\n",
|
||||||
destructor_call,
|
destructor_call,
|
||||||
"",
|
"",
|
||||||
|
|
@ -1272,7 +1272,7 @@ class CSHARP : public Language {
|
||||||
String *shadowrettype = NewString("");
|
String *shadowrettype = NewString("");
|
||||||
String *user_arrays = NewString("");
|
String *user_arrays = NewString("");
|
||||||
String *propertytype = NewString("");
|
String *propertytype = NewString("");
|
||||||
|
|
||||||
if(!proxy_flag) return;
|
if(!proxy_flag) return;
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1322,16 +1322,16 @@ class CSHARP : public Language {
|
||||||
}
|
}
|
||||||
bool newProperty = Cmp(variable_name, last_property) != 0;
|
bool newProperty = Cmp(variable_name, last_property) != 0;
|
||||||
if (newProperty) {
|
if (newProperty) {
|
||||||
Printf(shadow_code, " %s ", Getattr(n,"feature:java:methodmodifiers"));
|
Printf(shadow_code, " %s ", Getattr(n,"feature:java:methodmodifiers"));
|
||||||
if (static_flag)
|
if (static_flag)
|
||||||
Printf(shadow_code, "static ");
|
Printf(shadow_code, "static ");
|
||||||
Printf(shadow_code, "%s ", get_property_flag?shadowrettype:propertytype);
|
Printf(shadow_code, "%s ", get_property_flag?shadowrettype:propertytype);
|
||||||
Printf(shadow_code, "%s {", variable_name);
|
Printf(shadow_code, "%s {", variable_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
Delete (last_property);
|
Delete (last_property);
|
||||||
last_property = variable_name;
|
last_property = variable_name;
|
||||||
|
|
||||||
/* Start generating the shadow function */
|
/* Start generating the shadow function */
|
||||||
Printf(shadow_code, "\n %s", get_property_flag?"get":"set");
|
Printf(shadow_code, "\n %s", get_property_flag?"get":"set");
|
||||||
|
|
||||||
|
|
@ -1339,54 +1339,54 @@ class CSHARP : public Language {
|
||||||
if (!static_flag)
|
if (!static_flag)
|
||||||
Printv(nativecall, "swigCPtr", NIL);
|
Printv(nativecall, "swigCPtr", NIL);
|
||||||
if (!get_property_flag)
|
if (!get_property_flag)
|
||||||
Printv(nativecall, static_flag?"":", ", "value", NIL);
|
Printv(nativecall, static_flag?"":", ", "value", NIL);
|
||||||
else {
|
else {
|
||||||
int gencomma = !static_flag;
|
int gencomma = !static_flag;
|
||||||
/* Output each parameter */
|
/* Output each parameter */
|
||||||
for (i = 0, p=l; p; i++) {
|
for (i = 0, p=l; p; i++) {
|
||||||
|
|
||||||
/* Ignored parameters */
|
/* Ignored parameters */
|
||||||
if (checkAttribute(p,"tmap:in:numinputs","0")) {
|
if (checkAttribute(p,"tmap:in:numinputs","0")) {
|
||||||
p = Getattr(p,"tmap:in:next");
|
p = Getattr(p,"tmap:in:next");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Ignore the 'this' argument for variable wrappers */
|
/* Ignore the 'this' argument for variable wrappers */
|
||||||
if (!(variable_wrapper_flag && i==0))
|
if (!(variable_wrapper_flag && i==0))
|
||||||
{
|
{
|
||||||
SwigType *pt = Getattr(p,"type");
|
SwigType *pt = Getattr(p,"type");
|
||||||
String *javaparamtype = NewString("");
|
String *javaparamtype = NewString("");
|
||||||
|
|
||||||
/* Get the java type of the parameter */
|
/* Get the java type of the parameter */
|
||||||
if ((tm = Getattr(p,"tmap:jstype"))) {
|
if ((tm = Getattr(p,"tmap:jstype"))) {
|
||||||
substituteJavaclassname(pt, tm);
|
substituteJavaclassname(pt, tm);
|
||||||
Printf(javaparamtype, "%s", tm);
|
Printf(javaparamtype, "%s", tm);
|
||||||
} else {
|
} else {
|
||||||
Swig_warning(WARN_JAVA_TYPEMAP_JSTYPE_UNDEF, input_file, line_number,
|
Swig_warning(WARN_JAVA_TYPEMAP_JSTYPE_UNDEF, input_file, line_number,
|
||||||
"No jstype typemap defined for %s\n", SwigType_str(pt,0));
|
"No jstype typemap defined for %s\n", SwigType_str(pt,0));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gencomma)
|
if (gencomma)
|
||||||
Printf(nativecall, ", ");
|
Printf(nativecall, ", ");
|
||||||
|
|
||||||
String *arg = makeParameterName(n, p, i);
|
String *arg = makeParameterName(n, p, i);
|
||||||
|
|
||||||
// Use typemaps to transform type used in Java wrapper function (in proxy class) to type used in native function (in JNI class)
|
// Use typemaps to transform type used in Java wrapper function (in proxy class) to type used in native function (in JNI class)
|
||||||
if ((tm = Getattr(p,"tmap:javain"))) {
|
if ((tm = Getattr(p,"tmap:javain"))) {
|
||||||
substituteJavaclassname(pt, tm);
|
substituteJavaclassname(pt, tm);
|
||||||
Replaceall(tm, "$javainput", arg);
|
Replaceall(tm, "$javainput", arg);
|
||||||
Printv(nativecall, tm, NIL);
|
Printv(nativecall, tm, NIL);
|
||||||
} else {
|
} else {
|
||||||
Swig_warning(WARN_JAVA_TYPEMAP_JAVAIN_UNDEF, input_file, line_number,
|
Swig_warning(WARN_JAVA_TYPEMAP_JAVAIN_UNDEF, input_file, line_number,
|
||||||
"No javain typemap defined for %s\n", SwigType_str(pt,0));
|
"No javain typemap defined for %s\n", SwigType_str(pt,0));
|
||||||
}
|
}
|
||||||
|
|
||||||
gencomma = 2;
|
gencomma = 2;
|
||||||
Delete(arg);
|
Delete(arg);
|
||||||
Delete(javaparamtype);
|
Delete(javaparamtype);
|
||||||
}
|
}
|
||||||
p = Getattr(p,"tmap:in:next");
|
p = Getattr(p,"tmap:in:next");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Printf(nativecall, ")");
|
Printf(nativecall, ")");
|
||||||
|
|
@ -1402,7 +1402,7 @@ class CSHARP : public Language {
|
||||||
Replaceall(tm, "$jnicall", nativecall);
|
Replaceall(tm, "$jnicall", nativecall);
|
||||||
Printf(shadow_code, " %s", tm);
|
Printf(shadow_code, " %s", tm);
|
||||||
if (get_property_flag) { //TODO: this is not the right way to do this
|
if (get_property_flag) { //TODO: this is not the right way to do this
|
||||||
Printf(shadow_code, "\n }\n\n");
|
Printf(shadow_code, "\n }\n\n");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Swig_warning(WARN_JAVA_TYPEMAP_JAVAOUT_UNDEF, input_file, line_number,
|
Swig_warning(WARN_JAVA_TYPEMAP_JAVAOUT_UNDEF, input_file, line_number,
|
||||||
|
|
@ -1463,9 +1463,11 @@ class CSHARP : public Language {
|
||||||
Printf(shadow_code, " %s ", Getattr(n,"feature:java:methodmodifiers"));
|
Printf(shadow_code, " %s ", Getattr(n,"feature:java:methodmodifiers"));
|
||||||
if (static_flag)
|
if (static_flag)
|
||||||
Printf(shadow_code, "static ");
|
Printf(shadow_code, "static ");
|
||||||
else
|
if (Getattr(n,"virtual:derived"))
|
||||||
Printf(shadow_code, "virtual ");
|
Printf(shadow_code, "override ");
|
||||||
//make all methods virtual unless they are static - you might want to change this..
|
else if (checkAttribute(n, "storage", "virtual"))
|
||||||
|
Printf(shadow_code, "virtual ");
|
||||||
|
|
||||||
Printf(shadow_code, "%s %s(", shadowrettype, java_shadow_function_name);
|
Printf(shadow_code, "%s %s(", shadowrettype, java_shadow_function_name);
|
||||||
|
|
||||||
Printv(nativecall, jniclass_name, ".", java_function_name, "(", NIL);
|
Printv(nativecall, jniclass_name, ".", java_function_name, "(", NIL);
|
||||||
|
|
@ -1623,7 +1625,7 @@ class CSHARP : public Language {
|
||||||
p = Getattr(p,"tmap:in:next");
|
p = Getattr(p,"tmap:in:next");
|
||||||
}
|
}
|
||||||
|
|
||||||
Printf(nativecall, "), true)\n");
|
Printf(nativecall, "), true)");
|
||||||
|
|
||||||
Printf(shadow_code, ")");
|
Printf(shadow_code, ")");
|
||||||
Printf(shadow_code,"%s", nativecall);
|
Printf(shadow_code,"%s", nativecall);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue