After much discussion, we have decided that an nsIStringEnumerator class (and a corresponding one for UTF8) was in order to provide an easy mechanism to enumerate strings from an interface. This is now the encouraged mechanism to return a list of strings to a caller, when the caller is expected to only iterate over the returned list.

The implementation that was checked in can be QI'ed back and forth between the unicode and UTF8 versions of the interface and the actual conversion of strings will be seamless.

In addition, this implementation can be QueryInterfaced' to an nsISimpleEnumerator which creates nsIStringSupports or nsICStringSupports objects where appropriate. This will allow conversion of existing interfaces (Even frozen ones) over to this new enumerator without breaking existing callers.

For instance, the frozen nsICategoryManager has a method:

nsISimpleEnumerator enumerateCategories();

At some point you will be able to QI() the result to an nsIUTF8StringEnumerator which should be much simpler (and faster) than the current mechanism.

Alec

Reply via email to