Browse Source

Fixed more declarations to define their members at global scope.

pull/232/head
triton 12 years ago
parent
commit
cf9df7330e
  1. 22
      tests/Basic/Basic.h
  2. 16
      tests/CSharpTemp/CSharpTemp.h

22
tests/Basic/Basic.h

@ -339,14 +339,17 @@ typedef unsigned long foo_t;
typedef struct DLL_API SomeStruct typedef struct DLL_API SomeStruct
{ {
SomeStruct(); SomeStruct();
foo_t& operator[](int i) { return p; } foo_t& operator[](int i);
// CSharp backend can't deal with a setter here // CSharp backend can't deal with a setter here
foo_t operator[](const char* name) { return p; } foo_t operator[](const char* name);
foo_t p; foo_t p;
} SomeStruct; } SomeStruct;
SomeStruct::SomeStruct() : p(1) {} SomeStruct::SomeStruct() : p(1) {}
foo_t& SomeStruct::operator[](int i) { return p; }
foo_t SomeStruct::operator[](const char* name) { return p; }
class DLL_API SomeClassExtendingTheStruct : public SomeStruct class DLL_API SomeClassExtendingTheStruct : public SomeStruct
{ {
}; };
@ -366,12 +369,15 @@ class DLL_API ClassWithOverloadedOperators
public: public:
ClassWithOverloadedOperators(); ClassWithOverloadedOperators();
operator char() { return 1; } operator char();
operator int() { return 2; } operator int();
operator short() { return 3; } operator short();
}; };
ClassWithOverloadedOperators::ClassWithOverloadedOperators() {} ClassWithOverloadedOperators::ClassWithOverloadedOperators() {}
ClassWithOverloadedOperators::operator char() { return 1; }
ClassWithOverloadedOperators::operator int() { return 2; }
ClassWithOverloadedOperators::operator short() { return 3; }
// Tests global static function generation // Tests global static function generation
DLL_API int Function() DLL_API int Function()
@ -385,11 +391,13 @@ struct DLL_API TestProperties
TestProperties(); TestProperties();
int Field; int Field;
int getFieldValue() { return Field; } int getFieldValue();
void setFieldValue(int Value) { Field = Value; } void setFieldValue(int Value);
}; };
TestProperties::TestProperties() : Field(0) {} TestProperties::TestProperties() : Field(0) {}
int TestProperties::getFieldValue() { return Field; }
void TestProperties::setFieldValue(int Value) { Field = Value; }
enum struct MyEnum { A, B, C }; enum struct MyEnum { A, B, C };

16
tests/CSharpTemp/CSharpTemp.h

@ -27,6 +27,7 @@ public:
class DLL_API Bar : public Qux class DLL_API Bar : public Qux
{ {
public: public:
Bar();
int method(); int method();
const Foo& operator[](int i) const; const Foo& operator[](int i) const;
Foo& operator[](int i); Foo& operator[](int i);
@ -41,9 +42,12 @@ private:
Foo m_foo; Foo m_foo;
}; };
Bar::Bar() {}
class DLL_API Baz : public Foo, public Bar class DLL_API Baz : public Foo, public Bar
{ {
public: public:
Baz();
int takesQux(const Qux& qux); int takesQux(const Qux& qux);
Qux returnQux(); Qux returnQux();
@ -52,6 +56,8 @@ public:
FunctionTypedef functionTypedef; FunctionTypedef functionTypedef;
}; };
Baz::Baz() {}
struct QArrayData struct QArrayData
{ {
}; };
@ -82,11 +88,14 @@ protected:
class DLL_API Proprietor : public AbstractProprietor class DLL_API Proprietor : public AbstractProprietor
{ {
public: public:
Proprietor();
virtual void setValue(int value); virtual void setValue(int value);
virtual long prop(); virtual long prop();
}; };
Proprietor::Proprietor() {}
template <typename T> template <typename T>
class QFlags class QFlags
{ {
@ -131,10 +140,13 @@ struct DLL_API TestDestructors
{ {
static int Marker; static int Marker;
TestDestructors() { Marker = 0xf00d; } TestDestructors();
~TestDestructors() { Marker = 0xcafe; } ~TestDestructors();
}; };
TestDestructors::TestDestructors() { Marker = 0xf00d; }
TestDestructors::~TestDestructors() { Marker = 0xcafe; }
class DLL_API TestCopyConstructorVal class DLL_API TestCopyConstructorVal
{ {
public: public:

Loading…
Cancel
Save