#include "python.h"
namespace python {
// Int & Int::operator=(const Int & obj) {{{
Int::Int(const Object & obj) {
set( PyNumber_Int( *obj ), true );
}
// }}}
// Int::Int(int v) {{{
Int::Int(int v) {
set( PyInt_FromLong(static_cast< long >( v ) ), true );
}
// }}}
// Int & Int::operator=(const Int & obj) {{{
Int & Int::operator=(const Object & obj) {
return (*this = *obj);
}
// }}}
// Int & Int::operator=(PyObject * obj) {{{
Int & Int::operator=(PyObject * obj) {
if ( ptr() != obj ) {
set( PyNumber_Int( obj ), true );
}
return *this;
}
// }}}
// Int & Int::operator=(int v) {{{
Int & Int::operator=(int v) {
set( PyInt_FromLong( static_cast< long >( v ) ), true );
return *this;
}
// }}}
// Int & Int::operator=(long v) {{{
Int & Int::operator=(long v) {
set(PyInt_FromLong(v), true);
return *this;
}
// }}}
// long Int::operator long() const {{{
Int::operator long() const {
return PyInt_AsLong( ptr() );
}
// }}}
// bool Int::accepts(PyObject * pyobj) const {{{
bool Int::accepts(PyObject * pyobj) const {
return (pyobj != NULL ) and PyInt_Check(pyobj);
}
// }}}
}
syntax highlighted by Code2HTML, v. 0.9.1