Add testcase for bug #3378145 which was fixed in r12764
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12765 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
7d038d4bd7
commit
4511b13646
4 changed files with 77 additions and 0 deletions
|
|
@ -390,6 +390,7 @@ CPP_TEST_CASES += \
|
|||
template_typedef_cplx4 \
|
||||
template_typedef_cplx5 \
|
||||
template_typedef_funcptr \
|
||||
template_typedef_inherit \
|
||||
template_typedef_ns \
|
||||
template_typedef_ptr \
|
||||
template_typedef_rec \
|
||||
|
|
|
|||
24
Examples/test-suite/java/template_typedef_inherit_runme.java
Normal file
24
Examples/test-suite/java/template_typedef_inherit_runme.java
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
|
||||
|
||||
import template_typedef_inherit.*;
|
||||
|
||||
public class template_typedef_inherit_runme {
|
||||
|
||||
static {
|
||||
try {
|
||||
System.loadLibrary("template_typedef_inherit");
|
||||
} 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[]) {
|
||||
DescriptionImplementationTypedCollectionInterfaceObject d = new DescriptionImplementationTypedCollectionInterfaceObject();
|
||||
d.add("a string");
|
||||
|
||||
StringPersistentCollection s = new StringPersistentCollection();
|
||||
s.add("a string");
|
||||
}
|
||||
}
|
||||
|
||||
50
Examples/test-suite/template_typedef_inherit.i
Normal file
50
Examples/test-suite/template_typedef_inherit.i
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
%module template_typedef_virtual
|
||||
|
||||
// Bug 3378145
|
||||
|
||||
%include std_string.i
|
||||
|
||||
%inline %{
|
||||
#include <string> // for std::string
|
||||
|
||||
typedef std::string String;
|
||||
|
||||
namespace Type {
|
||||
template <class T> class TypedInterfaceObject {};
|
||||
|
||||
template <class T> class TypedCollectionInterfaceObject : public TypedInterfaceObject<T> {
|
||||
public:
|
||||
typedef T ImplementationType;
|
||||
typedef typename ImplementationType::ElementType ImplementationElementType;
|
||||
|
||||
/** Method add() appends an element to the collection */
|
||||
void add(const ImplementationElementType & elt) {}
|
||||
};
|
||||
|
||||
template <class T> class PersistentCollection {
|
||||
public:
|
||||
typedef T ElementType;
|
||||
|
||||
/** Method add() appends an element to the collection */
|
||||
inline virtual void add(const T & elt) {}
|
||||
};
|
||||
}
|
||||
%}
|
||||
|
||||
%template(StringPersistentCollection) Type::PersistentCollection<String>;
|
||||
|
||||
%inline %{
|
||||
|
||||
namespace Type {
|
||||
class DescriptionImplementation : public PersistentCollection<String> {
|
||||
public:
|
||||
typedef PersistentCollection<String>::ElementType ElementType;
|
||||
DescriptionImplementation() {}
|
||||
};
|
||||
}
|
||||
|
||||
%}
|
||||
|
||||
%template(DescriptionImplementationTypedInterfaceObject) Type::TypedInterfaceObject<Type::DescriptionImplementation>;
|
||||
%template(DescriptionImplementationTypedCollectionInterfaceObject) Type::TypedCollectionInterfaceObject<Type::DescriptionImplementation>;
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue