summaryrefslogtreecommitdiff
path: root/Examples/test-suite/newobject3.i
blob: ef12cd4010f6ca35fb451b982f0e8d134eb713e8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
/**
 * Regression test for PHP bug: https://sourceforge.net/p/swig/bugs/1350/
 */

%module newobject3

%newobject factory::create;
%inline %{
class Product {};
class factory {
public:
    Product * create(short id, short type = 0);
    Product * create(const char * name, short type = 0);
};
%}

%{
Product * factory::create(short id, short type) {
    return (id && type >= 0) ? new Product : NULL;
}

Product * factory::create(const char * name, short type) {
    return (name && type >= 0) ? new Product : NULL;
}
%}