mirror of https://github.com/mono/CppSharp.git
c-sharpdotnetmonobindingsbridgecclangcpluspluscppsharpglueinteropparserparsingpinvokeswigsyntax-treevisitorsxamarinxamarin-bindings
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
267 lines
3.2 KiB
267 lines
3.2 KiB
#include "Basic.h" |
|
|
|
Foo::Foo() |
|
{ |
|
auto p = new int[4]; |
|
for (int i = 0; i < 4; i++) |
|
p[i] = i; |
|
SomePointer = p; |
|
SomePointerPointer = &SomePointer; |
|
} |
|
|
|
const char* Foo::GetANSI() |
|
{ |
|
return "ANSI"; |
|
} |
|
|
|
Foo2::Foo2() {} |
|
|
|
Foo2 Foo2::operator<<(signed int i) |
|
{ |
|
Foo2 foo; |
|
foo.C = C << i; |
|
return foo; |
|
} |
|
|
|
Foo2 Foo2::operator<<(signed long l) |
|
{ |
|
Foo2 foo; |
|
foo.C = C << l; |
|
return foo; |
|
} |
|
|
|
char Foo2::testCharMarshalling(char c) |
|
{ |
|
return c; |
|
} |
|
|
|
Bar::Bar() |
|
{ |
|
} |
|
|
|
Bar::Item Bar::RetItem1() |
|
{ |
|
return Bar::Item1; |
|
} |
|
|
|
Bar* Bar::returnPointerToValueType() |
|
{ |
|
return this; |
|
} |
|
|
|
Bar2::Nested::operator int() const |
|
{ |
|
return 300; |
|
} |
|
|
|
Bar2::operator int() const |
|
{ |
|
return 500; |
|
} |
|
|
|
Bar2::operator Foo2() |
|
{ |
|
Foo2 f; |
|
f.A = A; |
|
f.B = B; |
|
f.C = C; |
|
|
|
return f; |
|
} |
|
|
|
Foo2 Bar2::needFixedInstance() const |
|
{ |
|
Foo2 f; |
|
f.A = A; |
|
f.B = B; |
|
f.C = C; |
|
|
|
return f; |
|
} |
|
|
|
Hello::Hello () |
|
{ |
|
//cout << "Ctor!" << "\n"; |
|
} |
|
|
|
Hello::Hello(const Hello& hello) |
|
{ |
|
|
|
} |
|
|
|
void Hello::PrintHello(const char* s) |
|
{ |
|
//cout << "PrintHello: " << s << "\n"; |
|
} |
|
|
|
bool Hello::test1(int i, float f) |
|
{ |
|
return i == f; |
|
} |
|
|
|
int Hello::add(int a, int b) |
|
{ |
|
return a + b; |
|
} |
|
|
|
int Hello::AddFoo(Foo foo) |
|
{ |
|
return (int)(foo.A + foo.B); |
|
} |
|
|
|
int Hello::AddFooRef(Foo& foo) |
|
{ |
|
return AddFoo(foo); |
|
} |
|
|
|
int Hello::AddFooPtr(Foo* foo) |
|
{ |
|
return AddFoo(*foo); |
|
} |
|
|
|
int Hello::AddFooPtrRef(Foo*& foo) |
|
{ |
|
return AddFoo(*foo); |
|
} |
|
|
|
int Hello::AddFoo2(Foo2 foo) |
|
{ |
|
return (int)(foo.A + foo.B + foo.C); |
|
} |
|
|
|
int Hello::AddBar(Bar bar) |
|
{ |
|
return (int)(bar.A + bar.B); |
|
} |
|
|
|
int Hello::AddBar2(Bar2 bar) |
|
{ |
|
return (int)(bar.A + bar.B + bar.C); |
|
} |
|
|
|
Foo Hello::RetFoo(int a, float b) |
|
{ |
|
Foo foo; |
|
foo.A = a; |
|
foo.B = b; |
|
return foo; |
|
} |
|
|
|
int Hello::RetEnum(Enum e) |
|
{ |
|
return (int)e; |
|
} |
|
|
|
Hello* Hello::RetNull() |
|
{ |
|
return 0; |
|
} |
|
|
|
bool Hello::TestPrimitiveOut(CS_OUT float* f) |
|
{ |
|
*f = 10; |
|
return true; |
|
} |
|
|
|
bool Hello::TestPrimitiveOutRef(CS_OUT float& f) |
|
{ |
|
f = 10; |
|
return true; |
|
} |
|
|
|
bool Hello::TestPrimitiveInOut(CS_IN_OUT int* i) |
|
{ |
|
*i += 10; |
|
return true; |
|
} |
|
|
|
bool Hello::TestPrimitiveInOutRef(CS_IN_OUT int& i) |
|
{ |
|
i += 10; |
|
return true; |
|
} |
|
|
|
void Hello::EnumOut(int value, CS_OUT Enum* e) |
|
{ |
|
*e = (Enum)value; |
|
} |
|
|
|
void Hello::EnumOutRef(int value, CS_OUT Enum& e) |
|
{ |
|
e = (Enum)value; |
|
} |
|
|
|
void Hello::EnumInOut(CS_IN_OUT Enum* e) |
|
{ |
|
if (*e == Enum::E) |
|
*e = Enum::F; |
|
} |
|
|
|
void Hello::EnumInOutRef(CS_IN_OUT Enum& e) |
|
{ |
|
if (e == Enum::E) |
|
e = Enum::F; |
|
} |
|
|
|
int unsafeFunction(const Bar& ret, char* testForString, void (*foo)(int)) |
|
{ |
|
return ret.A; |
|
} |
|
|
|
const wchar_t* wcharFunction(const wchar_t* constWideChar) |
|
{ |
|
return constWideChar; |
|
} |
|
|
|
Bar indirectReturn() |
|
{ |
|
return Bar(); |
|
} |
|
|
|
int ImplementsAbstractFoo::pureFunction(int i) |
|
{ |
|
return 5; |
|
} |
|
|
|
int ImplementsAbstractFoo::pureFunction1() |
|
{ |
|
return 10; |
|
} |
|
|
|
int ImplementsAbstractFoo::pureFunction2() |
|
{ |
|
return 15; |
|
} |
|
|
|
ReturnsAbstractFoo::ReturnsAbstractFoo() {} |
|
|
|
const AbstractFoo& ReturnsAbstractFoo::getFoo() |
|
{ |
|
return i; |
|
} |
|
|
|
void DefaultParameters::Foo(int a, int b) |
|
{ |
|
} |
|
|
|
void DefaultParameters::Foo(int a) |
|
{ |
|
} |
|
|
|
void DefaultParameters::Bar() const |
|
{ |
|
} |
|
|
|
void DefaultParameters::Bar() |
|
{ |
|
} |
|
|
|
int test(basic& s) |
|
{ |
|
return 5; |
|
} |
|
|
|
Bar::Item operator |(Bar::Item left, Bar::Item right) |
|
{ |
|
return left | right; |
|
}
|
|
|