Merge branch 'nested' - nested structs/classes support
* nested: Deprecation of the 'nestedworkaround' feature Ensure -c++out is not used with -c++ Add missing header to new source file Nested C class setters restored in c++out mode for Octave Classprefix fixed after private nested classes some comments and spaces added Fix template partial specialization detection Minor tweaks in Swig_feature_set Swig_offset_string moved to misc.c nested private classes are discarded while parsing nested relate functions are moved to nested.cxx and renamed accordingly out-of-scope template definitions fixed nested_private test disabled again fixed out-of-scope nested class definitions, added a test enabled nested C structs assignment (still disabled for Octave), added Java runtime test fixed nested_private test case for Java & C# Testcase of private nested class usage causing segfault C nested struct passed by value example Add in Travis testing for nested branch Add C++ nested class example Minor code improvements Cosmetics/code beautification of nested class support Nested classes support
This commit is contained in:
commit
314fae460b
61 changed files with 2438 additions and 1127 deletions
|
|
@ -84,6 +84,7 @@ CPP_TEST_BROKEN += \
|
|||
extend_variable \
|
||||
li_std_vector_ptr \
|
||||
li_boost_shared_ptr_template \
|
||||
nested_private \
|
||||
overload_complicated \
|
||||
template_default_pointer \
|
||||
template_expr \
|
||||
|
|
@ -279,6 +280,7 @@ CPP_TEST_CASES += \
|
|||
naturalvar_more \
|
||||
nested_class \
|
||||
nested_comment \
|
||||
nested_scope \
|
||||
nested_workaround \
|
||||
newobject1 \
|
||||
null_pointer \
|
||||
|
|
|
|||
|
|
@ -3,14 +3,12 @@ This was reported in bug #909389 */
|
|||
|
||||
%module derived_nested
|
||||
|
||||
%warnfilter(SWIGWARN_PARSE_NAMED_NESTED_CLASS) BB::CC;
|
||||
%warnfilter(SWIGWARN_PARSE_NAMED_NESTED_CLASS) BB::DD;
|
||||
%warnfilter(SWIGWARN_PARSE_NAMED_NESTED_CLASS) BB::EE;
|
||||
%warnfilter(SWIGWARN_PARSE_NAMED_NESTED_CLASS) BB::FF;
|
||||
|
||||
%inline %{
|
||||
|
||||
class A { int x; };
|
||||
class A {
|
||||
public:
|
||||
int x;
|
||||
};
|
||||
class B {
|
||||
class C { int y; }; //generates a warning
|
||||
class D : public A { int z; }; //ok
|
||||
|
|
|
|||
|
|
@ -14,59 +14,59 @@ public class nested_class_runme {
|
|||
|
||||
public static void main(String argv[]) {
|
||||
Outer outer = new Outer();
|
||||
SWIGTYPE_p_Outer__InnerStruct1 is1 = outer.makeInnerStruct1();
|
||||
SWIGTYPE_p_Outer__InnerClass1 ic1 = outer.makeInnerClass1();
|
||||
SWIGTYPE_p_Outer__InnerUnion1 iu1 = outer.makeInnerUnion1();
|
||||
Outer.InnerStruct1 is1 = outer.makeInnerStruct1();
|
||||
Outer.InnerClass1 ic1 = outer.makeInnerClass1();
|
||||
Outer.InnerUnion1 iu1 = outer.makeInnerUnion1();
|
||||
|
||||
SWIGTYPE_p_Outer__InnerStruct2 is2 = outer.makeInnerStruct2();
|
||||
SWIGTYPE_p_Outer__InnerClass2 ic2 = outer.makeInnerClass2();
|
||||
SWIGTYPE_p_Outer__InnerUnion2 iu2 = outer.makeInnerUnion2();
|
||||
Outer.InnerStruct2 is2 = outer.makeInnerStruct2();
|
||||
Outer.InnerClass2 ic2 = outer.makeInnerClass2();
|
||||
Outer.InnerUnion2 iu2 = outer.makeInnerUnion2();
|
||||
|
||||
SWIGTYPE_p_Outer__InnerClass4Typedef ic4 = outer.makeInnerClass4Typedef();
|
||||
SWIGTYPE_p_Outer__InnerStruct4Typedef is4 = outer.makeInnerStruct4Typedef();
|
||||
SWIGTYPE_p_Outer__InnerUnion4Typedef iu4 = outer.makeInnerUnion4Typedef();
|
||||
Outer.InnerClass4Typedef ic4 = outer.makeInnerClass4Typedef();
|
||||
Outer.InnerStruct4Typedef is4 = outer.makeInnerStruct4Typedef();
|
||||
Outer.InnerUnion4Typedef iu4 = outer.makeInnerUnion4Typedef();
|
||||
|
||||
SWIGTYPE_p_Outer__InnerClass5 ic5 = outer.makeInnerClass5();
|
||||
SWIGTYPE_p_Outer__InnerStruct5 is5 = outer.makeInnerStruct5();
|
||||
SWIGTYPE_p_Outer__InnerUnion5 iu5 = outer.makeInnerUnion5();
|
||||
Outer.InnerClass5Typedef ic5 = outer.makeInnerClass5();
|
||||
Outer.InnerStruct5Typedef is5 = outer.makeInnerStruct5();
|
||||
Outer.InnerUnion5Typedef iu5 = outer.makeInnerUnion5();
|
||||
|
||||
ic5 = outer.makeInnerClass5Typedef();
|
||||
is5 = outer.makeInnerStruct5Typedef();
|
||||
iu5 = outer.makeInnerUnion5Typedef();
|
||||
|
||||
{
|
||||
SWIGTYPE_p_Outer__InnerMultiple im1 = outer.getMultipleInstance1();
|
||||
SWIGTYPE_p_Outer__InnerMultiple im2 = outer.getMultipleInstance2();
|
||||
SWIGTYPE_p_Outer__InnerMultiple im3 = outer.getMultipleInstance3();
|
||||
SWIGTYPE_p_Outer__InnerMultiple im4 = outer.getMultipleInstance4();
|
||||
Outer.InnerMultiple im1 = outer.getMultipleInstance1();
|
||||
Outer.InnerMultiple im2 = outer.getMultipleInstance2();
|
||||
Outer.InnerMultiple im3 = outer.getMultipleInstance3();
|
||||
Outer.InnerMultiple im4 = outer.getMultipleInstance4();
|
||||
}
|
||||
|
||||
{
|
||||
SWIGTYPE_p_Outer__InnerMultipleDerived im1 = outer.getMultipleDerivedInstance1();
|
||||
SWIGTYPE_p_Outer__InnerMultipleDerived im2 = outer.getMultipleDerivedInstance2();
|
||||
SWIGTYPE_p_Outer__InnerMultipleDerived im3 = outer.getMultipleDerivedInstance3();
|
||||
SWIGTYPE_p_Outer__InnerMultipleDerived im4 = outer.getMultipleDerivedInstance4();
|
||||
Outer.InnerMultipleDerived im1 = outer.getMultipleDerivedInstance1();
|
||||
Outer.InnerMultipleDerived im2 = outer.getMultipleDerivedInstance2();
|
||||
Outer.InnerMultipleDerived im3 = outer.getMultipleDerivedInstance3();
|
||||
Outer.InnerMultipleDerived im4 = outer.getMultipleDerivedInstance4();
|
||||
}
|
||||
|
||||
{
|
||||
SWIGTYPE_p_Outer__InnerMultipleDerived im1 = outer.getMultipleDerivedInstance1();
|
||||
SWIGTYPE_p_Outer__InnerMultipleDerived im2 = outer.getMultipleDerivedInstance2();
|
||||
SWIGTYPE_p_Outer__InnerMultipleDerived im3 = outer.getMultipleDerivedInstance3();
|
||||
SWIGTYPE_p_Outer__InnerMultipleDerived im4 = outer.getMultipleDerivedInstance4();
|
||||
Outer.InnerMultipleDerived im1 = outer.getMultipleDerivedInstance1();
|
||||
Outer.InnerMultipleDerived im2 = outer.getMultipleDerivedInstance2();
|
||||
Outer.InnerMultipleDerived im3 = outer.getMultipleDerivedInstance3();
|
||||
Outer.InnerMultipleDerived im4 = outer.getMultipleDerivedInstance4();
|
||||
}
|
||||
|
||||
{
|
||||
SWIGTYPE_p_Outer__InnerMultipleAnonTypedef1 mat1 = outer.makeInnerMultipleAnonTypedef1();
|
||||
SWIGTYPE_p_Outer__InnerMultipleAnonTypedef2 mat2 = outer.makeInnerMultipleAnonTypedef2();
|
||||
SWIGTYPE_p_Outer__InnerMultipleAnonTypedef3 mat3 = outer.makeInnerMultipleAnonTypedef3();
|
||||
Outer.InnerMultipleAnonTypedef1 mat1 = outer.makeInnerMultipleAnonTypedef1();
|
||||
Outer.InnerMultipleAnonTypedef1 mat2 = outer.makeInnerMultipleAnonTypedef2();
|
||||
SWIGTYPE_p_p_Outer__InnerMultipleAnonTypedef1 mat3 = outer.makeInnerMultipleAnonTypedef3();
|
||||
|
||||
SWIGTYPE_p_Outer__InnerMultipleNamedTypedef mnt = outer.makeInnerMultipleNamedTypedef();
|
||||
SWIGTYPE_p_Outer__InnerMultipleNamedTypedef mnt1 = outer.makeInnerMultipleNamedTypedef1();
|
||||
SWIGTYPE_p_Outer__InnerMultipleNamedTypedef mnt2 = outer.makeInnerMultipleNamedTypedef2();
|
||||
Outer.InnerMultipleNamedTypedef1 mnt = outer.makeInnerMultipleNamedTypedef();
|
||||
Outer.InnerMultipleNamedTypedef1 mnt1 = outer.makeInnerMultipleNamedTypedef1();
|
||||
Outer.InnerMultipleNamedTypedef1 mnt2 = outer.makeInnerMultipleNamedTypedef2();
|
||||
SWIGTYPE_p_p_Outer__InnerMultipleNamedTypedef mnt3 = outer.makeInnerMultipleNamedTypedef3();
|
||||
}
|
||||
{
|
||||
SWIGTYPE_p_Outer__InnerSameName isn = outer.makeInnerSameName();
|
||||
Outer.InnerSameName isn = outer.makeInnerSameName();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,21 +17,28 @@ public class nested_structs_runme {
|
|||
nested_structs.setValues(outer, 10);
|
||||
|
||||
Outer_inner1 inner1 = outer.getInner1();
|
||||
Outer_inner2 inner2 = outer.getInner2();
|
||||
Outer_inner3 inner3 = outer.getInner3();
|
||||
Outer_inner4 inner4 = outer.getInner4();
|
||||
Outer_inner1 inner2 = outer.getInner2();
|
||||
Outer_inner1 inner3 = outer.getInner3();
|
||||
Outer_inner1 inner4 = outer.getInner4();
|
||||
if (inner1.getVal() != 10) throw new RuntimeException("failed inner1");
|
||||
if (inner2.getVal() != 20) throw new RuntimeException("failed inner2");
|
||||
if (inner3.getVal() != 20) throw new RuntimeException("failed inner3");
|
||||
if (inner4.getVal() != 40) throw new RuntimeException("failed inner4");
|
||||
|
||||
Outer_inside1 inside1 = outer.getInside1();
|
||||
Outer_inside2 inside2 = outer.getInside2();
|
||||
Outer_inside3 inside3 = outer.getInside3();
|
||||
Outer_inside4 inside4 = outer.getInside4();
|
||||
Named inside1 = outer.getInside1();
|
||||
Named inside2 = outer.getInside2();
|
||||
Named inside3 = outer.getInside3();
|
||||
Named inside4 = outer.getInside4();
|
||||
if (inside1.getVal() != 100) throw new RuntimeException("failed inside1");
|
||||
if (inside2.getVal() != 200) throw new RuntimeException("failed inside2");
|
||||
if (inside3.getVal() != 200) throw new RuntimeException("failed inside3");
|
||||
if (inside4.getVal() != 400) throw new RuntimeException("failed inside4");
|
||||
|
||||
outer.getInner1().setVal(11);
|
||||
if (inner1.getVal() != 11) throw new RuntimeException("failed inner1 assignment");
|
||||
Named named = new Named();
|
||||
named.setVal(22);
|
||||
outer.setInside2(named);
|
||||
if (outer.getInside2().getVal() != 22) throw new RuntimeException("failed inside2 assignment");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,6 +25,10 @@ public class template_nested_runme {
|
|||
T_NestedOuterTemplateDouble tn = new T_NestedOuterTemplateDouble();
|
||||
if (tn.hohum(-12.3) != -12.3)
|
||||
throw new RuntimeException("it failed");
|
||||
OuterClass.T_OuterClassInner1Int inner1 = new OuterClass().useInner1(new OuterClass.T_OuterClassInner1Int());
|
||||
OuterClass.T_OuterClassInner2NormalClass inner2 = new OuterClass.T_OuterClassInner2NormalClass();
|
||||
inner2.setEmbeddedVar(2);
|
||||
OuterClass.T_OuterClassInner2NormalClass inner22 = new OuterClass().useInner2Again(inner2);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
%module namespace_class
|
||||
|
||||
%warnfilter(SWIGWARN_PARSE_NAMED_NESTED_CLASS) Ala::Ola;
|
||||
|
||||
#ifdef SWIGD
|
||||
%warnfilter(SWIGWARN_IGNORE_OPERATOR_LT);
|
||||
|
|
@ -216,9 +215,6 @@ namespace a
|
|||
|
||||
%}
|
||||
|
||||
// %copyctor doesn't work with nested class workaround
|
||||
%nocopyctor;
|
||||
|
||||
%inline %{
|
||||
class Ala {
|
||||
public :
|
||||
|
|
@ -236,12 +232,6 @@ namespace a
|
|||
};
|
||||
%}
|
||||
|
||||
%rename(Ala__Ola) Ala::Ola;
|
||||
class Ala::Ola {
|
||||
public:
|
||||
Ola() {}
|
||||
void eek() {}
|
||||
};
|
||||
|
||||
%template(hi) Ala::hi<int>;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,5 @@
|
|||
%module namespace_union
|
||||
|
||||
#pragma SWIG nowarn=SWIGWARN_PARSE_UNNAMED_NESTED_CLASS
|
||||
|
||||
%inline %{
|
||||
namespace SpatialIndex
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,25 +1,5 @@
|
|||
%module nested_class
|
||||
|
||||
#pragma SWIG nowarn=SWIGWARN_PARSE_UNNAMED_NESTED_CLASS
|
||||
%warnfilter(SWIGWARN_PARSE_NAMED_NESTED_CLASS) Outer::InnerStruct1;
|
||||
%warnfilter(SWIGWARN_PARSE_NAMED_NESTED_CLASS) Outer::InnerClass1;
|
||||
%warnfilter(SWIGWARN_PARSE_NAMED_NESTED_CLASS) Outer::InnerUnion1;
|
||||
%warnfilter(SWIGWARN_PARSE_NAMED_NESTED_CLASS) Outer::InnerClass2;
|
||||
%warnfilter(SWIGWARN_PARSE_NAMED_NESTED_CLASS) Outer::InnerStruct2;
|
||||
%warnfilter(SWIGWARN_PARSE_NAMED_NESTED_CLASS) Outer::InnerUnion2;
|
||||
%warnfilter(SWIGWARN_PARSE_NAMED_NESTED_CLASS) Outer::InnerClass4Typedef;
|
||||
%warnfilter(SWIGWARN_PARSE_NAMED_NESTED_CLASS) Outer::InnerStruct4Typedef;
|
||||
%warnfilter(SWIGWARN_PARSE_NAMED_NESTED_CLASS) Outer::InnerUnion4Typedef;
|
||||
%warnfilter(SWIGWARN_PARSE_NAMED_NESTED_CLASS) Outer::InnerClass5;
|
||||
%warnfilter(SWIGWARN_PARSE_NAMED_NESTED_CLASS) Outer::InnerStruct5;
|
||||
%warnfilter(SWIGWARN_PARSE_NAMED_NESTED_CLASS) Outer::InnerUnion5;
|
||||
%warnfilter(SWIGWARN_PARSE_NAMED_NESTED_CLASS) Outer::InnerMultiple;
|
||||
%warnfilter(SWIGWARN_PARSE_NAMED_NESTED_CLASS) Outer::InnerMultipleDerived;
|
||||
%warnfilter(SWIGWARN_PARSE_NAMED_NESTED_CLASS) Outer::InnerMultipleAnonTypedef1;
|
||||
%warnfilter(SWIGWARN_PARSE_NAMED_NESTED_CLASS) Outer::InnerMultipleNamedTypedef;
|
||||
%warnfilter(SWIGWARN_PARSE_NAMED_NESTED_CLASS) Outer::InnerSameName;
|
||||
%warnfilter(SWIGWARN_PARSE_NAMED_NESTED_CLASS) Outer2::IgnoreMe;
|
||||
|
||||
%inline %{
|
||||
struct Outer {
|
||||
typedef int Integer;
|
||||
|
|
@ -39,7 +19,7 @@ struct Outer {
|
|||
};
|
||||
|
||||
///////////////////////////////////////////
|
||||
#ifdef SWIG
|
||||
#if defined(__GNUC__) || defined(_MSC_VER) || defined(SWIG)
|
||||
/* some compilers do not accept these */
|
||||
class {
|
||||
public:
|
||||
|
|
@ -154,7 +134,7 @@ struct Outer {
|
|||
Integer xx;
|
||||
} MultipleInstanceAnonDerived1, MultipleInstanceAnonDerived2, *MultipleInstanceAnonDerived3, MultipleInstanceAnonDerived4[2];
|
||||
|
||||
#ifdef SWIG
|
||||
#if defined(__GNUC__) || defined(_MSC_VER) || defined(SWIG)
|
||||
/* some compilers do not accept these */
|
||||
struct : public InnerMultiple {
|
||||
Integer xx;
|
||||
|
|
|
|||
|
|
@ -1,7 +1,5 @@
|
|||
%module nested_comment
|
||||
|
||||
#pragma SWIG nowarn=SWIGWARN_PARSE_UNNAMED_NESTED_CLASS
|
||||
|
||||
// this example shows a problem with 'dump_nested' (parser.y).
|
||||
|
||||
// bug #949654
|
||||
|
|
|
|||
32
Examples/test-suite/nested_private.i
Normal file
32
Examples/test-suite/nested_private.i
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
%module nested_private
|
||||
|
||||
// segfault due to private nested class usage
|
||||
|
||||
%inline %{
|
||||
#include <string>
|
||||
class MotorCar {
|
||||
|
||||
struct DesignOpinion {
|
||||
std::string reason;
|
||||
};
|
||||
|
||||
public:
|
||||
struct WindScreen {
|
||||
WindScreen(bool opaque) : opaque(opaque) {}
|
||||
DesignOpinion Opinion();
|
||||
private:
|
||||
bool opaque;
|
||||
};
|
||||
|
||||
std::string WindScreenOpinion() {
|
||||
return MotorCar::WindScreen(true).Opinion().reason;
|
||||
}
|
||||
};
|
||||
|
||||
MotorCar::DesignOpinion MotorCar::WindScreen::Opinion() {
|
||||
DesignOpinion opinion;
|
||||
opinion.reason = !opaque ? "great design" : "you can't see out the windscreen";
|
||||
return opinion;
|
||||
}
|
||||
|
||||
%}
|
||||
14
Examples/test-suite/nested_scope.i
Normal file
14
Examples/test-suite/nested_scope.i
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
%module nested_scope
|
||||
|
||||
%inline %{
|
||||
namespace ns {
|
||||
struct Global {
|
||||
struct Outer {
|
||||
struct Nested;
|
||||
};
|
||||
struct Outer::Nested {
|
||||
int data;
|
||||
} instance;
|
||||
};
|
||||
}
|
||||
%}
|
||||
|
|
@ -25,5 +25,21 @@ void setValues(struct Outer *outer, int val) {
|
|||
outer->inside4[0].val = val * 4;
|
||||
outer->inside5 = &outer->inside3;
|
||||
}
|
||||
|
||||
int getInside1Val(struct Outer *n) { return n->inside1.val; }
|
||||
%}
|
||||
|
||||
/*
|
||||
Below was causing problems in Octave as wrappers were compiled as C++.
|
||||
Solution requires regenerating the inner struct into
|
||||
the global C++ namespace (which is where it is intended to be in C).
|
||||
*/
|
||||
%inline %{
|
||||
int nestedByVal(struct Named s);
|
||||
int nestedByPtr(struct Named *s);
|
||||
%}
|
||||
%{
|
||||
int nestedByVal(struct Named s) { return s.val; }
|
||||
int nestedByPtr(struct Named *s) { return s->val; }
|
||||
%}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,14 +1,6 @@
|
|||
%module nested_workaround
|
||||
// Similar to "Nested classes" documentation example.
|
||||
|
||||
class Inner {
|
||||
int val;
|
||||
public:
|
||||
Inner(int v = 0) : val(v) {}
|
||||
void setValue(int v) { val = v; }
|
||||
int getValue() const { return val; }
|
||||
};
|
||||
%nestedworkaround Outer::Inner;
|
||||
// "flatnested" emulates deprecated feature "nested_workaround" for the languages not supporting nested classes
|
||||
%feature ("flatnested");
|
||||
|
||||
%inline %{
|
||||
class Outer {
|
||||
|
|
@ -28,11 +20,3 @@ public:
|
|||
}
|
||||
};
|
||||
%}
|
||||
|
||||
// We've fooled SWIG into thinking that Inner is a global class, so now we need
|
||||
// to trick the C++ compiler into understanding this apparent global type.
|
||||
%{
|
||||
typedef Outer::Inner Inner;
|
||||
%}
|
||||
|
||||
|
||||
|
|
|
|||
14
Examples/test-suite/octave/nested_structs_runme.m
Normal file
14
Examples/test-suite/octave/nested_structs_runme.m
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
nested_structs
|
||||
|
||||
named = nested_structs.Named();
|
||||
named.val = 999;
|
||||
assert(nested_structs.nestedByVal(named), 999);
|
||||
assert(nested_structs.nestedByPtr(named), 999);
|
||||
|
||||
outer = nested_structs.Outer();
|
||||
outer.inside1.val = 456;
|
||||
assert(nested_structs.getInside1Val(outer), 456);
|
||||
|
||||
outer.inside1 = named;
|
||||
assert(nested_structs.getInside1Val(outer), 999);
|
||||
|
||||
|
|
@ -2,13 +2,6 @@
|
|||
|
||||
// Test nested templates - that is template classes and template methods within a class.
|
||||
|
||||
%warnfilter(SWIGWARN_PARSE_NAMED_NESTED_CLASS) ns::OuterClass::Inner1;
|
||||
%warnfilter(SWIGWARN_PARSE_NAMED_NESTED_CLASS) ns::OuterClass::Inner2;
|
||||
%warnfilter(SWIGWARN_PARSE_NAMED_NESTED_CLASS) ns::OuterTemplate::NestedInnerTemplate1;
|
||||
%warnfilter(SWIGWARN_PARSE_NAMED_NESTED_CLASS) ns::OuterTemplate::NestedInnerTemplate2;
|
||||
%warnfilter(SWIGWARN_PARSE_NAMED_NESTED_CLASS) ns::OuterTemplate::NestedInnerTemplate3;
|
||||
%warnfilter(SWIGWARN_PARSE_NAMED_NESTED_CLASS) ns::OuterTemplate::NestedStruct;
|
||||
|
||||
namespace ns {
|
||||
template <class T> struct ForwardTemplate;
|
||||
}
|
||||
|
|
@ -33,7 +26,13 @@ namespace ns {
|
|||
template <class T> struct NormalTemplate {
|
||||
void tmethod(T t) {}
|
||||
};
|
||||
}
|
||||
%}
|
||||
%template(T_NormalTemplateNormalClass) ns::NormalTemplate<ns::NormalClass>;
|
||||
%template(T_NormalTemplateInt) ns::NormalTemplate<int>;
|
||||
|
||||
%inline %{
|
||||
namespace ns {
|
||||
class OuterClass {
|
||||
public:
|
||||
template <class T> struct Inner1 {
|
||||
|
|
@ -70,6 +69,7 @@ namespace ns {
|
|||
};
|
||||
};
|
||||
Inner2<int> useInner2(const Inner2<int>& inner) { return inner; }
|
||||
Inner2<NormalClass> useInner2Again(const Inner2<NormalClass>& inner) { return inner; }
|
||||
int iii;
|
||||
};
|
||||
struct ABC {
|
||||
|
|
@ -108,9 +108,10 @@ namespace ns {
|
|||
|
||||
%}
|
||||
|
||||
%template(T_NormalTemplateNormalClass) ns::NormalTemplate<ns::NormalClass>;
|
||||
%template(T_OuterTMethodNormalClass) ns::OuterClass::InnerTMethod<ns::NormalClass>;
|
||||
%template(T_TemplateFuncs1Int) ns::TemplateFuncs::templateMethod1<int>;
|
||||
%template(T_TemplateFuncs2Double) ns::TemplateFuncs::templateMethod2<double>;
|
||||
%template(T_NestedOuterTemplateDouble) ns::OuterTemplate<double>;
|
||||
|
||||
%template(T_OuterClassInner1Int) ns::OuterClass::Inner1<int>;
|
||||
%template(T_OuterClassInner2NormalClass) ns::OuterClass::Inner2<ns::NormalClass>;
|
||||
%template(T_OuterClassInner2Int) ns::OuterClass::Inner2<int>;
|
||||
|
|
|
|||
|
|
@ -4,18 +4,22 @@
|
|||
|
||||
// Testing that the typemaps invoked within a class via %template are picked up by appropriate methods
|
||||
|
||||
%inline %{
|
||||
template <typename T> struct Typemap {
|
||||
#ifdef SWIG
|
||||
%typemap(in) T {
|
||||
$1 = -99;
|
||||
}
|
||||
#endif
|
||||
};
|
||||
template <> struct Typemap<short> { // Note explicit specialization
|
||||
#ifdef SWIG
|
||||
%typemap(in) short {
|
||||
$1 = -77;
|
||||
}
|
||||
#endif
|
||||
};
|
||||
|
||||
%inline %{
|
||||
int globalInt1(int s) { return s; }
|
||||
short globalShort1(short s) { return s; }
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@
|
|||
|
||||
%warnfilter(SWIGWARN_RUBY_WRONG_NAME) nRState; // Ruby, wrong class name
|
||||
%warnfilter(SWIGWARN_RUBY_WRONG_NAME) nRState_rstate; // Ruby, wrong class name
|
||||
#pragma SWIG nowarn=SWIGWARN_PARSE_UNNAMED_NESTED_CLASS
|
||||
|
||||
%inline %{
|
||||
class nRState {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue