[wpdev-commits] wolfpack/python char.cpp,1.113,1.114 item.cpp,1.78,1.79
Brought to you by:
rip,
thiagocorrea
|
From: <dar...@pr...> - 2004-01-26 17:39:09
|
Update of /cvsroot/wpdev/wolfpack/python In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16632/python Modified Files: char.cpp item.cpp Log Message: Fixed and cleaned python settag code for items. Index: char.cpp =================================================================== RCS file: /cvsroot/wpdev/wolfpack/python/char.cpp,v retrieving revision 1.113 retrieving revision 1.114 diff -C2 -d -r1.113 -r1.114 *** char.cpp 22 Jan 2004 05:59:46 -0000 1.113 --- char.cpp 25 Jan 2004 00:51:35 -0000 1.114 *************** *** 659,679 **** PyObject *object; ! if( !PyArg_ParseTuple( args, "sO:char.settag( name, value )", &key, &object ) ) return 0; ! if( PyString_Check( object ) ) ! { ! self->pChar->removeTag( key ); ! self->pChar->setTag( key, cVariant( PyString_AsString( object ) ) ); ! } ! else if( PyInt_Check( object ) ) ! { ! self->pChar->removeTag( key ); ! self->pChar->setTag( key, cVariant( (int)PyInt_AsLong( object ) ) ); ! } ! else if( PyFloat_Check( object ) ) ! { ! self->pChar->removeTag( key ); ! self->pChar->setTag( key, cVariant( (double)PyFloat_AsDouble( object ) ) ); } --- 659,671 ---- PyObject *object; ! if (!PyArg_ParseTuple( args, "sO:char.settag( name, value )", &key, &object )) return 0; ! if (PyString_Check(object)) { ! self->pChar->setTag(key, cVariant(PyString_AsString(object))); ! } else if (PyInt_Check(object)) { ! self->pChar->setTag(key, cVariant((int)PyInt_AsLong(object))); ! } else if (PyFloat_Check(object)) { ! self->pChar->setTag(key, cVariant((double)PyFloat_AsDouble(object))); } Index: item.cpp =================================================================== RCS file: /cvsroot/wpdev/wolfpack/python/item.cpp,v retrieving revision 1.78 retrieving revision 1.79 diff -C2 -d -r1.78 -r1.79 *** item.cpp 12 Jan 2004 04:58:15 -0000 1.78 --- item.cpp 25 Jan 2004 00:51:39 -0000 1.79 *************** *** 366,390 **** static PyObject* wpItem_settag( wpItem* self, PyObject* args ) { ! if( !self->pItem || self->pItem->free ) return PyFalse; ! char* pKey = 0, *pTag = 0; ! int iTag; ! cVariant tag; ! if( PyArg_ParseTuple( args, "ss:item.settag( key, tag )", &pKey, &pTag ) ) ! { ! tag = cVariant( QString( pTag ) ); ! } ! else if ( PyArg_ParseTuple( args, "si:item.settag( key, tag )", &pKey, &iTag ) ) ! { ! tag = cVariant( iTag ); ! }else ! return 0; ! ! QString key = pKey; ! self->pItem->removeTag( key ); ! self->pItem->setTag( key, tag ); return PyTrue; --- 366,385 ---- static PyObject* wpItem_settag( wpItem* self, PyObject* args ) { ! if (self->pItem->free) return PyFalse; ! char *key; ! PyObject *object; ! if (!PyArg_ParseTuple( args, "sO:char.settag( name, value )", &key, &object )) ! return 0; ! if (PyString_Check(object)) { ! self->pItem->setTag(key, cVariant(PyString_AsString(object))); ! } else if (PyInt_Check(object)) { ! self->pItem->setTag(key, cVariant((int)PyInt_AsLong(object))); ! } else if (PyFloat_Check(object)) { ! self->pItem->setTag(key, cVariant((double)PyFloat_AsDouble(object))); ! } return PyTrue; |