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)
297 lines
4.2 KiB
OpenEdge ABL
297 lines
4.2 KiB
OpenEdge ABL
%module namespace_class
|
|
|
|
|
|
#ifdef SWIGD
|
|
%warnfilter(SWIGWARN_IGNORE_OPERATOR_LT);
|
|
#endif
|
|
|
|
%inline %{
|
|
template<class T> void foobar(T t) {}
|
|
namespace test {
|
|
template<class T> void barfoo(T t) {}
|
|
}
|
|
%}
|
|
|
|
%template(FooBarInt) ::foobar<int>;
|
|
%template(BarFooInt) test::barfoo<int>;
|
|
|
|
|
|
%inline %{
|
|
template <class C>
|
|
struct Bar_T
|
|
{
|
|
};
|
|
|
|
|
|
|
|
namespace test {
|
|
enum Hello {
|
|
Hi
|
|
};
|
|
|
|
struct Test;
|
|
|
|
struct Bar {
|
|
Hello foo(Hello h) {
|
|
return h;
|
|
}
|
|
};
|
|
|
|
namespace hola {
|
|
struct Bor;
|
|
struct Foo;
|
|
struct Foobar;
|
|
template <class T> struct BarT {
|
|
};
|
|
|
|
template <class T> class FooT;
|
|
}
|
|
|
|
template <class T>
|
|
class hola::FooT {
|
|
public:
|
|
Hello foo(Hello h) {
|
|
return h;
|
|
}
|
|
|
|
T bar(T h) {
|
|
return h;
|
|
}
|
|
};
|
|
|
|
namespace hola {
|
|
template <> class FooT<double>;
|
|
template <> class FooT<int>;
|
|
}
|
|
|
|
template <>
|
|
class hola::FooT<double> {
|
|
public:
|
|
double moo(double h) {
|
|
return h;
|
|
}
|
|
};
|
|
|
|
int a;
|
|
|
|
struct hola::Foo : Bar {
|
|
Hello bar(Hello h) {
|
|
return h;
|
|
}
|
|
};
|
|
}
|
|
|
|
struct test::Test {
|
|
Hello foo(Hello h) {
|
|
return h;
|
|
}
|
|
};
|
|
|
|
struct test::hola::Bor {
|
|
Hello foo(Hello h) {
|
|
return h;
|
|
}
|
|
};
|
|
|
|
namespace test {
|
|
struct hola::Foobar : Bar {
|
|
Hello bar(Hello h) {
|
|
return h;
|
|
}
|
|
};
|
|
}
|
|
|
|
template <>
|
|
class test::hola::FooT<int> {
|
|
public:
|
|
int quack(int h) {
|
|
return h;
|
|
}
|
|
};
|
|
|
|
%}
|
|
|
|
|
|
namespace test
|
|
{
|
|
namespace hola {
|
|
%template(FooT_i) FooT<int>;
|
|
}
|
|
|
|
%template(FooT_H) hola::FooT<Hello>;
|
|
}
|
|
|
|
%template(FooT_d) ::test::hola::FooT<double>;
|
|
%template(BarT_H) test::hola::BarT<test::Hello>;
|
|
|
|
%inline %{
|
|
|
|
namespace hi {
|
|
namespace hello {
|
|
template <class T> struct PooT;
|
|
}
|
|
|
|
namespace hello {
|
|
template <class T> struct PooT
|
|
{
|
|
};
|
|
}
|
|
}
|
|
%}
|
|
|
|
%template(Poo_i) hi::hello::PooT<int>;
|
|
|
|
%inline %{
|
|
|
|
template <class T> struct BooT {
|
|
};
|
|
|
|
namespace test {
|
|
|
|
typedef ::BooT<Hello> BooT_H;
|
|
}
|
|
|
|
%}
|
|
|
|
namespace test {
|
|
|
|
%template(BooT_H) ::BooT<Hello>;
|
|
}
|
|
%template(BooT_i) ::BooT<int>;
|
|
|
|
|
|
%inline %{
|
|
|
|
namespace jafar {
|
|
namespace jmath {
|
|
class EulerT3D {
|
|
public:
|
|
static void hello(){}
|
|
|
|
template<class VecFrame, class Vec, class VecRes>
|
|
static void toFrame(const VecFrame& frame_, const Vec&v_,const VecRes& vRes){}
|
|
|
|
template<class T>
|
|
void operator ()(T& x){}
|
|
|
|
template<class T>
|
|
void operator < (T& x){}
|
|
|
|
template<class T>
|
|
operator Bar_T<T> () {}
|
|
|
|
};
|
|
}
|
|
}
|
|
%}
|
|
|
|
%template(toFrame) jafar::jmath::EulerT3D::toFrame<int,int,int>;
|
|
%template(callint) jafar::jmath::EulerT3D::operator()<int>;
|
|
%template(lessint) jafar::jmath::EulerT3D::operator < <int>;
|
|
%template(callfooi) jafar::jmath::EulerT3D::operator() <test::hola::FooT<int> >;
|
|
%template(lessfooi) jafar::jmath::EulerT3D::operator < < test::hola::FooT<int> >;
|
|
|
|
|
|
%inline %{
|
|
|
|
namespace {
|
|
/* the unnamed namespace is 'private', so, the following
|
|
declarations shouldn't be wrapped */
|
|
class Private1
|
|
{
|
|
};
|
|
|
|
}
|
|
|
|
namespace a
|
|
{
|
|
namespace
|
|
{
|
|
class Private2
|
|
{
|
|
};
|
|
}
|
|
}
|
|
|
|
%}
|
|
|
|
%inline %{
|
|
class Ala {
|
|
public :
|
|
Ala() {}
|
|
class Ola {
|
|
public:
|
|
Ola() {}
|
|
void eek() {}
|
|
};
|
|
|
|
template <class T>
|
|
static void hi()
|
|
{
|
|
}
|
|
};
|
|
%}
|
|
|
|
|
|
%template(hi) Ala::hi<int>;
|
|
|
|
%extend jafar::jmath::EulerT3D
|
|
{
|
|
|
|
}
|
|
|
|
%rename(FLACFile) TagLib::FLAC::File;
|
|
|
|
%inline {
|
|
namespace TagLib
|
|
{
|
|
class File {
|
|
public:
|
|
File() {}
|
|
};
|
|
|
|
class AudioProperties {
|
|
};
|
|
|
|
class AudioPropertiesFile {
|
|
public:
|
|
typedef TagLib::File File;
|
|
};
|
|
|
|
namespace FLAC
|
|
{
|
|
class File;
|
|
class Properties : public AudioProperties {
|
|
public:
|
|
Properties(File *) {}
|
|
};
|
|
|
|
class PropertiesFile : public AudioPropertiesFile {
|
|
public:
|
|
PropertiesFile(File * = 0) {}
|
|
};
|
|
|
|
namespace bar {
|
|
class PropertiesFree : public AudioProperties {
|
|
public:
|
|
PropertiesFree(File *) {}
|
|
};
|
|
}
|
|
|
|
class FooFilePrivate : private PropertiesFile {
|
|
public:
|
|
FooFilePrivate(File *) {}
|
|
};
|
|
|
|
class FooFile : public PropertiesFile {
|
|
public:
|
|
FooFile(File *) {}
|
|
};
|
|
|
|
class File {
|
|
public:
|
|
File() {}
|
|
};
|
|
}
|
|
}
|
|
}
|