NAME

TUI::StdDlg::DirCollection - collection of directory entries

HIERARCHY

TObject
  TNSCollection
    TCollection
      TDirCollection

SYNOPSIS

use TUI::StdDlg;

my $dirs = new_TDirCollection(50, 10);

DESCRIPTION

TDirCollection is a collection used by the standard dialog subsystem to store directory entries. It is a typed collection in the sense that the items handled by its public operations are directory entry objects (TDirEntry).

Capacity management follows the standard collection model: the collection is created with an initial capacity (limit) and grows in increments of delta when needed.

CONSTRUCTOR

new

my $dirs = TDirCollection->new(
  limit => $limit,
  delta => $delta
);

Creates a new directory collection.

limit

Initial capacity of the collection (Int).

delta

Growth increment used when the collection exceeds its current capacity (Int).

new_TDirCollection

my $dirs = new_TDirCollection($limit, $delta);

Factory-style constructor using positional arguments.

METHODS

The following methods operate on directory entry objects (TDirEntry) rather than generic items.

at

my $entry | undef = $dirs->at($index);

Returns the TDirEntry at the specified index.

atInsert

$dirs->atInsert($index, $entry | undef);

Inserts a TDirEntry at the specified index.

atPut

$dirs->atPut($index, $entry | undef);

Replaces the TDirEntry at the specified index.

firstThat

my $entry | undef = $dirs->firstThat(\&test, $arg | undef);

Returns the first TDirEntry for which the test function returns true.

lastThat

my $entry | undef = $dirs->lastThat(\&test, $arg | undef);

Returns the last matching TDirEntry by scanning the collection in reverse.

free

$dirs->free($entry);

Removes the specified TDirEntry from the collection and frees it.

indexOf

my $index = $dirs->indexOf($entry | undef);

Returns the index of the specified TDirEntry, or -1 if not found.

insert

my $index = $dirs->insert($entry | undef);

Inserts a TDirEntry into the collection and returns its index.

remove

$dirs->remove($entry);

Removes the specified TDirEntry from the collection without freeing it.

SEE ALSO

TUI::StdDlg::DirListBox, TUI::StdDlg::ChDirDialog, TUI::Objects::Collection

AUTHORS

Borland International (original Turbo Vision design)
J. Schneider <brickpool@cpan.org> (Perl implementation and maintenance)

COPYRIGHT AND LICENSE

Copyright (c) 1990-1994, 1997 by Borland International

Copyright (c) 2026 the "AUTHORS" as listed above.

This software is licensed under the MIT license (see the LICENSE file, which is part of the distribution).