c# keyword clash

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@7870 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
William S Fulton 2005-11-26 08:39:05 +00:00
commit 79aedd92d7

View file

@ -4,17 +4,17 @@
%{ %{
namespace test { namespace test {
/* A minimalistic string class */ /* A minimalistic string class */
class string { class string_class {
char *data; char *data;
public: public:
string() { string_class() {
data = 0; data = 0;
} }
string(const char *s) { string_class(const char *s) {
data = new char[strlen(s)+1]; data = new char[strlen(s)+1];
strcpy(data,s); strcpy(data,s);
} }
~string() { ~string_class() {
if (data) delete [] data; if (data) delete [] data;
} }
char *c_str() { char *c_str() {
@ -59,20 +59,20 @@ namespace test {
#endif #endif
namespace test { namespace test {
class string; class string_class;
#ifdef SWIGPYTHON #ifdef SWIGPYTHON
%typemap(in) string * { %typemap(in) string_class * {
$1 = new string(PyString_AsString($input)); $1 = new string_class(PyString_AsString($input));
} }
%typemap(freearg) string * { %typemap(freearg) string_class * {
delete $1; delete $1;
} }
#endif #endif
#ifdef SWIGRUBY #ifdef SWIGRUBY
%typemap(in) string * { %typemap(in) string_class * {
$1 = new string(STR2CSTR($input)); $1 = new string_class(STR2CSTR($input));
} }
%typemap(freearg) string * { %typemap(freearg) string_class * {
delete $1; delete $1;
} }
#endif #endif
@ -80,11 +80,11 @@ namespace test {
%inline %{ %inline %{
namespace test { namespace test {
class string; class string_class;
class complex; class complex;
/* Functions in the namespace itself */ /* Functions in the namespace itself */
char *stest1(string *s) { char *stest1(string_class *s) {
return s->c_str(); return s->c_str();
} }
double ctest1(complex *c) { double ctest1(complex *c) {
@ -93,11 +93,11 @@ namespace test {
} }
namespace test2 { namespace test2 {
using test::string; using test::string_class;
using test::complex; using test::complex;
/* Functions in another namespace */ /* Functions in another namespace */
char *stest2(string *s) { char *stest2(string_class *s) {
return s->c_str(); return s->c_str();
} }
double ctest2(complex *c) { double ctest2(complex *c) {
@ -108,7 +108,7 @@ namespace test {
namespace test3 { namespace test3 {
using namespace test; using namespace test;
char *stest3(string *s) { char *stest3(string_class *s) {
return s->c_str(); return s->c_str();
} }
double ctest3(complex *c) { double ctest3(complex *c) {
@ -119,7 +119,7 @@ namespace test {
namespace test4 { namespace test4 {
using namespace test2; using namespace test2;
char *stest4(string *s) { char *stest4(string_class *s) {
return s->c_str(); return s->c_str();
} }
double ctest4(complex *c) { double ctest4(complex *c) {
@ -130,7 +130,7 @@ namespace test {
namespace test5 { namespace test5 {
using namespace test3; using namespace test3;
char *stest5(string *s) { char *stest5(string_class *s) {
return s->c_str(); return s->c_str();
} }
double ctest5(complex *c) { double ctest5(complex *c) {
@ -138,35 +138,35 @@ namespace test {
} }
} }
char *stest6(test::string *s) { char *stest6(test::string_class *s) {
return s->c_str(); return s->c_str();
} }
double ctest6(test::complex *c) { double ctest6(test::complex *c) {
return c->real(); return c->real();
} }
char *stest7(test2::string *s) { char *stest7(test2::string_class *s) {
return s->c_str(); return s->c_str();
} }
double ctest7(test2::complex *c) { double ctest7(test2::complex *c) {
return c->real(); return c->real();
} }
char *stest8(test3::string *s) { char *stest8(test3::string_class *s) {
return s->c_str(); return s->c_str();
} }
double ctest8(test3::complex *c) { double ctest8(test3::complex *c) {
return c->real(); return c->real();
} }
char *stest9(test4::string *s) { char *stest9(test4::string_class *s) {
return s->c_str(); return s->c_str();
} }
double ctest9(test4::complex *c) { double ctest9(test4::complex *c) {
return c->real(); return c->real();
} }
char *stest10(test5::string *s) { char *stest10(test5::string_class *s) {
return s->c_str(); return s->c_str();
} }
double ctest10(test5::complex *c) { double ctest10(test5::complex *c) {
@ -175,7 +175,7 @@ namespace test {
namespace test11 = test; namespace test11 = test;
char *stest11(test11::string *s) { char *stest11(test11::string_class *s) {
return s->c_str(); return s->c_str();
} }
double ctest11(test11::complex *c) { double ctest11(test11::complex *c) {
@ -185,7 +185,7 @@ namespace test {
using namespace test2; using namespace test2;
using test::complex; using test::complex;
char *stest12(string *s) { char *stest12(string_class *s) {
return s->c_str(); return s->c_str();
} }
double ctest12(complex *c) { double ctest12(complex *c) {