blob: 323638202e761a658f12168fe0b00e9de6bcdb93 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
/*
* Turbo Vision - Version 2.0
*
* Copyright (c) 1994 by Borland International
* All Rights Reserved.
*
Modified by Robert H”hne to be used for RHIDE.
*
*
*/
#define Uses_TPWrittenObjects
#define Uses_TStreamableClass
#include <tv.h>
TPWrittenObjects::TPWrittenObjects() : TNSSortedCollection( 5, 5 ), curId( 0 )
{
// SET: Why this? it just leaks memory, anybody knows?
//shouldDelete = False;
}
TPWrittenObjects::~TPWrittenObjects()
{
}
void TPWrittenObjects::registerObject( const void *adr )
{
TPWObj *o = new TPWObj( adr, curId++ );
insert( o );
}
void TPWrittenObjects::freeItem( void *item )
{
delete (TPWObj *)item;
}
P_id_type TPWrittenObjects::find( const void *d )
{
ccIndex loc;
if( search( (void *)d, loc ) )
return ((TPWObj *)at( loc ))->ident;
else
return P_id_notFound;
}
void *TPWrittenObjects::keyOf( void *d )
{
return (void *)((TPWObj *)d)->address;
}
int TPWrittenObjects::compare( void *o1, void *o2 )
{
if( o1 == o2 )
return 0;
else if( ((char *)o1)+1 < ((char *)o2)+1 ) // force normalization
return -1;
else
return 1;
}
|