From fcd200a7b4ab79da09286d6cd3c59d4ac7fdd7cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20K=C3=B6ppe?= Date: Mon, 30 Jan 2006 19:01:35 +0000 Subject: [PATCH] Add some more std::string typemaps. git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@8632 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- SWIG/Lib/guile/std_string.i | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/SWIG/Lib/guile/std_string.i b/SWIG/Lib/guile/std_string.i index 3272592bd..588976acc 100644 --- a/SWIG/Lib/guile/std_string.i +++ b/SWIG/Lib/guile/std_string.i @@ -49,6 +49,16 @@ namespace std { } } + %typemap(in) string * (char* tempptr) { + if (gh_string_p($input)) { + tempptr = SWIG_scm2str($input); + $1 = new std::string(tempptr); + if (tempptr) SWIG_free(tempptr); + } else { + SWIG_exception(SWIG_TypeError, "string expected"); + } + } + %typemap(out) string { $result = gh_str02scm($1.c_str()); } @@ -57,4 +67,22 @@ namespace std { $result = gh_str02scm($1->c_str()); } + %typemap(out) string * { + $result = gh_str02scm($1->c_str()); + } + + %typemap(varin) string { + if (gh_string_p($input)) { + char *tempptr = SWIG_scm2str($input); + $1 = std::string(tempptr); + if (tempptr) SWIG_free(tempptr); + } else { + SWIG_exception(SWIG_TypeError, "string expected"); + } + } + + %typemap(varout) string { + $result = gh_str02scm($1.c_str()); + } + }