Fix wrapping of C++ enum boolean values when using %javaconst(1)
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12029 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
8a169eb0cb
commit
76bbd7373d
2 changed files with 13 additions and 0 deletions
|
|
@ -58,3 +58,9 @@ static const int FOUR = 4;
|
||||||
%inline %{
|
%inline %{
|
||||||
enum Numero { Quattro = FOUR };
|
enum Numero { Quattro = FOUR };
|
||||||
%}
|
%}
|
||||||
|
|
||||||
|
// Test boolean enums
|
||||||
|
%inline %{
|
||||||
|
typedef enum { PLAY = true, STOP = false } play_state;
|
||||||
|
%}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1352,6 +1352,13 @@ public:
|
||||||
// Note that this is used in enumValue() amongst other places
|
// Note that this is used in enumValue() amongst other places
|
||||||
Setattr(n, "value", tmpValue);
|
Setattr(n, "value", tmpValue);
|
||||||
|
|
||||||
|
// Deal with enum values that are bools
|
||||||
|
if (SwigType_type(Getattr(n, "type")) == T_BOOL) {
|
||||||
|
String *boolValue = NewStringf("%s ? 1 : 0", Getattr(n, "enumvalue"));
|
||||||
|
Setattr(n, "enumvalue", boolValue);
|
||||||
|
Delete(boolValue);
|
||||||
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
EnumFeature enum_feature = decodeEnumFeature(parent);
|
EnumFeature enum_feature = decodeEnumFeature(parent);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue