[D] Ported r12557 (char enum values).

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12630 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
David Nadlinger 2011-04-10 16:10:42 +00:00
commit f9def91f30
3 changed files with 57 additions and 0 deletions

View file

@ -906,6 +906,17 @@ public:
// Note that this is used in enumValue() amongst other places
Setattr(n, "value", tmpValue);
// Deal with enum values that are not int
int swigtype = SwigType_type(Getattr(n, "type"));
if (swigtype == T_BOOL) {
const char *val = Equal(Getattr(n, "enumvalue"), "true") ? "1" : "0";
Setattr(n, "enumvalue", val);
} else if (swigtype == T_CHAR) {
String *val = NewStringf("'%s'", Getattr(n, "enumvalue"));
Setattr(n, "enumvalue", val);
Delete(val);
}
// Emit the enum item.
{
if (!GetFlag(n, "firstenumitem"))