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 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197
|
// This module tests default constructor generation under a
// number of different conditions
%module(ruby_minherit="1") default_constructor
%warnfilter(SWIGWARN_JAVA_MULTIPLE_INHERITANCE,
SWIGWARN_CSHARP_MULTIPLE_INHERITANCE,
SWIGWARN_D_MULTIPLE_INHERITANCE,
SWIGWARN_PHP_MULTIPLE_INHERITANCE) EB; /* C#, D, Java, PHP multiple inheritance */
%warnfilter(SWIGWARN_JAVA_MULTIPLE_INHERITANCE,
SWIGWARN_CSHARP_MULTIPLE_INHERITANCE,
SWIGWARN_D_MULTIPLE_INHERITANCE,
SWIGWARN_PHP_MULTIPLE_INHERITANCE) AD; /* C#, D, Java, PHP multiple inheritance */
%warnfilter(SWIGWARN_JAVA_MULTIPLE_INHERITANCE,
SWIGWARN_CSHARP_MULTIPLE_INHERITANCE,
SWIGWARN_D_MULTIPLE_INHERITANCE,
SWIGWARN_PHP_MULTIPLE_INHERITANCE) GGG; /* C#, D, Java, PHP multiple inheritance */
%warnfilter(SWIGWARN_JAVA_MULTIPLE_INHERITANCE,
SWIGWARN_CSHARP_MULTIPLE_INHERITANCE,
SWIGWARN_D_MULTIPLE_INHERITANCE,
SWIGWARN_PHP_MULTIPLE_INHERITANCE) HHH; /* C#, D, Java, PHP multiple inheritance */
%warnfilter(SWIGWARN_LANG_FRIEND_IGNORE) F; /* friend function */
%delobject F::destroy;
%delobject G::destroy;
%inline %{
/* A class with a public default constructor */
class A {
public:
A() { };
};
/* This class should get default constructor/destructors */
class AA : public A {
};
/* A class with a public constructor, but not default */
class B {
private:
B() { }
public:
B(int x, int y) { }
};
/* This class should get no default constructor, but a destructor */
class BB : public B {
};
/* A class with a protected constructor */
class C {
protected:
C() { };
public:
};
/* This class does get a default constructor/destructor */
class CC : public C {
};
/* A class with a private constructor */
class D {
private:
D() { };
public:
void foo() { };
};
/* This class does not get a default constructor */
class DD: public D {
};
/* No default constructor. A is okay, but D is not */
class AD: public A, public D {
};
/* This class has a default constructor because of optional arguments */
class E {
public:
E(int x = 0, int y = 0) { }
};
/* This should get a default constructor */
class EE : public E {
};
/* This class should not get a default constructor. B doesn't have one */
class EB : public E, public B {
};
/* A class with a private destructor */
class F {
private:
~F() { }
public:
void foo(int, int) { }
friend void bar(F *);
void destroy() { delete this; }
};
void bar(F *) { }
#if defined(_MSC_VER)
#pragma warning(disable: 4624) // destructor could not be generated because a base class destructor is inaccessible or deleted
#endif
// Single inheritance, base has private destructor
class FFF : public F {
};
// Multiple inheritance, one base has private destructor
class GGG : public A, public F {
};
class HHH : public F, public A {
};
#if defined(_MSC_VER)
#pragma warning(default: 4624) // destructor could not be generated because a base class destructor is inaccessible or deleted
#endif
/* A class with a protected destructor */
class G {
protected:
~G() { }
public:
static void destroy(G *g) { delete g; }
};
class GG : public G {
};
template <class T>
class HH_T
{
public:
HH_T(int i,int j)
{
}
protected:
HH_T();
};
%}
%template(HH) HH_T<int>;
%{
class OSRSpatialReferenceShadow {
private:
OSRSpatialReferenceShadow();
public:
};
%}
typedef void OSRSpatialReferenceShadow;
class OSRSpatialReferenceShadow {
private:
public:
%extend {
OSRSpatialReferenceShadow( char const * wkt = "" ) {
return 0;
}
}
};
%inline %{
#ifdef SWIGPYTHON_BUILTIN
bool is_python_builtin() { return true; }
#else
bool is_python_builtin() { return false; }
#endif
%}
|