2 %include <std_string.i>
5 %apply std::string& INPUT { std::string &input }
6 %apply std::string& INOUT { std::string &inout }
12 std::string test_value(std::string x) {
16 const std::string& test_const_reference(const std::string &x) {
20 void test_pointer(std::string *x) {
23 std::string *test_pointer_out() {
24 static std::string x = "x";
28 void test_const_pointer(const std::string *x) {
31 const std::string *test_const_pointer_out() {
32 static std::string x = "x";
36 void test_reference(std::string &x) {
39 std::string& test_reference_out() {
40 static std::string x = "test_reference_out message";
44 std::string test_reference_input(std::string &input) {
48 void test_reference_inout(std::string &inout) {
53 #pragma warning(disable: 4290) // C++ exception specification ignored except to indicate a function is not __declspec(nothrow)
56 void test_throw() throw(std::string){
57 static std::string x = "test_throw message";
61 void test_const_reference_throw() throw(const std::string &){
62 static std::string x = "test_const_reference_throw message";
66 void test_pointer_throw() throw(std::string *) {
67 throw new std::string("foo");
70 void test_const_pointer_throw() throw(const std::string *) {
71 throw new std::string("foo");
75 #pragma warning(default: 4290) // C++ exception specification ignored except to indicate a function is not __declspec(nothrow)
80 /* Old way, now std::string is a %naturalvar by default
81 %apply const std::string& { std::string *GlobalString2,
82 std::string *MemberString2,
83 std::string *Structure::StaticMemberString2 };
87 std::string GlobalString;
88 std::string GlobalString2 = "global string 2";
89 const std::string ConstGlobalString = "const global string";
92 std::string MemberString;
93 std::string MemberString2;
94 static std::string StaticMemberString;
95 static std::string StaticMemberString2;
97 const std::string ConstMemberString;
98 static const std::string ConstStaticMemberString;
100 Structure() : MemberString2("member string 2"), ConstMemberString("const member string") {}
105 std::string Structure::StaticMemberString = "static member string";
106 std::string Structure::StaticMemberString2 = "static member string 2";
107 const std::string Structure::ConstStaticMemberString = "const static member string";
114 unsigned long long test(unsigned long long l)
118 std::string test(std::string l)
123 unsigned long long testl(unsigned long long l)
132 std::string stdstring_empty() {
133 return std::string();
144 const char *get_null(const char *a) {
145 return a == 0 ? a : "non-null";