/***************************** {{{ LICENSE ********************************\ * dbobj, the relational object persistence module for PHP * * Copyright (C) 2006 Adam Banko * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the Free Software * * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * \***************************** LICENSE }}} ********************************/ #ifndef DBOBJ_DBOBJ_ITERATOR_H #define DBOBJ_DBOBJ_ITERATOR_H #include "php_dbobj.h" #include "dbobj.h" #include "dbDriver.h" typedef struct _knownPropsT { struct _basicPropConfig* config; dbVal value; } knownPropsT; typedef struct _dbobjIterator { enum iteratorPosition { ITERATOR_FIRST, ITERATOR_MIDDLE, //between first and last ITERATOR_AFTER_LAST } position; LocalClassConfig lConf; basicPropConfig* loaded; //a lekerdezett mezoket tartalmazza uint loadedL; basicPropConfig* extraLoad; //azok a mezok, amiket meg kulon be kell tolteni uint extraLoadL; dbobj current; zend_object_handle handle; knownPropsT* knownProps; HashTable properties; zval* zCurrent; DBIterator dbIterator; }* dbobjIterator; #define ALLOC_INIT_DBOBJITERATOR(it) {\ it = emalloc(sizeof(*it));\ it->position = ITERATOR_FIRST;\ it->current = NULL;\ it->handle = 0;\ it->dbIterator = NULL;\ ALLOC_INIT_ZVAL(it->zCurrent);\ Z_OBJ_HT_P(it->zCurrent) = &dbobj_object_handlers;\ zend_hash_init(&it->properties, 8,NULL,dbobjIterator_properties_freeer,0);} #define ZEND_OBJECTS_STORE_PUT_DBOBJITERATOR(it) zend_objects_store_put(it, (zend_objects_store_dtor_t)dbobjIterator_destroy_object, NULL, NULL TSRMLS_CC) extern zend_object_handlers dbobjIterator_object_handlers; DBOBJ_API void php_dbobj_MINIT_dbobjIterator(int module_number TSRMLS_DC); DBOBJ_API void php_dbobj_RINIT_dbobjIterator(TSRMLS_D); DBOBJ_API void dbobjIterator_destroy_object(dbobjIterator this, zend_object_handle handle TSRMLS_DC); DBOBJ_API int dbobjIterator_get_className(zval *object, char** className, zend_uint* classNameL, int parent TSRMLS_DC); DBOBJ_API int dbobjIterator_cast(zval* readObj, zval* writeObj, int type, int shouldFree TSRMLS_DC); DBOBJ_API void dbobjIterator_properties_freeer(void *ptr); DBOBJ_API dbobjIterator dbobjIterator_create(LocalClassConfig lConf, dbCondition *conditions, uint conditionsL, basicPropConfig load[], uint loadL TSRMLS_DC); DBOBJ_API zend_object_value dbobjIterator_create_object(zend_class_entry *class_type TSRMLS_DC); DBOBJ_API zend_class_entry* dbobjIterator_get_class(zval *object TSRMLS_DC); DBOBJ_API union _zend_function* dbobjIterator_get_constructor(zval* object TSRMLS_DC); //////////////////////////////// /////////iterator funcs///////// //////////////////////////////// /* define an overloaded iterator structure */ typedef struct _dbobjIterator_it{ dbobjIterator object; zend_object_iterator_funcs* funcs; zval* zobject; } *dbobjIterator_it; /* iterator handler table */ extern zend_object_iterator_funcs dbobjIterator_it_funcs; DBOBJ_API void dbobjIterator_rewind(dbobjIterator o TSRMLS_DC); DBOBJ_API void dbobjIterator_fetch(dbobjIterator o TSRMLS_DC); /*PHP methods*/ PHP_METHOD(dbobjIterator, rewind); PHP_METHOD(dbobjIterator, current); PHP_METHOD(dbobjIterator, next); PHP_METHOD(dbobjIterator, valid); #endif // DBOBJ_DBOBJ_ITERATOR_H /* * vim600: noet sw=4 ts=4 fdm=marker * vim<600: noet sw=4 ts=4 */