File: minherit.i

package info (click to toggle)
renderdoc 1.2%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 79,584 kB
  • sloc: cpp: 491,671; ansic: 285,823; python: 12,617; java: 11,345; cs: 7,181; makefile: 6,703; yacc: 5,682; ruby: 4,648; perl: 3,461; php: 2,119; sh: 2,068; lisp: 1,835; tcl: 1,068; ml: 747; xml: 137
file content (82 lines) | stat: -rw-r--r-- 1,540 bytes parent folder | download | duplicates (13)
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
// This module tests multiple inheritance, typedef handling, and some
// truly horrible parts of the SWIG type system.   This is only tested
// for Python since not all language modules support multiple-inheritance.
// However, if it works for Python, things should be working for other
// modules.

%module(ruby_minherit="1") minherit

#if defined(SWIGPYTHON) || defined(SWIGRUBY) || defined(SWIGOCAML) || defined(SWIGOCTAVE) || defined(SWIGPERL) || defined(SWIGGO)

%inline %{

class Foo {
private:
    int x;
public:
    Foo() { x = 1; }
    virtual ~Foo() {}
    virtual int  xget() {  return x; };
};
typedef Foo *FooPtr;

FooPtr toFooPtr(Foo *f) { return f; }

class Bar {
private:
    int y;
public:
    Bar() { y = 2; }
    virtual ~Bar() {}
    virtual int yget() { return y; }
};

typedef Bar *BarPtr;
BarPtr toBarPtr(Bar *f) { return f; }

class FooBar : public Foo, public Bar {
private:
    int z;
public:
    FooBar() { z = 3; }
    virtual int zget() { return z; }
};

typedef FooBar *FooBarPtr;
FooBarPtr toFooBarPtr(FooBar *f) { return f; }

class Spam: public FooBar {
private:
    int w;
public:
    Spam() { w = 4; }
    virtual int wget() { return w; }
};

typedef Spam *SpamPtr;
SpamPtr toSpamPtr(Spam *f) { return f; }

int xget(FooPtr f) {
   return f->xget();
}

int yget(BarPtr f) {
   return f->yget();
}

int zget(FooBarPtr f) {
   return f->zget();
}

int wget(SpamPtr f) {
   return f->wget();
}
%}

#endif


// Was causing runtime error in Ruby
%include <std_vector.i>
%template(IntVector) std::vector<int>;