Closes #89 Squash merge branch 'master' of https://github.com/wkalinin/swig into wkalinin-nested By Vladimir Kalinin * 'master' of https://github.com/wkalinin/swig: CPlusPlusOut mode for Octave nested class illustration fixed "Abstract" flag for nested classes added an example enabled anonymous nested structs runtime test porting warnings disabled porting fixes java runtime tests ported nested class closing bracket offset fixed removed double nested template (not supported by %template parsing) template_nested test extended parent field made public property access fixed replaced tabs with spaces warning W-reorder deprecated warnings removed, derived_nested runtime test added optimized string indenting Nested classes indenting nested classes docs fixed the order in which flattened inner classes are added after the outer Private nested classes were getting into the type table. Java getProxyName() fix for nested classes fixes the case when nested classes is forward declared Fix for a case when a nested class inherits from the same base as the outer. (Base class constructor declaration is found first in this case) merge fix nested C struct first immediate declaration incorrectly renamed sample fixed tests updated to reflect nested classes support Java nested classes support (1) flattening should remove the link to the outer class access mode correctly set/restored for nested classes nested templates should be skipped while flattening (template nodes themselves, not expanded versions) also non-public nested classes should be ignored If nested classes are not supported, default behaviour is flattening, not ignoring flag "nested" is preserved, so, the nested classes can be ignored by user nested workaround test updated template instantiated within a class is marked as nested for ignoring purposes %ignore not applied to the nested classed, because "nested" flag is set too late typedef name takes precedence over the real name (reason?) unnamed structs should be processed for all the languages nested C struct instances are wrapped as "immutable" tree building typedef declaration for unnamed C structures fixed nested classes "flattening" fixed %ignoring nested classes renamed "nested" attribute to "nested:outer" added "nested" flag, to be used with $ignore (it is not removed while flattening) added nestedClassesSupported() function to the Language interface renamed "nested" attribute to "nested:outer" added "nested" flag, to be used with $ignore (it is not removed while flattening) added nestedClassesSupported() function to the Language interface tree iteration fix dirclassname variable names unified memory issue fixed merge error ignore unnamed structs for C++ unnamed nested C structs naming & unnesting class added to classes hash under typedef name private nested classes skipped test updated due to nested templates support anonymous structs with inheritance fixed nested_class test to allow anonymous structs w/o declarator tests updated: nested workaround removed from namespace_class.i propagated nested template declaration to the C++ file injected members scope nested tempplates fixes, nested structures in "C" mode parsing added utility function "appendSibling" (like "appendChild") nested unnamed structures parsing fixes, access mode restored on nested class end, tdname is properly patched with outer class name prefix memory management fixes nested templates (1) Nested unnamed structs Nested class support (1) Nested class support (1)
72 lines
2.8 KiB
Java
72 lines
2.8 KiB
Java
|
|
import nested_class.*;
|
|
|
|
public class nested_class_runme {
|
|
|
|
static {
|
|
try {
|
|
System.loadLibrary("nested_class");
|
|
} catch (UnsatisfiedLinkError e) {
|
|
System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e);
|
|
System.exit(1);
|
|
}
|
|
}
|
|
|
|
public static void main(String argv[]) {
|
|
Outer outer = new Outer();
|
|
Outer.InnerStruct1 is1 = outer.makeInnerStruct1();
|
|
Outer.InnerClass1 ic1 = outer.makeInnerClass1();
|
|
Outer.InnerUnion1 iu1 = outer.makeInnerUnion1();
|
|
|
|
Outer.InnerStruct2 is2 = outer.makeInnerStruct2();
|
|
Outer.InnerClass2 ic2 = outer.makeInnerClass2();
|
|
Outer.InnerUnion2 iu2 = outer.makeInnerUnion2();
|
|
|
|
Outer.InnerClass4Typedef ic4 = outer.makeInnerClass4Typedef();
|
|
Outer.InnerStruct4Typedef is4 = outer.makeInnerStruct4Typedef();
|
|
Outer.InnerUnion4Typedef iu4 = outer.makeInnerUnion4Typedef();
|
|
|
|
Outer.InnerClass5Typedef ic5 = outer.makeInnerClass5();
|
|
Outer.InnerStruct5Typedef is5 = outer.makeInnerStruct5();
|
|
Outer.InnerUnion5Typedef iu5 = outer.makeInnerUnion5();
|
|
|
|
ic5 = outer.makeInnerClass5Typedef();
|
|
is5 = outer.makeInnerStruct5Typedef();
|
|
iu5 = outer.makeInnerUnion5Typedef();
|
|
|
|
{
|
|
Outer.InnerMultiple im1 = outer.getMultipleInstance1();
|
|
Outer.InnerMultiple im2 = outer.getMultipleInstance2();
|
|
Outer.InnerMultiple im3 = outer.getMultipleInstance3();
|
|
Outer.InnerMultiple im4 = outer.getMultipleInstance4();
|
|
}
|
|
|
|
{
|
|
Outer.InnerMultipleDerived im1 = outer.getMultipleDerivedInstance1();
|
|
Outer.InnerMultipleDerived im2 = outer.getMultipleDerivedInstance2();
|
|
Outer.InnerMultipleDerived im3 = outer.getMultipleDerivedInstance3();
|
|
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();
|
|
}
|
|
|
|
{
|
|
Outer.InnerMultipleAnonTypedef1 mat1 = outer.makeInnerMultipleAnonTypedef1();
|
|
Outer.InnerMultipleAnonTypedef1 mat2 = outer.makeInnerMultipleAnonTypedef2();
|
|
SWIGTYPE_p_p_Outer__InnerMultipleAnonTypedef1 mat3 = outer.makeInnerMultipleAnonTypedef3();
|
|
|
|
Outer.InnerMultipleNamedTypedef1 mnt = outer.makeInnerMultipleNamedTypedef();
|
|
Outer.InnerMultipleNamedTypedef1 mnt1 = outer.makeInnerMultipleNamedTypedef1();
|
|
Outer.InnerMultipleNamedTypedef1 mnt2 = outer.makeInnerMultipleNamedTypedef2();
|
|
SWIGTYPE_p_p_Outer__InnerMultipleNamedTypedef mnt3 = outer.makeInnerMultipleNamedTypedef3();
|
|
}
|
|
{
|
|
Outer.InnerSameName isn = outer.makeInnerSameName();
|
|
}
|
|
}
|
|
}
|