[Phphtmllib-devel] SF.net SVN: phphtmllib:[3178] trunk/phphtmllib
Status: Beta
Brought to you by:
hemna
From: <he...@us...> - 2008-11-07 05:51:38
|
Revision: 3178 http://phphtmllib.svn.sourceforge.net/phphtmllib/?rev=3178&view=rev Author: hemna Date: 2008-11-07 05:51:35 +0000 (Fri, 07 Nov 2008) Log Message: ----------- added Iterator support to the DBDataObject Modified Paths: -------------- trunk/phphtmllib/CHANGELOG trunk/phphtmllib/src/data/DBDataObject.inc Modified: trunk/phphtmllib/CHANGELOG =================================================================== --- trunk/phphtmllib/CHANGELOG 2008-11-07 04:48:57 UTC (rev 3177) +++ trunk/phphtmllib/CHANGELOG 2008-11-07 05:51:35 UTC (rev 3178) @@ -11,6 +11,7 @@ - fixed a bug with the label rendering for FENumberInRange - fixed an issue in DBDataObjectTemplateGenerator that was trying to generate a get_id() method which is marked as final in the parent class. + + Added DBDataObject Iterator support. version 3.0.2 - 03/18/08 - fixed a bug with RequestBuilder::get_url() when a RequestBuilder::set_file() was called. Modified: trunk/phphtmllib/src/data/DBDataObject.inc =================================================================== --- trunk/phphtmllib/src/data/DBDataObject.inc 2008-11-07 04:48:57 UTC (rev 3177) +++ trunk/phphtmllib/src/data/DBDataObject.inc 2008-11-07 05:51:35 UTC (rev 3178) @@ -36,7 +36,7 @@ * */ -abstract class DBDataObject extends DataObject { +abstract class DBDataObject extends DataObject implements Iterator { /** * Defines metadata for our * DataObject @@ -861,6 +861,66 @@ return array_keys( get_object_vars( $this ) ); } + /* -- Iterator functions -------------------------------------------------------*/ + + /** + * This Iterator method + * rewinds the index array + * + */ + public function rewind() { + reset($this->meta_data); + } + + /** + * This Iterator method + * gets the current value + * + * @return unknown + */ + public function current() { + $var = key($this->meta_data); + if ($var) { + $value = $this->get($var); + } else { + $value = false; + } + return $value; + } + + + /** + * This Iterator method gets the + * current key + * + * @return unknown + */ + public function key() { + $var = key($this->meta_data); + return $var; + } + + /** + * This Iterator method + * advances the index + * + * @return unknown + */ + public function next() { + $var = next($this->meta_data); + return $var; + } + + /** + * This Iterator method + * ensures the current value is valid. + * + * @return unknown + */ + public function valid() { + $var = $this->current() !== false; + return $var; + } } ?> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |