author | sandman <sandman> | 2002-04-13 00:47:20 (UTC) |
---|---|---|
committer | sandman <sandman> | 2002-04-13 00:47:20 (UTC) |
commit | 98a1e3f36567639344f12932b629e526a8783aa8 (patch) (unidiff) | |
tree | 0433d296857faceeafc54f7deabddb621f45a933 /noncore/unsupported/qpdf/xpdf/Array.cc | |
parent | 7e31b1fba119f69929d6744d7295555ff1727f4f (diff) | |
download | opie-98a1e3f36567639344f12932b629e526a8783aa8.zip opie-98a1e3f36567639344f12932b629e526a8783aa8.tar.gz opie-98a1e3f36567639344f12932b629e526a8783aa8.tar.bz2 |
CVS import of QPdf
Diffstat (limited to 'noncore/unsupported/qpdf/xpdf/Array.cc') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/unsupported/qpdf/xpdf/Array.cc | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/noncore/unsupported/qpdf/xpdf/Array.cc b/noncore/unsupported/qpdf/xpdf/Array.cc new file mode 100644 index 0000000..5743fe6 --- a/dev/null +++ b/noncore/unsupported/qpdf/xpdf/Array.cc | |||
@@ -0,0 +1,53 @@ | |||
1 | //======================================================================== | ||
2 | // | ||
3 | // Array.cc | ||
4 | // | ||
5 | // Copyright 1996 Derek B. Noonburg | ||
6 | // | ||
7 | //======================================================================== | ||
8 | |||
9 | #ifdef __GNUC__ | ||
10 | #pragma implementation | ||
11 | #endif | ||
12 | |||
13 | #include <aconf.h> | ||
14 | #include <stddef.h> | ||
15 | #include "gmem.h" | ||
16 | #include "Object.h" | ||
17 | #include "Array.h" | ||
18 | |||
19 | //------------------------------------------------------------------------ | ||
20 | // Array | ||
21 | //------------------------------------------------------------------------ | ||
22 | |||
23 | Array::Array(XRef *xrefA) { | ||
24 | xref = xrefA; | ||
25 | elems = NULL; | ||
26 | size = length = 0; | ||
27 | ref = 1; | ||
28 | } | ||
29 | |||
30 | Array::~Array() { | ||
31 | int i; | ||
32 | |||
33 | for (i = 0; i < length; ++i) | ||
34 | elems[i].free(); | ||
35 | gfree(elems); | ||
36 | } | ||
37 | |||
38 | void Array::add(Object *elem) { | ||
39 | if (length + 1 > size) { | ||
40 | size += 8; | ||
41 | elems = (Object *)grealloc(elems, size * sizeof(Object)); | ||
42 | } | ||
43 | elems[length] = *elem; | ||
44 | ++length; | ||
45 | } | ||
46 | |||
47 | Object *Array::get(int i, Object *obj) { | ||
48 | return elems[i].fetch(xref, obj); | ||
49 | } | ||
50 | |||
51 | Object *Array::getNF(int i, Object *obj) { | ||
52 | return elems[i].copy(obj); | ||
53 | } | ||