Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

TNSSortedCollection Class Reference

Handles a non-streamable collection sorted by a key (with or without duplicates). More...

#include <tvobjs.h>

Inheritance diagram for TNSSortedCollection::

TNSCollection TObject TPWrittenObjects TSortedCollection TStreamableTypes TFileCollection TStringCollection TResourceCollection List of all members.

Public Methods

 TNSSortedCollection (ccIndex aLimit, ccIndex aDelta)
virtual Boolean search (void *key, ccIndex &index)
virtual ccIndex indexOf (void *item)
virtual ccIndex insert (void *item)
virtual void* keyOf (void *item)

Public Attributes

Boolean duplicates

Protected Methods

 TNSSortedCollection ()

Detailed Description

The abstract class TNSSortedCollection is a specialized derivative of TNSCollection implementing non-streamable collections sorted by a key (with or without duplicates). No instances of TNSSortedCollection are allowed. It exists solely as a base for other standard or user-defined derived classes.

Definition at line 415 of file tvobjs.h.


Constructor & Destructor Documentation

TNSSortedCollection::TNSSortedCollection ( ccIndex aLimit,
ccIndex aDelta ) [inline]
 

Invokes the TNSCollection constructor to set count, items and limit to 0; calls setLimit(aLimit) to set the collection limit to `aLimit', then sets delta to `aDelta'.

See also:
TNSCollection::setLimit

Sets duplicates data member to False. If you want to allow duplicate keys, you must set duplicates to True.

Definition at line 427 of file tvobjs.h.

TNSSortedCollection::TNSSortedCollection ( ) [inline, protected]
 

Undocumented.

Definition at line 464 of file tvobjs.h.


Member Function Documentation

ccIndex TNSSortedCollection::indexOf ( void * item ) [virtual]
 

Returns the index of the given item; that is, the converse operation to at(). If the item is not in the collection, indexOf() calls error().

The address of the item is passed in the `item' parameter.

Reimplemented from TNSCollection.

Referenced by TFileCollection::indexOf().

ccIndex TNSSortedCollection::insert ( void * item ) [virtual]
 

If duplicates data member is False, insert works as follows: if the target item is not found in the sorted collection, it is inserted at the correct index position. Calls search() to determine if the item exists, and if not, where to insert it.

If duplicates is True, the item is inserted ahead of any items (if any) with the same key.

Reimplemented from TNSCollection.

Referenced by TFileCollection::insert().

void * TNSSortedCollection::keyOf ( void * item ) [virtual]
 

Undocumented.

Reimplemented in TResourceCollection.

Boolean TNSSortedCollection::search ( void * key,
ccIndex & index ) [virtual]
 

Returns True if the item identified by `key' is found in the sorted collection. If the item is found, `index' is set to the found index; otherwise `index' is set to the index where the item would be placed if inserted and False is returned.


Member Data Documentation

Boolean TNSSortedCollection::duplicates
 

Set to True if duplicate indexes are allowed; otherwise set to False. The default is False.

If duplicates data member is True methods search(), insert() and indexOf() work differently.

Definition at line 455 of file tvobjs.h.


The documentation for this class was generated from the following file:
Generated at Sat Sep 22 20:19:30 2001 for TVision by doxygen1.2.8.1 written by Dimitri van Heesch, © 1997-2001