Fix strongly typed enums for Java when using simple enum wrappers
This commit is contained in:
parent
fcef37d682
commit
0664ecdeb7
3 changed files with 18 additions and 2 deletions
|
|
@ -0,0 +1,5 @@
|
||||||
|
%module cpp11_strongly_typed_enumerations_simple
|
||||||
|
|
||||||
|
%include <enumsimple.swg>
|
||||||
|
|
||||||
|
%include "cpp11_strongly_typed_enumerations.i"
|
||||||
|
|
@ -40,6 +40,9 @@ CPP_TEST_CASES = \
|
||||||
java_typemaps_typewrapper
|
java_typemaps_typewrapper
|
||||||
# li_boost_intrusive_ptr
|
# li_boost_intrusive_ptr
|
||||||
|
|
||||||
|
CPP11_TEST_CASES = \
|
||||||
|
cpp11_strongly_typed_enumerations_simple \
|
||||||
|
|
||||||
include $(srcdir)/../common.mk
|
include $(srcdir)/../common.mk
|
||||||
|
|
||||||
# Overridden variables here
|
# Overridden variables here
|
||||||
|
|
|
||||||
|
|
@ -1368,6 +1368,7 @@ public:
|
||||||
int unnamedinstance = GetFlag(parent, "unnamedinstance");
|
int unnamedinstance = GetFlag(parent, "unnamedinstance");
|
||||||
String *parent_name = Getattr(parent, "name");
|
String *parent_name = Getattr(parent, "name");
|
||||||
String *nspace = getNSpace();
|
String *nspace = getNSpace();
|
||||||
|
String *newsymname = 0;
|
||||||
String *tmpValue;
|
String *tmpValue;
|
||||||
|
|
||||||
// Strange hack from parent method
|
// Strange hack from parent method
|
||||||
|
|
@ -1392,14 +1393,20 @@ public:
|
||||||
{
|
{
|
||||||
EnumFeature enum_feature = decodeEnumFeature(parent);
|
EnumFeature enum_feature = decodeEnumFeature(parent);
|
||||||
|
|
||||||
|
if ((enum_feature == SimpleEnum) && GetFlag(parent, "scopedenum")) {
|
||||||
|
newsymname = Swig_name_member(0, Getattr(parent, "sym:name"), symname);
|
||||||
|
symname = newsymname;
|
||||||
|
}
|
||||||
|
|
||||||
// Add to language symbol table
|
// Add to language symbol table
|
||||||
String *scope = 0;
|
String *scope = 0;
|
||||||
if (unnamedinstance || !parent_name || enum_feature == SimpleEnum) {
|
if (unnamedinstance || !parent_name || enum_feature == SimpleEnum) {
|
||||||
if (proxy_class_name) {
|
String *enumClassPrefix = getEnumClassPrefix();
|
||||||
|
if (enumClassPrefix) {
|
||||||
scope = NewString("");
|
scope = NewString("");
|
||||||
if (nspace)
|
if (nspace)
|
||||||
Printf(scope, "%s.", nspace);
|
Printf(scope, "%s.", nspace);
|
||||||
Printf(scope, "%s", proxy_class_name);
|
Printf(scope, "%s", enumClassPrefix);
|
||||||
} else {
|
} else {
|
||||||
scope = Copy(constants_interface_name);
|
scope = Copy(constants_interface_name);
|
||||||
}
|
}
|
||||||
|
|
@ -1464,6 +1471,7 @@ public:
|
||||||
Delete(scope);
|
Delete(scope);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Delete(newsymname);
|
||||||
Delete(tmpValue);
|
Delete(tmpValue);
|
||||||
Swig_restore(n);
|
Swig_restore(n);
|
||||||
return SWIG_OK;
|
return SWIG_OK;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue