add missing check and sort the code around

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@7790 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Marcelo Matus 2005-11-03 15:11:17 +00:00
commit 3baa03e1b1

View file

@ -124,31 +124,7 @@ namespace std {
operator()(PyObject * v, PyObject *w) const
{ return PyObject_Compare(v, w) < 0; }
};
}
namespace swig {
template <> struct traits<PyObject *> {
typedef value_category category;
static const char* type_name() { return "PyObject *"; }
};
template <> struct traits_asval<PyObject * > {
typedef PyObject * value_type;
static int asval(PyObject *obj, value_type *val) {
if (val) *val = obj;
return SWIG_OK;
}
};
template <> struct traits_from<PyObject *> {
typedef PyObject * value_type;
static PyObject *from(const value_type& val) {
Py_XINCREF(val);
return val;
}
};
}
namespace std {
template <>
struct less <swig::PyItem>: public binary_function<swig::PyItem, swig::PyItem, bool>
{
@ -158,6 +134,37 @@ namespace std {
};
}
namespace swig {
template <> struct traits<PyObject *> {
typedef value_category category;
static const char* type_name() { return "PyObject *"; }
};
template <> struct traits_asval<PyObject * > {
typedef PyObject * value_type;
static int asval(PyObject *obj, value_type *val) {
if (val) *val = obj;
return SWIG_OK;
}
};
template <>
struct traits_check<PyObject *, value_category> {
static bool check(PyObject *) {
return true;
}
};
template <> struct traits_from<PyObject *> {
typedef PyObject * value_type;
static PyObject *from(const value_type& val) {
return val;
}
};
}
namespace swig {
inline size_t