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:
parent
85a9996858
commit
bd40a83f1c
15 changed files with 2007 additions and 15 deletions
|
|
@ -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");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue