simple formatting changes
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2009-matevz@12154 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
8e779193bf
commit
c3b48505e2
26 changed files with 134 additions and 134 deletions
|
|
@ -1,4 +1,4 @@
|
|||
/* This testcase checks whether Swig correctly uses the new alternate functions
|
||||
/* This testcase checks whether SWIG correctly uses the new alternate functions
|
||||
declarations and definitions introduced in C++0x. */
|
||||
%module cpp0x_alternate_function_syntax
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* This interface tests whether Swig supports the new "constexpr" keyword
|
||||
/* This interface tests whether SWIG supports the new "constexpr" keyword
|
||||
introduced by C++0x.
|
||||
*/
|
||||
%module cpp0x_constexpr
|
||||
|
|
@ -6,7 +6,7 @@
|
|||
%inline %{
|
||||
class TestClass {
|
||||
public:
|
||||
constexpr int func() { return 10; }
|
||||
constexpr int func() { return 10; }
|
||||
};
|
||||
%}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* This test checks whether Swig correctly parses the new delegating
|
||||
/* This test checks whether SWIG correctly parses the new delegating
|
||||
constructors and constructor inheritance.
|
||||
*/
|
||||
%module cpp0x_constructors
|
||||
|
|
@ -6,25 +6,25 @@
|
|||
%inline %{
|
||||
class BaseClass {
|
||||
private:
|
||||
int _val;
|
||||
int _val;
|
||||
public:
|
||||
BaseClass(int iValue) { _val = iValue; }
|
||||
BaseClass(int iValue) { _val = iValue; }
|
||||
};
|
||||
|
||||
class DerivedClass: public BaseClass {
|
||||
public:
|
||||
using BaseClass::BaseClass; // Adds DerivedClass(int) constructor
|
||||
using BaseClass::BaseClass; // Adds DerivedClass(int) constructor
|
||||
};
|
||||
|
||||
class A {
|
||||
public:
|
||||
int a;
|
||||
int b;
|
||||
int c;
|
||||
|
||||
A() : A( 10 ) {}
|
||||
A(int aa) : A(aa, 20) {}
|
||||
A(int aa, int bb) : A(aa, bb, 30) {}
|
||||
A(int aa, int bb, int cc) { a=aa; b=bb; c=cc; }
|
||||
int a;
|
||||
int b;
|
||||
int c;
|
||||
|
||||
A() : A( 10 ) {}
|
||||
A(int aa) : A(aa, 20) {}
|
||||
A(int aa, int bb) : A(aa, bb, 30) {}
|
||||
A(int aa, int bb, int cc) { a=aa; b=bb; c=cc; }
|
||||
};
|
||||
%}
|
||||
|
|
|
|||
|
|
@ -1,19 +1,19 @@
|
|||
/* This testcase checks whether Swig correctly uses the new 'decltype()'
|
||||
/* This testcase checks whether SWIG correctly uses the new 'decltype()'
|
||||
introduced in C++0x.
|
||||
*/
|
||||
%module cpp0x_decltype
|
||||
|
||||
%inline %{
|
||||
class A {
|
||||
public:
|
||||
int i;
|
||||
decltype(i) j;
|
||||
|
||||
auto foo( decltype(i) a ) -> decltype(i) {
|
||||
if (a==5)
|
||||
return 10;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
%}
|
||||
class A {
|
||||
public:
|
||||
int i;
|
||||
decltype(i) j;
|
||||
|
||||
auto foo( decltype(i) a ) -> decltype(i) {
|
||||
if (a==5)
|
||||
return 10;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
%}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* This testcase checks whether Swig correctly parses the default and delete
|
||||
/* This testcase checks whether SWIG correctly parses the default and delete
|
||||
keywords which keep or remove default C++ object construction functions. */
|
||||
%module cpp0x_default_delete
|
||||
|
||||
|
|
@ -14,11 +14,11 @@ public:
|
|||
};
|
||||
|
||||
struct A1 {
|
||||
void f(int i);
|
||||
void f(double i) = delete; /* Don't cast double to int. Compiler returns an error */
|
||||
void f(int i);
|
||||
void f(double i) = delete; /* Don't cast double to int. Compiler returns an error */
|
||||
};
|
||||
struct A2 {
|
||||
void f(int i);
|
||||
template<class T> void f(T) = delete; /* Only accept int */
|
||||
void f(int i);
|
||||
template<class T> void f(T) = delete; /* Only accept int */
|
||||
};
|
||||
%}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* This interface checks whether Swig correctly compiles the new
|
||||
/* This interface checks whether SWIG correctly compiles the new
|
||||
explicit conversion operators feature introduced in C++0x.
|
||||
*/
|
||||
%module cpp0x_explicit_conversion_operators
|
||||
|
|
@ -7,22 +7,22 @@
|
|||
|
||||
class U {
|
||||
public:
|
||||
int u;
|
||||
int u;
|
||||
};
|
||||
|
||||
class V {
|
||||
public:
|
||||
int v;
|
||||
int v;
|
||||
};
|
||||
|
||||
class TestClass {
|
||||
public:
|
||||
//implicit converting constructor
|
||||
TestClass( U const &val ) { t=val.u; }
|
||||
// explicit constructor
|
||||
explicit TestClass( V const &val ) { t=val.v; }
|
||||
|
||||
int t;
|
||||
//implicit converting constructor
|
||||
TestClass( U const &val ) { t=val.u; }
|
||||
// explicit constructor
|
||||
explicit TestClass( V const &val ) { t=val.v; }
|
||||
|
||||
int t;
|
||||
};
|
||||
%}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* This testcase checks whether Swig correctly parses function objects
|
||||
/* This testcase checks whether SWIG correctly parses function objects
|
||||
and the templates for the functions (signature).
|
||||
Function objects are objects which overload the operator() function. */
|
||||
%module cpp0x_function_objects
|
||||
|
|
|
|||
|
|
@ -23,21 +23,21 @@ using namespace std;
|
|||
|
||||
class MyClass {
|
||||
public:
|
||||
set<int> getSet() { return _set; }
|
||||
void addSet(int elt) { _set.insert(_set.begin(), elt); }
|
||||
// map<int, int> getMap() { return _map; }
|
||||
// void addMap(int elt1, int elt2) { _map.insert(make_pair(elt1, elt2)); }
|
||||
set<int> getSet() { return _set; }
|
||||
void addSet(int elt) { _set.insert(_set.begin(), elt); }
|
||||
// map<int, int> getMap() { return _map; }
|
||||
// void addMap(int elt1, int elt2) { _map.insert(make_pair(elt1, elt2)); }
|
||||
|
||||
unordered_set<int> getUnorderedSet() { return _unordered_set; }
|
||||
void addUnorderedSet(int elt) { _unordered_set.insert(_unordered_set.begin(), elt); }
|
||||
// unordered_map<int, int> getUnorderedMap() { return _unordered_map; }
|
||||
// void addUnorderedMap(int elt1, int elt2) { _unordered_map.insert(make_pair(elt1, elt2)); }
|
||||
unordered_set<int> getUnorderedSet() { return _unordered_set; }
|
||||
void addUnorderedSet(int elt) { _unordered_set.insert(_unordered_set.begin(), elt); }
|
||||
// unordered_map<int, int> getUnorderedMap() { return _unordered_map; }
|
||||
// void addUnorderedMap(int elt1, int elt2) { _unordered_map.insert(make_pair(elt1, elt2)); }
|
||||
private:
|
||||
set<int> _set;
|
||||
// map<int, int> _map;
|
||||
set<int> _set;
|
||||
// map<int, int> _map;
|
||||
|
||||
unordered_set<int> _unordered_set;
|
||||
// unordered_map<int, int> _unordered_map;
|
||||
unordered_set<int> _unordered_set;
|
||||
// unordered_map<int, int> _unordered_map;
|
||||
};
|
||||
%}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* This testcase checks whether Swig correctly uses the new initializer_list
|
||||
/* This testcase checks whether SWIG correctly uses the new initializer_list
|
||||
introduced in C++0x. */
|
||||
%module cpp0x_initializer_list
|
||||
%warnfilter(520) A;
|
||||
|
|
@ -8,8 +8,8 @@
|
|||
|
||||
class A {
|
||||
public:
|
||||
A( std::initializer_list<int> ) {}
|
||||
A() {}
|
||||
A( std::initializer_list<int> ) {}
|
||||
A() {}
|
||||
};
|
||||
%}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,34 +1,34 @@
|
|||
/* This testcase checks whether Swig correctly parses the lambda expressions
|
||||
/* This testcase checks whether SWIG correctly parses the lambda expressions
|
||||
and closure syntax introduced in C++0x.
|
||||
Swig supports only lambda syntax and doesn't produce any wrapper code for
|
||||
SWIG supports only lambda syntax and doesn't produce any wrapper code for
|
||||
this.
|
||||
*/
|
||||
%module cpp0x_lambda_functions
|
||||
|
||||
%inline %{
|
||||
struct A {
|
||||
/* Defined lambda function with return value. */
|
||||
auto lambda1 = [](int x, int y) -> int { return x+y; };
|
||||
|
||||
/* Defined lambda function without return value.
|
||||
Return value is calculated by compiler, if the function contains a
|
||||
single statement "return expr;". */
|
||||
auto lambda2 = [](int x, int y) { return x+y; };
|
||||
/* Defined lambda function with return value. */
|
||||
auto lambda1 = [](int x, int y) -> int { return x+y; };
|
||||
|
||||
/* Defined lambda function without return value.
|
||||
Return value is calculated by compiler, if the function contains a
|
||||
single statement "return expr;". */
|
||||
auto lambda2 = [](int x, int y) { return x+y; };
|
||||
};
|
||||
|
||||
int runLambda1() {
|
||||
A myA;
|
||||
return myA.lambda1(5,6);
|
||||
A myA;
|
||||
return myA.lambda1(5,6);
|
||||
}
|
||||
|
||||
int runLambda2() {
|
||||
A myA;
|
||||
return myA.lambda2(5,6);
|
||||
A myA;
|
||||
return myA.lambda2(5,6);
|
||||
}
|
||||
|
||||
/* Inline defined lambda function. */
|
||||
int runLambda3() {
|
||||
auto myLambda = [](int x, int y) { return x+y; };
|
||||
return myLambda(5,6);
|
||||
auto myLambda = [](int x, int y) { return x+y; };
|
||||
return myLambda(5,6);
|
||||
}
|
||||
%}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* This testcase checks whether Swig correctly treats the new nullptr_t
|
||||
/* This testcase checks whether SWIG correctly treats the new nullptr_t
|
||||
constant introduced in C++0x.
|
||||
*/
|
||||
|
||||
|
|
@ -9,8 +9,8 @@
|
|||
|
||||
class A {
|
||||
public:
|
||||
A() : _myA(std::nullptr) { }
|
||||
|
||||
A *_myA;
|
||||
A() : _myA(std::nullptr) { }
|
||||
|
||||
A *_myA;
|
||||
};
|
||||
%}
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
/* This module tests whether Swig correctly parses:
|
||||
/* This module tests whether SWIG correctly parses:
|
||||
- ordinary strings (char_t)
|
||||
- L wide strings (wchar_t)
|
||||
- u8 unicode8 strings (char_t)
|
||||
- u unicode16 strings (char16_t)
|
||||
- U unicode32 strings (char32_t)
|
||||
|
||||
This module also tests whether Swig correctly parses custom string delimiters.
|
||||
This module also tests whether SWIG correctly parses custom string delimiters.
|
||||
*/
|
||||
%module cpp0x_raw_string_literals
|
||||
%warnfilter(SWIGWARN_TYPEMAP_CHARLEAK_MSG) bb;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* This testcase checks whether Swig correctly uses the new result_of class
|
||||
/* This testcase checks whether SWIG correctly uses the new result_of class
|
||||
and its templating capabilities introduced in C++0x. */
|
||||
%module cpp0x_result_of
|
||||
|
||||
|
|
@ -7,12 +7,12 @@
|
|||
#include <iostream>
|
||||
|
||||
double square(double x) {
|
||||
return (x * x);
|
||||
return (x * x);
|
||||
}
|
||||
|
||||
template<class Fun, class Arg>
|
||||
typename std::result_of<Fun(Arg)>::type test_result_impl(Fun fun, Arg arg) {
|
||||
return fun(arg);
|
||||
return fun(arg);
|
||||
}
|
||||
%}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,21 +1,21 @@
|
|||
/* This testcase checks whether Swig correctly parses the double ampersand &&
|
||||
/* This testcase checks whether SWIG correctly parses the double ampersand &&
|
||||
move operator which is currently mapped to the reference & operator. */
|
||||
%module cpp0x_rvalue_reference
|
||||
|
||||
%inline %{
|
||||
class A {
|
||||
public:
|
||||
int getAcopy() { return _a; }
|
||||
int *getAptr() { return &_a; }
|
||||
int &getAref() { return _a; }
|
||||
int &&getAmove() { return _a; }
|
||||
int getAcopy() { return _a; }
|
||||
int *getAptr() { return &_a; }
|
||||
int &getAref() { return _a; }
|
||||
int &&getAmove() { return _a; }
|
||||
|
||||
void setAcopy(int a) { _a = a; }
|
||||
void setAptr(int *a) { _a = *a; }
|
||||
void setAref(int &a) { _a = a; }
|
||||
void setAmove(int &&a) { _a = a; }
|
||||
void setAcopy(int a) { _a = a; }
|
||||
void setAptr(int *a) { _a = *a; }
|
||||
void setAref(int &a) { _a = a; }
|
||||
void setAmove(int &&a) { _a = a; }
|
||||
|
||||
private:
|
||||
int _a;
|
||||
int _a;
|
||||
};
|
||||
%}
|
||||
|
|
|
|||
|
|
@ -1,16 +1,16 @@
|
|||
/* This testcase checks whether Swig correctly uses the sizeof() on the
|
||||
/* This testcase checks whether SWIG correctly uses the sizeof() on the
|
||||
concrete objects and not only types introduced in C++0x. */
|
||||
%module cpp0x_sizeof_object
|
||||
|
||||
%inline %{
|
||||
struct B {
|
||||
unsigned long member1;
|
||||
long long member2;
|
||||
char member3;
|
||||
unsigned long member1;
|
||||
long long member2;
|
||||
char member3;
|
||||
};
|
||||
|
||||
struct A {
|
||||
B member;
|
||||
B member;
|
||||
};
|
||||
|
||||
const int a = sizeof(A::member);
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* This testcase checks whether Swig correctly uses the new general-purpose
|
||||
/* This testcase checks whether SWIG correctly uses the new general-purpose
|
||||
smart pointers introduced in C++0x:
|
||||
- shared_ptr
|
||||
- weak_ptr
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* This test case checks whether swig correctly parses and ignores the
|
||||
/* This test case checks whether SWIG correctly parses and ignores the
|
||||
keywords "static_assert()" inside the class or struct.
|
||||
*/
|
||||
%module cpp0x_static_assert
|
||||
|
|
@ -6,12 +6,12 @@
|
|||
%inline %{
|
||||
template <typename T>
|
||||
struct Check1 {
|
||||
static_assert(sizeof(int) <= sizeof(T), "not big enough");
|
||||
static_assert(sizeof(int) <= sizeof(T), "not big enough");
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
class Check2 {
|
||||
static_assert(sizeof(int) <= sizeof(T), "not big enough");
|
||||
static_assert(sizeof(int) <= sizeof(T), "not big enough");
|
||||
};
|
||||
%}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* This testcase checks whether Swig produces the correct wrapper for the
|
||||
/* This testcase checks whether SWIG produces the correct wrapper for the
|
||||
strongly typed enums. Enums with the same type are comparable. Enum classes
|
||||
require support for nested classes. */
|
||||
%module cpp0x_strongly_typed_enumerations
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* This interface checks whether Swig supports the new double angled brackets
|
||||
/* This interface checks whether SWIG supports the new double angled brackets
|
||||
in the template syntax without having a space inbetween. This feature was
|
||||
introduced in new C++0x standard.
|
||||
*/
|
||||
|
|
@ -10,21 +10,21 @@ std::map< int,std::map<int, double> > n;
|
|||
|
||||
class ABC {
|
||||
public:
|
||||
int a;
|
||||
int operator>>(ABC &);
|
||||
int operator<<(ABC &);
|
||||
int a;
|
||||
int operator>>(ABC &);
|
||||
int operator<<(ABC &);
|
||||
};
|
||||
|
||||
template<class T>
|
||||
class ABC2 {
|
||||
public:
|
||||
int a;
|
||||
int a;
|
||||
|
||||
template<typename U>
|
||||
U operator>>(ABC &);
|
||||
template<typename U>
|
||||
U operator>>(ABC &);
|
||||
|
||||
template<typename U>
|
||||
U operator<<(ABC &);
|
||||
template<typename U>
|
||||
U operator<<(ABC &);
|
||||
};
|
||||
%}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* This unit tests whether Swig correctly parses the code and makes wrappers
|
||||
/* This unit tests whether SWIG correctly parses the code and makes wrappers
|
||||
for the new C++0x extern templates (explicit template instantiation without
|
||||
using the translation unit).
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -1,12 +1,12 @@
|
|||
/* This testcase checks whether Swig correctly parses the template aliasing. */
|
||||
/* This testcase checks whether SWIG correctly parses the template aliasing. */
|
||||
%module cpp0x_template_typedefs
|
||||
|
||||
%inline %{
|
||||
template< typename T1, typename T2, int >
|
||||
class SomeType {
|
||||
T1 a;
|
||||
T2 b;
|
||||
int c;
|
||||
T1 a;
|
||||
T2 b;
|
||||
int c;
|
||||
};
|
||||
|
||||
template< typename T2 >
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
/* This testcase checks whether Swig correctly parses the 'thread_local'
|
||||
/* This testcase checks whether SWIG correctly parses the 'thread_local'
|
||||
keyword before the member type and name. */
|
||||
|
||||
%module cpp0x_thread_local
|
||||
|
||||
%inline %{
|
||||
struct A {
|
||||
thread_local int val;
|
||||
thread_local int val;
|
||||
};
|
||||
%}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* This testcase checks whether Swig syntactically correctly parses the curly
|
||||
/* This testcase checks whether SWIG syntactically correctly parses the curly
|
||||
brackets {} for uniform member initialization. */
|
||||
%module cpp0x_uniform_initialization
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* This testcase checks whether Swig correctly parses the support for types
|
||||
/* This testcase checks whether SWIG correctly parses the support for types
|
||||
without the defined trivial constructor in the unions. */
|
||||
%module cpp0x_unrestricted_unions
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* This testcase checks whether Swig correctly parses the user-defined literals
|
||||
/* This testcase checks whether SWIG correctly parses the user-defined literals
|
||||
for the string introduced in C++0x. */
|
||||
%module cpp0x_userdefined_literals
|
||||
|
||||
|
|
@ -6,9 +6,9 @@
|
|||
#include <iostream>
|
||||
|
||||
struct OutputType {
|
||||
int val;
|
||||
int val;
|
||||
|
||||
OutputType(int v) { v=val; }
|
||||
OutputType(int v) { v=val; }
|
||||
};
|
||||
|
||||
/* Note: GCC doesn't support user-defined literals yet! */
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* This testcase checks whether Swig correctly parses and generates the code
|
||||
/* This testcase checks whether SWIG correctly parses and generates the code
|
||||
for variadic templates. This covers the variadic number of arguments inside
|
||||
the template brackets, new functions sizeof... and multiple inheritance
|
||||
using variadic number of classes.
|
||||
|
|
@ -45,19 +45,19 @@ template<typename... Args> struct SizeOf {
|
|||
%inline %{
|
||||
class A {
|
||||
public:
|
||||
A() {
|
||||
a = 100;
|
||||
}
|
||||
|
||||
int a;
|
||||
A() {
|
||||
a = 100;
|
||||
}
|
||||
|
||||
int a;
|
||||
};
|
||||
|
||||
class B {
|
||||
public:
|
||||
B() {
|
||||
b = 200;
|
||||
}
|
||||
int b;
|
||||
B() {
|
||||
b = 200;
|
||||
}
|
||||
int b;
|
||||
};
|
||||
|
||||
template <typename... BaseClasses> class MultiInherit : public BaseClasses... {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue