thekid/rfc — Issue #75: RFC 0075: I/O Collections
Author: thekid
Created: 2011-10-09 14:53:49+00:00
State: open

Scope of Change
====
A new API io.collections will be added.

Rationale
====
Easier iteration of file system elements.

Functionality
====

Interfaces
----
The following interfaces are defined by this new API:

```
lang.Interface
|
+--+ io.collections.IOElement
| |
| +--+ io.collections.IOCollection
|
+--+ io.collections.iterate.IterationFilter

```

Classes
----
The following classes are defined by this new API:

```
lang.Object
|
+--+ io.collections.FileElement -> io.collections.IOElement
|
+--+ io.collections.FileCollection -> io.collections.IOCollection
|
+--+ io.collections.iterate.RegexFilter -> io.collections.iterate.IterationFilter
|
+--+ io.collections.iterate.IOCollectionIterator -> util.Iterator
|
+--+ io.collections.iterate.FilteredIOCollectionIterator

```

Example
----
Iterating a directory (non-recursively), finding all jpeg-files:

```php
hasNext();
) {
Console::writeLine('Element ', xp::stringOf($i->next()));
}
?>
```

Security considerations
====
n/a

Speed impact
====
n/a

Dependencies
====
n/a

Related documents
====
- http://xp-framework.info/xml/xp.en_US/documentation/class?ports/de.thekid.dialog.io.FilteredFolderIterator
de.thekid.dialog.io.FilteredFolderIterator

- http://xp-framework.net/rfc/contrib/rfc0075.diff
Initial implementation

- http://www.xulplanet.com/references/xpcomref/ifaces/nsIDirectoryIterator.html
Mozilla's DirectoryIterator

- http://wiki.cc/php/Iterator_Directory
SPL's DirectoryIterator

Comments
====
- friebe, Wed Sep 20 14:14:23 CEST 2006
New filters can be added in the future - RegexFilter is the only.