2 * Copyright 1995, 1996 Perforce Software. All rights reserved.
6 * VarArray.h - manage a list of void *'s
10 * VarArray - list of void *'s
14 * VarArray::Clear() - zero out count for values
15 * VarArray::Count() - return count of elements in array
16 * VarArray::ElemTab() - return a pointer to the array
17 * VarArray::Get(i) - return a pointer to slot i in the array
18 * VarArray::Move(i,j) - move element i to j
19 * VarArray::Put(v) - set a new slot to v
20 * VarArray::WillGrow(i) - returns size of new vararray if it
21 * would have to grow in the next i rows.
25 * VarArray::New() - return a pointer to a new slot in the array
36 void Clear() { numElems
= 0; }
37 int Count() const { return numElems
; }
38 void ** ElemTab() { return elems
; }
39 void * Get( int i
) const { return i
<numElems
? elems
[i
]:0; }
40 void Move( int i
, int j
) { elems
[j
] = elems
[i
]; }
41 void Exchange( int i
, int j
)
42 { void *t
= elems
[j
]; elems
[j
] = elems
[i
]; elems
[i
] = t
; }
43 void * Put( void *v
) { return *New() = v
; }
44 void SetCount( int i
) { numElems
= i
; }
45 int WillGrow( int interval
);