polymorphism patch merge

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@4435 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Mark Rose 2003-03-06 19:21:58 +00:00
commit bd40a83f1c
15 changed files with 2007 additions and 15 deletions

View file

@ -50,5 +50,26 @@ namespace std {
%typemap(out) const string & {
$result = PyString_FromStringAndSize($1->data(),$1->size());
}
%typemap(inv, parse="s") string, const string &, string & "$1_name.c_str()";
%typemap(inv, parse="s") string *, const string * "$1_name->c_str()";
%typemap(outv) string {
if (PyString_Check($input))
$result = std::string(PyString_AsString($input));
else
throw SWIG_DIRECTOR_TYPE_MISMATCH("string expected");
}
%typemap(outv) const string & (std::string temp) {
if (PyString_Check($input)) {
temp = std::string(PyString_AsString($input));
$result = &temp;
} else {
throw SWIG_DIRECTOR_TYPE_MISMATCH("string expected");
}
}
}