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

tvobjs.h

Go to the documentation of this file.
00001 /*
00002  * tvobjs.h
00003  *
00004  * Turbo Vision - Version 2.0
00005  *
00006  * Copyright (c) 1994 by Borland International
00007  * All Rights Reserved.
00008  *
00009  * Modified by Sergio Sigala <sergio@sigala.it>
00010  */
00011 
00012 #if defined( Uses_TObject ) && !defined( __TObject )
00013 #define __TObject
00014 
00019 #include <stddef.h>
00020 
00031 class TObject
00032 {
00033 public:
00040     virtual ~TObject();
00051     static void destroy( TObject *o );
00061     virtual void shutDown();
00062 private:
00063 };
00064 
00065 inline void TObject::destroy( TObject *o )
00066 {
00067     if( o != 0 )
00068         o->shutDown();
00069     delete o;
00070 }
00071 
00072 #endif  // Uses_TObject
00073 
00074 #if defined( Uses_TNSCollection ) && !defined( __TNSCollection )
00075 #define __TNSCollection
00076 
00089 class TNSCollection : public TObject
00090 {
00091 public:
00111     TNSCollection( ccIndex aLimit, ccIndex aDelta );
00122     ~TNSCollection();
00129     virtual void shutDown();
00135     void *at( ccIndex index );
00143     virtual ccIndex indexOf( void *item );
00149     void atFree( ccIndex index );
00160     void atRemove( ccIndex index );
00169     void remove( void *item );
00174     void removeAll();
00183     void free( void *item );
00190     void freeAll();
00207     void atInsert( ccIndex index, void *item );
00217     void atPut( ccIndex index, void *item );
00223     virtual ccIndex insert( void *item );
00224 #ifndef __UNPATCHED
00225 
00230     virtual void error( ccIndex code, ccIndex info );
00231 #else
00232 
00236     static void error( ccIndex code, ccIndex info );
00237 #endif
00238 
00292     void *firstThat( ccTestFunc Test, void *arg );
00305     void *lastThat( ccTestFunc Test, void *arg );
00321     void forEach( ccAppFunc action, void *arg );
00328     void pack();
00346     virtual void setLimit( ccIndex aLimit );
00351     ccIndex getCount()
00352         { return count; }
00353 protected:
00360     TNSCollection();
00365     void **items;
00371     ccIndex count;
00376     ccIndex limit;
00385     ccIndex delta;
00393     Boolean shouldDelete;
00394 private:
00398     virtual void freeItem( void *item );
00399 };
00400 
00401 #endif  // Uses_TNSCollection
00402 
00403 #if defined( Uses_TNSSortedCollection ) && !defined( __TNSSortedCollection )
00404 #define __TNSSortedCollection
00405 
00415 class TNSSortedCollection: public virtual TNSCollection
00416 {
00417 public:
00427     TNSSortedCollection( ccIndex aLimit, ccIndex aDelta) :
00428         TNSCollection( aLimit, aDelta ), duplicates(False)
00429             { delta = aDelta; setLimit( aLimit ); }
00436     virtual Boolean search( void *key, ccIndex& index );
00437     virtual ccIndex indexOf( void *item );
00447     virtual ccIndex insert( void *item );
00455     Boolean duplicates;
00459     virtual void *keyOf( void *item );
00460 protected:
00464     TNSSortedCollection() : duplicates(False) {}
00465 private:
00471     virtual int compare( void *key1, void *key2 ) = 0;
00472 };
00473 
00474 #endif  // Uses_TNSSortedCollection

Generated at Sat Sep 22 20:19:13 2001 for TVision by doxygen1.2.8.1 written by Dimitri van Heesch, © 1997-2001