diff options
| author | Lorry Tar Creator <lorry-tar-importer@baserock.org> | 2009-08-18 20:56:02 +0000 |
|---|---|---|
| committer | Lorry <lorry@roadtrain.codethink.co.uk> | 2012-09-25 16:59:08 +0000 |
| commit | 9f8a09ed743cedd9547bf0661d518647966ab114 (patch) | |
| tree | 9c7803d3b27a8ec22e91792ac7f7932efa128b20 /Examples/test-suite/minherit.i | |
| download | swig-tarball-master.tar.gz | |
Imported from /srv/lorry/lorry-area/swig-tarball/swig-1.3.40.tar.gz.HEADswig-1.3.40master
Diffstat (limited to 'Examples/test-suite/minherit.i')
| -rw-r--r-- | Examples/test-suite/minherit.i | 77 |
1 files changed, 77 insertions, 0 deletions
diff --git a/Examples/test-suite/minherit.i b/Examples/test-suite/minherit.i new file mode 100644 index 0000000..24092b6 --- /dev/null +++ b/Examples/test-suite/minherit.i @@ -0,0 +1,77 @@ +// 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) + +%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 + |
