reenable missing INPUT/OUTPUT, and add tests for std::string
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@8637 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
81bf4de348
commit
829cd3a908
7 changed files with 38 additions and 11 deletions
|
|
@ -1,5 +1,11 @@
|
|||
%module li_std_string
|
||||
%include "std_string.i"
|
||||
%include <std_string.i>
|
||||
|
||||
#if defined(SWIGUTL)
|
||||
%apply std::string& INPUT { std::string &input }
|
||||
%apply std::string& INOUT { std::string &inout }
|
||||
#endif
|
||||
|
||||
|
||||
%inline %{
|
||||
|
||||
|
|
@ -35,6 +41,14 @@ std::string& test_reference_out() {
|
|||
return x;
|
||||
}
|
||||
|
||||
std::string test_reference_input(std::string &input) {
|
||||
return input;
|
||||
}
|
||||
|
||||
void test_reference_inout(std::string &inout) {
|
||||
inout += inout;
|
||||
}
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#pragma warning(disable: 4290) // C++ exception specification ignored except to indicate a function is not __declspec(nothrow)
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -97,3 +97,11 @@ if ($li_std_string::Structure::StaticMemberString2 ne $s) {
|
|||
if ($li_std_string::Structure::ConstStaticMemberString ne "const static member string") {
|
||||
die ("ConstStaticMemberString test");
|
||||
}
|
||||
|
||||
if (li_std_string::test_reference_input("hello") ne "hello") {
|
||||
die ("reference_input");
|
||||
}
|
||||
|
||||
if (li_std_string::test_reference_inout("hello") ne "hellohello") {
|
||||
die ("reference_inout");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -113,3 +113,9 @@ if li_std_string.cvar.Structure_StaticMemberString2 != s:
|
|||
if li_std_string.cvar.Structure_ConstStaticMemberString != "const static member string":
|
||||
raise RuntimeError, "ConstStaticMemberString test"
|
||||
|
||||
|
||||
if li_std_string.test_reference_input("hello") != "hello":
|
||||
raise RuntimeError
|
||||
s = li_std_string.test_reference_inout("hello")
|
||||
if s != "hellohello":
|
||||
raise RuntimeError
|
||||
|
|
|
|||
|
|
@ -102,3 +102,12 @@ end
|
|||
if (Structure.ConstStaticMemberString != "const static member string")
|
||||
raise RuntimeError
|
||||
end
|
||||
|
||||
|
||||
if (test_reference_input("hello") != "hello")
|
||||
raise RuntimeError
|
||||
end
|
||||
s = test_reference_inout("hello")
|
||||
if (s != "hellohello")
|
||||
raise RuntimeError
|
||||
end
|
||||
|
|
|
|||
|
|
@ -40,10 +40,6 @@
|
|||
#undef SWIG_DIRECTOR_TYPEMAPS
|
||||
#endif
|
||||
|
||||
#ifndef SWIG_INOUT_NODEF
|
||||
#define SWIG_INOUT_NODEF
|
||||
#endif
|
||||
|
||||
|
||||
/* Perl types */
|
||||
#define SWIG_Object SV *
|
||||
|
|
|
|||
|
|
@ -31,9 +31,6 @@
|
|||
#define SWIG_DIRECTOR_TYPEMAPS
|
||||
#endif
|
||||
|
||||
#ifndef SWIG_INOUT_NODEF
|
||||
#define SWIG_INOUT_NODEF
|
||||
#endif
|
||||
|
||||
/* Ruby types */
|
||||
#define SWIG_Object VALUE
|
||||
|
|
|
|||
|
|
@ -37,9 +37,6 @@
|
|||
#undef SWIG_DIRECTOR_TYPEMAPS
|
||||
#endif
|
||||
|
||||
#ifndef SWIG_INOUT_NODEF
|
||||
#define SWIG_INOUT_NODEF
|
||||
#endif
|
||||
|
||||
/* Tcl types */
|
||||
#define SWIG_Object Tcl_Obj *
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue