~ubuntu-branches/ubuntu/maverick/swig1.3/maverick

« back to all changes in this revision

Viewing changes to Examples/test-suite/director_extend.i

  • Committer: Bazaar Package Importer
  • Author(s): Michael Vogt
  • Date: 2006-12-20 14:43:24 UTC
  • mfrom: (1.2.5 upstream)
  • Revision ID: james.westby@ubuntu.com-20061220144324-bps3kb06xp5oy9w1
Tags: 1.3.31-1ubuntu1
* Merge from debian unstable, remaining changes:
  - drop support for pike
  - use php5 instead of php4
  - clean Runtime/ as well
  - force a few environment variables

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
 
 
2
%module(directors="1") director_extend
 
3
 
 
4
%extend SpObject 
 
5
{
 
6
   virtual int dummy()          // Had to remove virtual to work
 
7
   {
 
8
      return $self->getFooBar();
 
9
   }
 
10
};
 
11
 
 
12
%inline %{
 
13
#ifndef SWIG_DIRECTORS
 
14
// dummy definition for non-director languages
 
15
namespace Swig {
 
16
  typedef int Director;
 
17
}
 
18
#endif
 
19
%}
 
20
 
 
21
%extend SpObject
 
22
{
 
23
  size_t ExceptionMethod()
 
24
  {
 
25
// Check positioning of director code in wrapper file
 
26
// Below is what we really want to test, but director exceptions vary too much across across all languages
 
27
//    throw Swig::DirectorException("DirectorException was not in scope!!");
 
28
// Instead check definition of Director class as that is defined in the same place as DirectorException (director.swg)
 
29
    size_t size = sizeof(Swig::Director);
 
30
    return size;
 
31
  }
 
32
};
 
33
 
 
34
 
 
35
%inline %{
 
36
class SpObject
 
37
{
 
38
public:
 
39
   SpObject() {}
 
40
   virtual ~SpObject() {}
 
41
 
 
42
   int getFooBar() const {
 
43
      return 666;
 
44
   }
 
45
 
 
46
private:
 
47
   // Do NOT define the assignment operator
 
48
   SpObject& operator=(const SpObject& rhs);
 
49
 
 
50
   // This class can not be copied.  Do NOT define the copy Constructor.
 
51
   SpObject (const SpObject& rhs);
 
52
};
 
53
%}
 
54