The great merge
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@4141 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
6fcc22a1f8
commit
516036631c
1508 changed files with 125983 additions and 44037 deletions
26
SWIG/Lib/python/std_common.i
Normal file
26
SWIG/Lib/python/std_common.i
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
//
|
||||
// SWIG typemaps for STL - common utilities
|
||||
// Luigi Ballabio
|
||||
// Aug 3, 2002
|
||||
//
|
||||
// Python implementation
|
||||
|
||||
%{
|
||||
#include <string>
|
||||
|
||||
PyObject* SwigInt_FromBool(bool b) {
|
||||
return PyInt_FromLong(b ? 1L : 0L);
|
||||
}
|
||||
double SwigNumber_Check(PyObject* o) {
|
||||
return PyFloat_Check(o) || PyInt_Check(o);
|
||||
}
|
||||
double SwigNumber_AsDouble(PyObject* o) {
|
||||
return (PyFloat_Check(o) ? PyFloat_AsDouble(o) : double(PyInt_AsLong(o)));
|
||||
}
|
||||
PyObject* SwigString_FromString(const std::string& s) {
|
||||
return PyString_FromString(s.c_str());
|
||||
}
|
||||
std::string SwigString_AsString(PyObject* o) {
|
||||
return std::string(PyString_AsString(o));
|
||||
}
|
||||
%}
|
||||
Loading…
Add table
Add a link
Reference in a new issue