TextIterator changes

[email protected] (Andrei Zmievski)
Newsgroups php.i18n,php.internals
Message-ID <[email protected]>
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.