Add some more std::string typemaps.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@8632 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
c7d465ecaa
commit
fcd200a7b4
1 changed files with 28 additions and 0 deletions
|
|
@ -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 {
|
%typemap(out) string {
|
||||||
$result = gh_str02scm($1.c_str());
|
$result = gh_str02scm($1.c_str());
|
||||||
}
|
}
|
||||||
|
|
@ -57,4 +67,22 @@ namespace std {
|
||||||
$result = gh_str02scm($1->c_str());
|
$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());
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue