Fix strongly typed enums for Java when using simple enum wrappers

This commit is contained in:
William S Fulton 2014-11-22 15:59:44 +00:00
parent fcef37d682
commit 0664ecdeb7
3 changed files with 18 additions and 2 deletions

View File

@ -0,0 +1,5 @@
%module cpp11_strongly_typed_enumerations_simple
%include <enumsimple.swg>
%include "cpp11_strongly_typed_enumerations.i"

View File

@ -40,6 +40,9 @@ CPP_TEST_CASES = \
java_typemaps_typewrapper
# li_boost_intrusive_ptr
CPP11_TEST_CASES = \
cpp11_strongly_typed_enumerations_simple \
include $(srcdir)/../common.mk
# Overridden variables here

View File

@ -1368,6 +1368,7 @@ public:
int unnamedinstance = GetFlag(parent, "unnamedinstance");
String *parent_name = Getattr(parent, "name");
String *nspace = getNSpace();
String *newsymname = 0;
String *tmpValue;
// Strange hack from parent method
@ -1392,14 +1393,20 @@ public:
{
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
String *scope = 0;
if (unnamedinstance || !parent_name || enum_feature == SimpleEnum) {
if (proxy_class_name) {
String *enumClassPrefix = getEnumClassPrefix();
if (enumClassPrefix) {
scope = NewString("");
if (nspace)
Printf(scope, "%s.", nspace);
Printf(scope, "%s", proxy_class_name);
Printf(scope, "%s", enumClassPrefix);
} else {
scope = Copy(constants_interface_name);
}
@ -1464,6 +1471,7 @@ public:
Delete(scope);
}
Delete(newsymname);
Delete(tmpValue);
Swig_restore(n);
return SWIG_OK;