Fix %javaconst(1)/%csconst(1) for static const member variables to use the actual constant value if available
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11758 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
a07092b60c
commit
1dd50f5ea8
4 changed files with 19 additions and 2 deletions
|
|
@ -1,6 +1,17 @@
|
||||||
Version 1.3.41 (in progress)
|
Version 1.3.41 (in progress)
|
||||||
============================
|
============================
|
||||||
|
|
||||||
|
2009-11-26: wsfulton
|
||||||
|
[Java, C#] Fix %javaconst(1)/%csconst(1) for static const member variables to
|
||||||
|
use the actual constant value if it is specified, rather than the C++ code to
|
||||||
|
access the member.
|
||||||
|
|
||||||
|
%javaconst(1) EN;
|
||||||
|
%csconst(1) EN;
|
||||||
|
struct X {
|
||||||
|
static const int EN = 2;
|
||||||
|
};
|
||||||
|
|
||||||
2009-11-23: wsfulton
|
2009-11-23: wsfulton
|
||||||
C++ nested typedef classes can now be handled too, for example:
|
C++ nested typedef classes can now be handled too, for example:
|
||||||
struct Outer {
|
struct Outer {
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,12 @@
|
||||||
|
|
||||||
%module static_const_member
|
%module static_const_member
|
||||||
|
|
||||||
|
#if SWIGJAVA
|
||||||
|
%javaconst(1) EN;
|
||||||
|
#elif SWIGCSHARP
|
||||||
|
%csconst(1) EN;
|
||||||
|
#endif
|
||||||
|
|
||||||
%inline %{
|
%inline %{
|
||||||
|
|
||||||
class X {
|
class X {
|
||||||
|
|
|
||||||
|
|
@ -1394,7 +1394,7 @@ public:
|
||||||
enum_constant_flag = false;
|
enum_constant_flag = false;
|
||||||
} else {
|
} else {
|
||||||
// Alternative constant handling will use the C syntax to make a true C# constant and hope that it compiles as C# code
|
// Alternative constant handling will use the C syntax to make a true C# constant and hope that it compiles as C# code
|
||||||
Printf(constants_code, "%s;\n", Getattr(n, "value"));
|
Printf(constants_code, "%s;\n", Getattr(n, "wrappedasconstant") ? Getattr(n, "staticmembervariableHandler:value") : Getattr(n, "value"));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Emit the generated code to appropriate place
|
// Emit the generated code to appropriate place
|
||||||
|
|
|
||||||
|
|
@ -1426,7 +1426,7 @@ public:
|
||||||
enum_constant_flag = false;
|
enum_constant_flag = false;
|
||||||
} else {
|
} else {
|
||||||
// Alternative constant handling will use the C syntax to make a true Java constant and hope that it compiles as Java code
|
// Alternative constant handling will use the C syntax to make a true Java constant and hope that it compiles as Java code
|
||||||
Printf(constants_code, "%s;\n", Getattr(n, "value"));
|
Printf(constants_code, "%s;\n", Getattr(n, "wrappedasconstant") ? Getattr(n, "staticmembervariableHandler:value") : Getattr(n, "value"));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Emit the generated code to appropriate place
|
// Emit the generated code to appropriate place
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue