swig/Examples/test-suite/overload_simple.i
Dave Beazley 56174160a0 Added extra test case
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@5170 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2003-09-30 17:35:39 +00:00

100 lines
1.6 KiB
OpenEdge ABL

// Simple tests of overloaded functions
%module overload_simple
#ifndef SWIG_NO_OVERLOAD
%immutable Spam::type;
%inline %{
struct Foo {
};
struct Bar {
};
char *foo(int) {
return (char*) "foo:int";
}
char *foo(double) {
return (char*) "foo:double";
}
char *foo(char *) {
return (char*) "foo:char *";
}
char *foo(Foo *) {
return (char*) "foo:Foo *";
}
char *foo(Bar *) {
return (char *) "foo:Bar *";
}
char *foo(void *) {
return (char *) "foo:void *";
}
char *blah(double) {
return (char *) "blah:double";
}
char *blah(char *) {
return (char *) "blah:char *";
}
class Spam {
public:
Spam() { type = "none"; }
Spam(int) { type = "int"; }
Spam(double) { type = "double"; }
Spam(char *) { type = "char *"; }
Spam(Foo *) { type = "Foo *"; }
Spam(Bar *) { type = "Bar *"; }
Spam(void *) { type = "void *"; }
const char *type;
char *foo(int) {
return (char*) "foo:int";
}
char *foo(double) {
return (char*) "foo:double";
}
char *foo(char *) {
return (char*) "foo:char *";
}
char *foo(Foo *) {
return (char*) "foo:Foo *";
}
char *foo(Bar *) {
return (char *) "foo:Bar *";
}
char *foo(void *) {
return (char *) "foo:void *";
}
static char *bar(int) {
return (char*) "bar:int";
}
static char *bar(double) {
return (char*) "bar:double";
}
static char *bar(char *) {
return (char*) "bar:char *";
}
static char *bar(Foo *) {
return (char*) "bar:Foo *";
}
static char *bar(Bar *) {
return (char *) "bar:Bar *";
}
static char *bar(void *) {
return (char *) "bar:void *";
}
};
%}
%include cmalloc.i
%malloc(void);
#endif