%ignore director fixes

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@9326 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
William S Fulton 2006-09-22 23:29:34 +00:00
commit d096cc1613
8 changed files with 262 additions and 176 deletions

View file

@ -12,6 +12,13 @@ public class runme
void run()
{
// Just check the classes can be instantiated and other methods work as expected
DIgnoresDerived a = new DIgnoresDerived();
if (a.Triple(5) != 15)
throw new Exception("Triple failed");
DAbstractIgnoresDerived b = new DAbstractIgnoresDerived();
if (b.Quadruple(5) != 20)
throw new Exception("Quadruple failed");
}
}
@ -22,13 +29,29 @@ class DIgnoresDerived : DIgnores
}
// These will give a warning if the %ignore is not working
public virtual void OverloadedMethod(int n, int xoffset, int yoffset) {}
public virtual void OverloadedMethod(int n, int xoffset) {}
public virtual void OverloadedMethod(int n) {}
public virtual int OverloadedMethod(int n, int xoffset, int yoffset) { return 0; }
public virtual int OverloadedMethod(int n, int xoffset) { return 0; }
public virtual int OverloadedMethod(int n) { return 0; }
public virtual void ProtectedMethod(int n, int xoffset, int yoffset) {}
public virtual void ProtectedMethod(int n, int xoffset) {}
public virtual void ProtectedMethod(int n) {}
public virtual int OverloadedProtectedMethod(int n, int xoffset, int yoffset) { return 0; }
public virtual int OverloadedProtectedMethod(int n, int xoffset) { return 0; }
public virtual int OverloadedProtectedMethod(int n) { return 0; }
}
class DAbstractIgnoresDerived : DAbstractIgnores
{
public DAbstractIgnoresDerived() : base()
{
}
// These will give a warning if the %ignore is not working
public virtual int OverloadedMethod(int n, int xoffset, int yoffset) { return 0; }
public virtual int OverloadedMethod(int n, int xoffset) { return 0; }
public virtual int OverloadedMethod(int n) { return 0; }
public virtual int OverloadedProtectedMethod(int n, int xoffset, int yoffset) { return 0; }
public virtual int OverloadedProtectedMethod(int n, int xoffset) { return 0; }
public virtual int OverloadedProtectedMethod(int n) { return 0; }
}
}

View file

@ -1,13 +1,17 @@
%module(directors="1") director_ignore
%warnfilter(SWIGWARN_LANG_DIRECTOR_ABSTRACT) DIgnoreOnlyConstructor;
%include "std_string.i"
%feature("director");
%ignore OverloadedMethod(int n, int xoffset = 0, int yoffset = 0);
%ignore ProtectedMethod(int n, int xoffset = 0, int yoffset = 0);
%ignore OverloadedProtectedMethod(int n, int xoffset = 0, int yoffset = 0);
%ignore DIgnoreConstructor(bool b);
%ignore DIgnoreOnlyConstructor(bool b);
%ignore Pointers;
%ignore References;
%inline %{
@ -18,8 +22,26 @@ class DIgnores
virtual ~DIgnores() {}
virtual void OverloadedMethod(int n, int xoffset = 0, int yoffset = 0) {}
virtual void OverloadedMethod(bool b) {}
virtual int Triple(int n) { return n*3; }
virtual int& References(int& n) { static int nn; nn=n; return nn; }
virtual int* Pointers(int* n) { static int nn; nn=*n; return &nn; }
protected:
virtual void ProtectedMethod(int n, int xoffset = 0, int yoffset = 0) {}
virtual void OverloadedProtectedMethod(int n, int xoffset = 0, int yoffset = 0) {}
virtual void OverloadedProtectedMethod() {}
};
class DAbstractIgnores
{
public:
virtual ~DAbstractIgnores() {}
virtual double OverloadedMethod(int n, int xoffset = 0, int yoffset = 0) = 0;
virtual double OverloadedMethod(bool b) = 0;
virtual int Quadruple(int n) { return n*4; }
virtual int& References(int& n) { static int nn; nn=n; return nn; }
virtual int* Pointers(int* n) { static int nn; nn=*n; return &nn; }
protected:
virtual double OverloadedProtectedMethod(int n, int xoffset = 0, int yoffset = 0) = 0;
virtual double OverloadedProtectedMethod() = 0;
};
class DIgnoreConstructor
@ -37,16 +59,5 @@ class DIgnoreOnlyConstructor
DIgnoreOnlyConstructor(bool b) {}
};
/*
class DAbstractIgnores
{
public:
virtual ~DAbstractIgnores() {}
virtual void OverloadedMethod(int n, int xoffset = 0, int yoffset = 0) = 0;
virtual void OverloadedMethod(bool b) = 0;
};
*/
%}

View file

@ -0,0 +1,40 @@
import director_ignore.*;
public class director_ignore_runme {
static {
try {
System.loadLibrary("director_ignore");
} catch (UnsatisfiedLinkError e) {
System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e);
System.exit(1);
}
}
public static void main(String argv[])
{
// Just check the classes can be instantiated and other methods work as expected
DIgnoresDerived a = new DIgnoresDerived();
if (a.Triple(5) != 15)
throw new RuntimeException("Triple failed");
DAbstractIgnoresDerived b = new DAbstractIgnoresDerived();
if (b.Quadruple(5) != 20)
throw new RuntimeException("Quadruple failed");
}
}
class DIgnoresDerived extends DIgnores
{
public DIgnoresDerived()
{
super();
}
}
class DAbstractIgnoresDerived extends DAbstractIgnores
{
public DAbstractIgnoresDerived()
{
super();
}
}