std::string typemap modifications so they can be used with %apply for other string classes

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@13120 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
William S Fulton 2012-05-26 06:33:49 +00:00
commit 12a9671440
13 changed files with 37 additions and 33 deletions

View file

@ -36,7 +36,7 @@ class wstring;
SWIG_exception(SWIG_TypeError, "string expected");
}
%typemap(in) const string & (std::string temp) {
%typemap(in) const string & ($*1_ltype temp) {
/* %typemap(in) const string & */
if (caml_ptr_check($input)) {
temp.assign((char *)caml_ptr_val($input,0), caml_string_len($input));
@ -46,7 +46,7 @@ class wstring;
}
}
%typemap(in) string & (std::string temp) {
%typemap(in) string & ($*1_ltype temp) {
/* %typemap(in) string & */
if (caml_ptr_check($input)) {
temp.assign((char *)caml_ptr_val($input,0), caml_string_len($input));
@ -56,17 +56,17 @@ class wstring;
}
}
%typemap(in) string * (std::string *temp) {
%typemap(in) string * ($*1_ltype *temp) {
/* %typemap(in) string * */
if (caml_ptr_check($input)) {
temp = new std::string((char *)caml_ptr_val($input,0), caml_string_len($input));
temp = new $*1_ltype((char *)caml_ptr_val($input,0), caml_string_len($input));
$1 = temp;
} else {
SWIG_exception(SWIG_TypeError, "string expected");
}
}
%typemap(free) string * (std::string *temp) {
%typemap(free) string * ($*1_ltype *temp) {
delete temp;
}