Haiku API Bindings
List
Not logged in

Documentation | SupportKit | List

DESCRIPTION

Haiku's BList class is automatically converted to or from a native list as necessary, so you never need to worry about it.

However, you must keep in mind that when auto-converting from a BList, all the elements of the list will be of the same type; for example, Handler's FilterList() method returns a list of MessageFilters. If you know that a particular object in the list is an instance of a custom subclass and you wish to call the subclass's method instead of the base class method, you will need to convert the object first.

Perl

my @list = $handler->FilterList();
my $filter = bless $list->[$n], 'Subclass';

Python

list = handler->FilterList()
filter = (Subclass)list[n]
# does this code actually work as expected? need to test

Similarly, when auto-converting to a BList, you need to make sure that every object in the list is of the expected type. For example, since Handler's SetFilterList() expects a list of MessageFilters, so every object in the passed list must be an instance of that class or a subclass.