[wpdev-commits] wolfpack/python global.cpp,1.148,1.149 pyaccounts.h,1.1,1.2
Brought to you by:
rip,
thiagocorrea
From: Sebastian H. <dar...@us...> - 2004-08-31 00:48:15
|
Update of /cvsroot/wpdev/wolfpack/python In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv316/python Modified Files: global.cpp pyaccounts.h Log Message: accounts iterator Index: global.cpp =================================================================== RCS file: /cvsroot/wpdev/wolfpack/python/global.cpp,v retrieving revision 1.148 retrieving revision 1.149 diff -C2 -d -r1.148 -r1.149 *** global.cpp 31 Aug 2004 00:42:31 -0000 1.148 --- global.cpp 31 Aug 2004 00:48:05 -0000 1.149 *************** *** 2052,2055 **** --- 2052,2056 ---- wpAccountsIter *obj = PyObject_New(wpAccountsIter, &wpAccountsIterType); + obj->it = 0; return (PyObject*)obj; } Index: pyaccounts.h =================================================================== RCS file: /cvsroot/wpdev/wolfpack/python/pyaccounts.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** pyaccounts.h 31 Aug 2004 00:42:36 -0000 1.1 --- pyaccounts.h 31 Aug 2004 00:48:05 -0000 1.2 *************** *** 39,59 **** { PyObject_HEAD; ! cAccounts::const_iterator it; } wpAccountsIter; static PyObject *wpAccountsIter_First(wpAccountsIter *self) { ! self->it = Accounts::instance()->begin(); return (PyObject*)self; } static PyObject *wpAccountsIter_Next(wpAccountsIter *self) { ! if (self->it == Accounts::instance()->end()) { PyErr_SetNone(PyExc_StopIteration); return 0; } else { ! return PyGetAccountObject(*(self->it++)); } } static PyTypeObject wpAccountsIterType = { --- 39,70 ---- { PyObject_HEAD; ! cAccounts::const_iterator *it; } wpAccountsIter; static PyObject *wpAccountsIter_First(wpAccountsIter *self) { ! delete self->it; ! self->it = new cAccounts::const_iterator(Accounts::instance()->begin()); return (PyObject*)self; } static PyObject *wpAccountsIter_Next(wpAccountsIter *self) { ! if (!self->it) { ! PyErr_SetNone(PyExc_StopIteration); ! return 0; ! } ! ! if ((*self->it) == Accounts::instance()->end()) { PyErr_SetNone(PyExc_StopIteration); return 0; } else { ! return PyGetAccountObject(*((*self->it)++)); } } + void wpAccountsIterDealloc( wpAccountsIter* self ) { + delete self->it; + wpDealloc((PyObject*)self); + } + static PyTypeObject wpAccountsIterType = { *************** *** 63,67 **** sizeof( wpAccountsIterType ), 0, ! wpDealloc, 0, 0, --- 74,78 ---- sizeof( wpAccountsIterType ), 0, ! (destructor)wpAccountsIterDealloc, 0, 0, |