Improved test to use namespaces
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@4787 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
da8d51c30b
commit
2a6a63ab57
1 changed files with 19 additions and 17 deletions
|
|
@ -4,21 +4,21 @@
|
||||||
|
|
||||||
|
|
||||||
%typemap(javaimports) SWIGTYPE "import java.math.*;";
|
%typemap(javaimports) SWIGTYPE "import java.math.*;";
|
||||||
%typemap(javacode) Farewell %{
|
%typemap(javacode) NS::Farewell %{
|
||||||
public void saybye(BigDecimal num_times) {
|
public void saybye(BigDecimal num_times) {
|
||||||
// BigDecimal requires the java.math library
|
// BigDecimal requires the java.math library
|
||||||
}
|
}
|
||||||
%}
|
%}
|
||||||
%typemap(javaclassmodifiers) Farewell "public final";
|
%typemap(javaclassmodifiers) NS::Farewell "public final";
|
||||||
|
|
||||||
%typemap(javaimports) Greeting %{
|
%typemap(javaimports) NS::Greeting %{
|
||||||
import java.util.*; // for EventListener
|
import java.util.*; // for EventListener
|
||||||
import java.lang.*; // for Exception
|
import java.lang.*; // for Exception
|
||||||
%};
|
%};
|
||||||
|
|
||||||
%typemap(javabase) Greeting "Exception";
|
%typemap(javabase) NS::Greeting "Exception";
|
||||||
%typemap(javainterfaces) Greeting "EventListener";
|
%typemap(javainterfaces) NS::Greeting "EventListener";
|
||||||
%typemap(javacode) Greeting %{
|
%typemap(javacode) NS::Greeting %{
|
||||||
// Pure Java code generated using %typemap(javacode)
|
// Pure Java code generated using %typemap(javacode)
|
||||||
public void sayhello() {
|
public void sayhello() {
|
||||||
hello();
|
hello();
|
||||||
|
|
@ -29,25 +29,27 @@ import java.lang.*; // for Exception
|
||||||
%}
|
%}
|
||||||
|
|
||||||
// Create a new getCPtr() function which takes Java null
|
// Create a new getCPtr() function which takes Java null
|
||||||
%typemap(javagetcptr) Greeting %{
|
%typemap(javagetcptr) NS::Greeting %{
|
||||||
public static long getCPtr($javaclassname obj) {
|
public static long getCPtr($javaclassname obj) {
|
||||||
return (obj == null) ? 0 : obj.swigCPtr;
|
return (obj == null) ? 0 : obj.swigCPtr;
|
||||||
}
|
}
|
||||||
%}
|
%}
|
||||||
|
|
||||||
// get rid of the finalize method for Farewell
|
// get rid of the finalize method for NS::Farewell
|
||||||
%typemap(javafinalize) Farewell "";
|
%typemap(javafinalize) NS::Farewell "";
|
||||||
|
|
||||||
// Make the pointer constructor public
|
// Make the pointer constructor public
|
||||||
%typemap(javaptrconstructormodifiers) Farewell "public";
|
%typemap(javaptrconstructormodifiers) NS::Farewell "public";
|
||||||
|
|
||||||
|
|
||||||
%inline %{
|
%inline %{
|
||||||
class Greeting {
|
namespace NS {
|
||||||
public:
|
class Greeting {
|
||||||
void hello() {}
|
public:
|
||||||
static void ciao(Greeting* g) {}
|
void hello() {}
|
||||||
};
|
static void ciao(Greeting* g) {}
|
||||||
class Farewell {
|
};
|
||||||
};
|
class Farewell {
|
||||||
|
};
|
||||||
|
}
|
||||||
%}
|
%}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue