home *** CD-ROM | disk | FTP | other *** search
- //========================================================================
- //
- // Array.cc
- //
- // Copyright 1996 Derek B. Noonburg
- //
- //========================================================================
- //
- // Ported to EPOC by Sander van der Wal
- //
- // $Log: Array.cpp $
- // Revision 1.2 2000-09-17 13:38:26+02 svdwal
- // Ported
- //
-
- #ifdef __GNUC__
- #pragma implementation
- #endif
-
- #include "Array.h"
-
- // --o PdfLib
- #include "Object.h"
-
-
- #ifndef OOM
- static const TInt KArraySizeIncrement = 8;
- #else
- static const TInt KArraySizeIncrement = 1;
- #endif
-
- //------------------------------------------------------------------------
- // Array
- //------------------------------------------------------------------------
-
- Array::Array() {
- ref = 1;
- }
-
- Array::~Array() {
- int i;
-
- if (elems) {
- for (i = 0; i < length; ++i)
- elems[i].free();
- }
- User::Free(elems);
- }
-
- void Array::addL(Object *elem) {
- if (length + 1 > size) {
- size += KArraySizeIncrement;
- elems = (Object *)User::ReAllocL(elems, size * sizeof(Object));
- }
- elems[length] = *elem;
- ++length;
- }
-
- Object *Array::getL(int i, Object *obj) {
- return elems[i].fetchL(obj);
- }
-
- Object *Array::getNFL(int i, Object *obj) {
- return elems[i].copyL(obj);
- }
-