NAME

TUI::Help::RefTable - sorted symbol table of help-topic references

HIERARCHY

TObject
  TNSCollection
    TNSSortedCollection
      TSortedCollection
        TRefTable

SYNOPSIS

use TUI::Help;

my $table = new_TRefTable( 10, 5 );
my $reference = $table->getReference( 'Introduction' );
$reference->val( 100 );
$reference->resolved( 1 );

my $same = $table->getReference( 'Introduction' );
my $value = $same->val();

DESCRIPTION

TRefTable ports the topic-reference symbol table of the original Borland help compiler. It stores the TReference records defined by TUI::Help::HelpBase in case-sensitive topic-name order.

Looking up a known name returns its existing record. An unknown name creates a record with that topic name, resolved false, and val zero. Callers supply the numeric value and mark the reference resolved.

Only numeric values are represented. The original forward-reference fix-up lists are not supported. Initializing val to zero is the numeric-only adaptation of the original empty fix-up list.

The item-streaming methods are empty, as in the original: no reference records are written, and reading an item returns undef. Storable therefore preserves only the inherited collection metadata. Restoring a nonempty table produces undefined entries, not a usable symbol table. The inherited streaming machinery uses TStream objects, not filehandles.

Commonly Used Features

Use the table to collect references while processing help topics. Keep the record returned by getReference, then fill in its numeric value when the topic is defined. Later lookups reuse the updated record. Do not change the topic name of an inserted record, as this would invalidate its sorted position.

CONSTRUCTOR

new

my $table = TRefTable->new( limit => 10, delta => 5 );

Creates an empty table. Both arguments are required:

limit

Int. Initial collection capacity. The alias aLimit is accepted.

delta

Int. Collection growth increment. The alias aDelta is accepted.

new_TRefTable

my $table = new_TRefTable( 10, 5 );

Positional factory taking the initial capacity and growth increment.

METHODS

Collection access, search, insertion, and removal are inherited from TSortedCollection and TNSCollection.

compare

my $order = $table->compare( $key1, $key2 );

Compares two Str topic names case-sensitively. Returns -1, 0, or 1 for less than, equal to, or greater than, respectively.

getReference

my $reference = $table->getReference( $topic );

Accepts a Str topic name and returns its TReference object, creating an unresolved record if necessary. Repeated lookups of the same name return the same object without resetting its fields. Names differing only in case identify distinct records.

keyOf

my $topic = $table->keyOf( $item );

Returns the Str topic name of a TReference object.

SEE ALSO

TUI::Help, TUI::Help::HelpBase, TSortedCollection, TNSCollection, TUI::toolkit::Types

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).