blob: f33656f6b041832a33bc3e947b7bd5c54522c9ca (
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
|
/*
* CENA C++ Utilities
*
* by Stephane Chatty
*
* Copyright 1990, 1991, 1992
* Laboratoire de Recherche en Informatique (LRI)
* Centre d'Etudes de la Navigation Aerienne (CENA)
*
* plain and generic arrays (orginal C version by Michel Beaudouin-Lafon)
*
* $Id$
* $CurLog$
*/
#ifndef Array_H_
#define Array_H_
#include "cplus_bugs.h"
typedef void CcuArrayItem;
class CcuArray {
protected:
static CcuArrayItem* InvalidCell;
int Length;
CcuArrayItem** Data;
void Clean ();
public:
CcuArray (int size, CcuArrayItem* = 0);
CcuArray (const CcuArray&);
~CcuArray ();
void Reset (CcuArrayItem* = 0);
CcuArrayItem*& operator [] (int i) const;
CcuArrayItem** operator + (int) const;
CcuArray& operator = (const CcuArray&);
inline int Check (int i) const { return (i >= 0 && i < Length); }
inline int GetSize () const { return Length; }
void Resize (int, CcuArrayItem* = 0);
};
#ifndef CPLUS_BUG19
template <class ITEM> class CcuArrayOf : public CcuArray {
public:
inline CcuArrayOf (int size, ITEM* value = 0) : CcuArray (size, value) {}
inline CcuArrayOf (const CcuArrayOf& a) : CcuArray (a) {}
inline ~CcuArrayOf () {}
inline void Reset (ITEM* value = 0) { CcuArray::Reset (value); }
inline void Resize (int size, ITEM* value = 0) { CcuArray::Resize (size, value); }
inline ITEM*& operator [] (int i) const { return (ITEM*&) ((* (CcuArray*) this)[i]); }
inline ITEM** operator + (int i) const { return (ITEM**) ((*(CcuArray*) this) + i); }
};
#endif
#endif /* Array_H_ */
|