nspace fixes and adding in missing symbols in language symbol tables for Java and C#
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11937 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
7af8eb954b
commit
7ed1528349
6 changed files with 174 additions and 55 deletions
|
|
@ -22,16 +22,26 @@ public class runme
|
|||
if (channel != nspaceNamespace.Outer.Inner1.Color.Channel.Transmission)
|
||||
throw new ApplicationException("Transmission wrong");
|
||||
|
||||
// static member variables
|
||||
nspaceNamespace.Outer.Inner1.Color.staticMemberVariable = 789;
|
||||
if (nspaceNamespace.Outer.Inner1.Color.staticMemberVariable != 789)
|
||||
throw new ApplicationException("static member variable failed");
|
||||
// class anonymous enums
|
||||
int val1 = nspaceNamespace.Outer.Inner1.Color.ColorEnumVal1;
|
||||
int val2 = nspaceNamespace.Outer.Inner1.Color.ColorEnumVal2;
|
||||
if (val1 != 0 || val2 != 0x22)
|
||||
throw new ApplicationException("ColorEnumVal wrong");
|
||||
|
||||
// instance member variables
|
||||
color.instanceMemberVariable = 123;
|
||||
if (color.instanceMemberVariable != 123)
|
||||
throw new ApplicationException("instance member variable failed");
|
||||
|
||||
// static member variables
|
||||
nspaceNamespace.Outer.Inner1.Color.staticMemberVariable = 789;
|
||||
if (nspaceNamespace.Outer.Inner1.Color.staticMemberVariable != 789)
|
||||
throw new ApplicationException("static member variable failed");
|
||||
if (nspaceNamespace.Outer.Inner1.Color.staticConstMemberVariable != 222)
|
||||
throw new ApplicationException("static const member variable failed");
|
||||
if (nspaceNamespace.Outer.Inner1.Color.staticConstEnumMemberVariable != nspaceNamespace.Outer.Inner1.Color.Channel.Transmission)
|
||||
throw new ApplicationException("static const enum member variable failed");
|
||||
|
||||
// check globals in a namespace don't get mangled with the nspaceNamespace option
|
||||
nspaceNamespace.nspace.namespaceFunction(color);
|
||||
nspaceNamespace.nspace.namespaceVar = 111;
|
||||
|
|
|
|||
|
|
@ -28,16 +28,26 @@ public class nspace_runme {
|
|||
if (channel != nspacePackage.Outer.Inner1.Color.Channel.Transmission)
|
||||
throw new RuntimeException("Transmission wrong");
|
||||
|
||||
// static member variables
|
||||
nspacePackage.Outer.Inner1.Color.setStaticMemberVariable(789);
|
||||
if (nspacePackage.Outer.Inner1.Color.getStaticMemberVariable() != 789)
|
||||
throw new RuntimeException("static member variable failed");
|
||||
// class anonymous enums
|
||||
int val1 = nspacePackage.Outer.Inner1.Color.ColorEnumVal1;
|
||||
int val2 = nspacePackage.Outer.Inner1.Color.ColorEnumVal2;
|
||||
if (val1 != 0 || val2 != 0x22)
|
||||
throw new RuntimeException("ColorEnumVal wrong");
|
||||
|
||||
// instance member variables
|
||||
color.setInstanceMemberVariable(123);
|
||||
if (color.getInstanceMemberVariable() != 123)
|
||||
throw new RuntimeException("instance member variable failed");
|
||||
|
||||
// static member variables
|
||||
nspacePackage.Outer.Inner1.Color.setStaticMemberVariable(789);
|
||||
if (nspacePackage.Outer.Inner1.Color.getStaticMemberVariable() != 789)
|
||||
throw new RuntimeException("static member variable failed");
|
||||
if (nspacePackage.Outer.Inner1.Color.staticConstMemberVariable != 222)
|
||||
throw new RuntimeException("static const member variable failed");
|
||||
if (nspacePackage.Outer.Inner1.Color.staticConstEnumMemberVariable != nspacePackage.Outer.Inner1.Color.Channel.Transmission)
|
||||
throw new RuntimeException("static const enum member variable failed");
|
||||
|
||||
// Same class different namespaces
|
||||
nspacePackage.Outer.Inner1.Color col1 = new nspacePackage.Outer.Inner1.Color();
|
||||
nspacePackage.Outer.Inner2.Color col2 = nspacePackage.Outer.Inner2.Color.create();
|
||||
|
|
|
|||
|
|
@ -10,29 +10,27 @@
|
|||
%copyctor;
|
||||
%ignore Outer::Inner2::Color::Color();
|
||||
|
||||
#define CONSTANT100 100
|
||||
|
||||
%inline %{
|
||||
|
||||
namespace Outer {
|
||||
class nspace {
|
||||
};
|
||||
namespace Inner1 {
|
||||
enum Channel {
|
||||
Diffuse,
|
||||
Specular = 0x10,
|
||||
Transmission1
|
||||
};
|
||||
enum Channel { Diffuse, Specular = 0x10, Transmission1 };
|
||||
enum { ColorEnumVal1, ColorEnumVal2 = 0x11, ColorEnumVal3 };
|
||||
|
||||
struct Color {
|
||||
static Color* create() { return new Color(); }
|
||||
|
||||
enum Channel {
|
||||
Diffuse,
|
||||
Specular = 0x20,
|
||||
Transmission
|
||||
};
|
||||
enum Channel { Diffuse, Specular = 0x20, Transmission };
|
||||
enum { ColorEnumVal1, ColorEnumVal2 = 0x22, ColorEnumVal3 };
|
||||
|
||||
int instanceMemberVariable;
|
||||
static int staticMemberVariable;
|
||||
static const int staticConstMemberVariable = 222;
|
||||
static const Channel staticConstEnumMemberVariable = Transmission;
|
||||
void colorInstanceMethod(double d) {}
|
||||
static void colorStaticMethod(double d) {}
|
||||
}; // Color
|
||||
|
|
@ -43,24 +41,19 @@ namespace Outer {
|
|||
} // Inner1
|
||||
|
||||
namespace Inner2 {
|
||||
enum Channel {
|
||||
Diffuse,
|
||||
Specular /* = 0x30*/,
|
||||
Transmission2
|
||||
};
|
||||
enum Channel { Diffuse, Specular = 0x30, Transmission2 };
|
||||
|
||||
struct Color {
|
||||
Color() : instanceMemberVariable(0) {}
|
||||
static Color* create() { return new Color(); }
|
||||
|
||||
enum Channel {
|
||||
Diffuse,
|
||||
Specular/* = 0x40*/,
|
||||
Transmission
|
||||
};
|
||||
enum Channel { Diffuse, Specular = 0x40, Transmission };
|
||||
enum { ColorEnumVal1, ColorEnumVal2 = 0x33, ColorEnumVal3 };
|
||||
|
||||
int instanceMemberVariable;
|
||||
static int staticMemberVariable;
|
||||
static const int staticConstMemberVariable = 333;
|
||||
static const Channel staticConstEnumMemberVariable = Transmission;
|
||||
void colorInstanceMethod(double d) {}
|
||||
static void colorStaticMethod(double d) {}
|
||||
void colors(const Inner1::Color& col1a,
|
||||
|
|
@ -85,8 +78,8 @@ namespace Outer {
|
|||
};
|
||||
}
|
||||
|
||||
class SomeClass {
|
||||
public:
|
||||
class SomeClass {
|
||||
public:
|
||||
Inner1::Color::Channel GetInner1ColorChannel() { return Inner1::Color::Transmission; }
|
||||
Inner2::Color::Channel GetInner2ColorChannel() { return Inner2::Color::Transmission; }
|
||||
Inner1::Channel GetInner1Channel() { return Inner1::Transmission1; }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue