diff options
author | William S Fulton <wsf@fultondesigns.co.uk> | 2009-11-23 23:02:01 +0000 |
---|---|---|
committer | William S Fulton <wsf@fultondesigns.co.uk> | 2009-11-23 23:02:01 +0000 |
commit | 2a59a2e6a9c411be9da20de1c42869eaf4d91a1b (patch) | |
tree | dc4600c073ea9bd0fe6b6add12adc2e00d2ab21b /Examples/test-suite/nested_class.i | |
parent | 43b6292681c8fd9629b1b4ebf39a87afd42a6952 (diff) | |
download | swig-2a59a2e6a9c411be9da20de1c42869eaf4d91a1b.tar.gz |
Improved C++ nested class support - nested typedef'd classes now parsed and treated as forward class declaration
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11756 626c5289-ae23-0410-ae9c-e8d60b6d4f22
Diffstat (limited to 'Examples/test-suite/nested_class.i')
-rw-r--r-- | Examples/test-suite/nested_class.i | 142 |
1 files changed, 117 insertions, 25 deletions
diff --git a/Examples/test-suite/nested_class.i b/Examples/test-suite/nested_class.i index 89c9a8058..71d91f022 100644 --- a/Examples/test-suite/nested_class.i +++ b/Examples/test-suite/nested_class.i @@ -7,12 +7,18 @@ %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::InnerClass3Name; -%warnfilter(SWIGWARN_PARSE_NAMED_NESTED_CLASS) Outer::InnerStruct3Name; -%warnfilter(SWIGWARN_PARSE_NAMED_NESTED_CLASS) Outer::InnerUnion3Name; -%warnfilter(SWIGWARN_PARSE_NAMED_NESTED_CLASS) Outer::InnerClass4; -%warnfilter(SWIGWARN_PARSE_NAMED_NESTED_CLASS) Outer::InnerStruct4; -%warnfilter(SWIGWARN_PARSE_NAMED_NESTED_CLASS) Outer::InnerUnion4; +%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 { @@ -51,64 +57,150 @@ struct Outer { class InnerClass2 { public: Integer x; - } InnerClass2Name; + } InnerClass2Instance; struct InnerStruct2 { Integer x; - } InnerStruct2Name; + } InnerStruct2Instance; union InnerUnion2 { Integer x; double y; - } InnerUnion2Name; + } InnerUnion2Instance; /////////////////////////////////////////// class { public: Integer x; - } InnerClass3Name; + } InnerClass3Instance; struct { Integer x; - } InnerStruct3Name; + } InnerStruct3Instance; union { Integer x; double y; - } InnerUnion3Name; + } InnerUnion3Instance; /////////////////////////////////////////// typedef class { public: Integer x; - } InnerClass4; + } InnerClass4Typedef; typedef struct { Integer x; - } InnerStruct4; + } InnerStruct4Typedef; typedef union { Integer x; double y; - } InnerUnion4; + } InnerUnion4Typedef; + + /////////////////////////////////////////// + typedef class InnerClass5 { + public: + Integer x; + } InnerClass5Typedef; + + typedef struct InnerStruct5 { + Integer x; + } InnerStruct5Typedef; + + typedef union InnerUnion5 { + Integer x; + double y; + } InnerUnion5Typedef; // bug #909387 - inner declared types are treated as forward declarations - InnerStruct1* getInnerStruct1() { return 0; } - InnerClass1* getInnerClass1() { return 0; } - InnerUnion1* getInnerUnion1() { return 0; } + InnerStruct1* makeInnerStruct1() { return 0; } + InnerClass1* makeInnerClass1() { return 0; } + InnerUnion1* makeInnerUnion1() { return 0; } + + InnerStruct2* makeInnerStruct2() { return 0; } + InnerClass2* makeInnerClass2() { return 0; } + InnerUnion2* makeInnerUnion2() { return 0; } - InnerStruct2* getInnerStruct2() { return 0; } - InnerClass2* getInnerClass2() { return 0; } - InnerUnion2* getInnerUnion2() { return 0; } + InnerStruct4Typedef* makeInnerStruct4Typedef() { return 0; } + InnerClass4Typedef* makeInnerClass4Typedef() { return 0; } + InnerUnion4Typedef* makeInnerUnion4Typedef() { return 0; } - InnerStruct4* getInnerStruct4() { return 0; } - InnerClass4* getInnerClass4() { return 0; } - InnerUnion4* getInnerUnion4() { return 0; } + InnerStruct5* makeInnerStruct5() { return 0; } + InnerClass5* makeInnerClass5() { return 0; } + InnerUnion5* makeInnerUnion5() { return 0; } + + InnerStruct5Typedef* makeInnerStruct5Typedef() { return 0; } + InnerClass5Typedef* makeInnerClass5Typedef() { return 0; } + InnerUnion5Typedef* makeInnerUnion5Typedef() { return 0; } /////////////////////////////////////////// struct InnerMultiple { Integer x; - } MultipleInstance1, MultipleInstance2; + } MultipleInstance1, MultipleInstance2, *MultipleInstance3, MultipleInstance4[2]; + + struct InnerMultipleDerived : public InnerMultiple { + Integer xx; + } MultipleDerivedInstance1, MultipleDerivedInstance2, *MultipleDerivedInstance3, MultipleDerivedInstance4[2]; + + struct { + Integer x; + } MultipleInstanceAnon1, MultipleInstanceAnon2, *MultipleInstanceAnon3, MultipleInstanceAnon4[2]; + + struct : public InnerMultiple { + Integer xx; + } MultipleInstanceAnonDerived1, MultipleInstanceAnonDerived2, *MultipleInstanceAnonDerived3, MultipleInstanceAnonDerived4[2]; + + struct : public InnerMultiple { + Integer xx; + }; + + class : public InnerMultiple { + public: + Integer yy; + }; + + /////////////////////////////////////////// + typedef struct { + Integer x; + } InnerMultipleAnonTypedef1, InnerMultipleAnonTypedef2, *InnerMultipleAnonTypedef3; + + InnerMultipleAnonTypedef1* makeInnerMultipleAnonTypedef1() { return 0; } + InnerMultipleAnonTypedef2* makeInnerMultipleAnonTypedef2() { return 0; } + InnerMultipleAnonTypedef3* makeInnerMultipleAnonTypedef3() { return 0; } + + typedef struct InnerMultipleNamedTypedef { + Integer x; + } InnerMultipleNamedTypedef1, InnerMultipleNamedTypedef2, *InnerMultipleNamedTypedef3; + + InnerMultipleNamedTypedef* makeInnerMultipleNamedTypedef() { return 0; } + InnerMultipleNamedTypedef1* makeInnerMultipleNamedTypedef1() { return 0; } + InnerMultipleNamedTypedef2* makeInnerMultipleNamedTypedef2() { return 0; } + InnerMultipleNamedTypedef3* makeInnerMultipleNamedTypedef3() { return 0; } + + /////////////////////////////////////////// + typedef struct InnerSameName { + Integer x; + } InnerSameName; + + InnerSameName* makeInnerSameName() { return 0; } }; +%} +// Ignore nested struct instance +%ignore Outer2::IgnoreMeInstance; +%{ +struct Outer2 { + struct IgnoreMe { + int xx; + }; +}; %} + +struct Outer2 { + struct IgnoreMe { + int xx; + } IgnoreMeInstance; +}; + + |