home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 10 Tools
/
10-Tools.zip
/
tv20cpp.zip
/
tvision
/
tvobjs.h
< prev
next >
Wrap
C/C++ Source or Header
|
1998-01-19
|
3KB
|
132 lines
/*
* tvobjs.h
*
* Turbo Vision - Version 2.0
*
* Copyright (c) 1994 by Borland International
* All Rights Reserved.
*
* Modified by Sergio Sigala <ssigala@globalnet.it>
*/
#if defined( Uses_TObject ) && !defined( __TObject )
#define __TObject
#include <stddef.h>
class TObject
{
public:
virtual ~TObject();
static void destroy( TObject * );
virtual void shutDown();
private:
};
inline void TObject::destroy( TObject *o )
{
if( o != 0 )
o->shutDown();
delete o;
}
#endif // Uses_TObject
#if defined( Uses_TNSCollection ) && !defined( __TNSCollection )
#define __TNSCollection
class TNSCollection : public TObject
{
public:
TNSCollection( ccIndex aLimit, ccIndex aDelta );
~TNSCollection();
virtual void shutDown();
void *at( ccIndex index );
virtual ccIndex indexOf( void *item );
void atFree( ccIndex index );
void atRemove( ccIndex index );
void remove( void *item );
void removeAll();
void free( void *item );
void freeAll();
void atInsert( ccIndex index, void *item );
void atPut( ccIndex index, void *item );
virtual ccIndex insert( void *item );
#ifndef __UNPATCHED
virtual void error( ccIndex code, ccIndex info );
#else
static void error( ccIndex code, ccIndex info );
#endif
void *firstThat( ccTestFunc Test, void *arg );
void *lastThat( ccTestFunc Test, void *arg );
void forEach( ccAppFunc action, void *arg );
void pack();
virtual void setLimit( ccIndex aLimit );
ccIndex getCount()
{ return count; }
protected:
TNSCollection();
void **items;
ccIndex count;
ccIndex limit;
ccIndex delta;
Boolean shouldDelete;
private:
virtual void freeItem( void *item );
};
#endif // Uses_TNSCollection
#if defined( Uses_TNSSortedCollection ) && !defined( __TNSSortedCollection )
#define __TNSSortedCollection
class TNSSortedCollection: public virtual TNSCollection
{
public:
TNSSortedCollection( ccIndex aLimit, ccIndex aDelta) :
TNSCollection( aLimit, aDelta ), duplicates(False)
{ delta = aDelta; setLimit( aLimit ); }
virtual Boolean search( void *key, ccIndex& index );
virtual ccIndex indexOf( void *item );
virtual ccIndex insert( void *item );
Boolean duplicates;
virtual void *keyOf( void *item );
protected:
TNSSortedCollection() : duplicates(False) {}
private:
virtual int compare( void *key1, void *key2 ) = 0;
};
#endif // Uses_TNSSortedCollection