1 //========================================================================
5 // Copyright 1996-2003 Glyph & Cog, LLC
7 //========================================================================
11 #ifdef USE_GCC_PRAGMAS
12 #pragma implementation
21 //------------------------------------------------------------------------
23 //------------------------------------------------------------------------
25 Array::Array(XRef
*xrefA
) {
35 for (i
= 0; i
< length
; ++i
)
40 void Array::add(Object
*elem
) {
48 for (int k
= 0; k
< length
; ++k
)
49 if (!elems
[k
].isNone() && !elems
[k
].isNull())
50 objTracker
.unTrack(&elems
[k
]);
52 elems
= (Object
*)greallocn(elems
, size
, sizeof(Object
));
54 for (int k
= 0; k
< length
; ++k
)
55 if (!elems
[k
].isNone() && !elems
[k
].isNull())
56 objTracker
.track(&elems
[k
]);
59 elems
[length
] = *elem
;
66 Object
*Array::get(int i
, Object
*obj
) {
67 if (i
< 0 || i
>= length
) {
71 return obj
->initNull();
74 return elems
[i
].fetch(xref
, obj
);
77 Object
*Array::getNF(int i
, Object
*obj
) {
78 if (i
< 0 || i
>= length
) {
82 return obj
->initNull();
85 return elems
[i
].copy(obj
);