Sean (on IRC) convinced me that something called *Iterator had better implement Iterator interface (which TextIterator currently does not). So changing method signatures is out of the question. Towards that, the current functions will stay as they are, but I'll have to add current_offset() (for getting the offset of the current element as opposed to the element itself), and alias rewind() to first().

-Andrei

On Jun 23, 2006, at 2:00 PM, Andrei Zmievski wrote:

I am working on implementing BreakIterator API [1]. I considered two approaches: making a separate class or merging the API into the existing TextIterator. Having a separate class would be a bit cleaner, but I can see people wanting to use it in foreach(), and since TextIterator already provides a lot of BreakIterator's functionality, I decided that merging would be the best option. However, there is an overlap between the BreakIterator API and the current TextIterator one, so there will have to be some changes.

1. TextIterator::current() signature will change from:

   mixed current()

to:

   mixed current(integer &$offset)

in order to support BreakIterator's functionality of returning offset in current().

2. TextIterator::next() will return the offset of the next boundary instead of returning nothing.

3. TextIterator::rewind() will be renamed to TextIterator::first() to conform to BreakIterator's first()/last() API.

So this is heads up. Let me know if you have a problem with this.

-A

[1] http://icu.sourceforge.net/apiref/icu4c/ubrk_8h.html

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to