3
MediaTomb - http://www.mediatomb.cc/
5
array.h - this file is part of MediaTomb.
7
Copyright (C) 2005 Gena Batyan <bgeradz@mediatomb.cc>,
8
Sergey 'Jin' Bostandzhyan <jin@mediatomb.cc>
10
Copyright (C) 2006-2007 Gena Batyan <bgeradz@mediatomb.cc>,
11
Sergey 'Jin' Bostandzhyan <jin@mediatomb.cc>,
12
Leonhard Wimmer <leo@mediatomb.cc>
14
MediaTomb is free software; you can redistribute it and/or modify
15
it under the terms of the GNU General Public License version 2
16
as published by the Free Software Foundation.
18
MediaTomb is distributed in the hope that it will be useful,
19
but WITHOUT ANY WARRANTY; without even the implied warranty of
20
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
GNU General Public License for more details.
23
You should have received a copy of the GNU General Public License
24
version 2 along with MediaTomb; if not, write to the Free Software
25
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
27
$Id: array.h 1294 2007-05-13 16:28:24Z lww $
32
#ifndef __ZMMF_ARRAY_H__
33
#define __ZMMF_ARRAY_H__
37
#define DEFAULT_ARRAY_CAPACITY 16
47
void init(int capacity);
48
void append(Object *el);
49
void set(Object *el, int index);
50
Object *get(int index);
51
void remove(int index, int count);
52
void removeUnordered(int index);
53
void insert(int index, Object *el);
54
inline int size() { return siz; }
57
void resize(int requiredSize);
67
class Array : public Object
73
inline Array() : Object()
75
base.init(DEFAULT_ARRAY_CAPACITY);
77
inline Array(int capacity) : Object()
82
inline void append(Ref<T> el)
84
base.append(el.getPtr());
86
inline void set(Ref<T> el, int index)
88
base.set(el.getPtr(), index);
90
inline Ref<T> get(int index)
92
return Ref<T>( (T *)base.get(index) );
94
inline void remove(int index, int count=1)
96
base.remove(index, count);
98
inline void removeUnordered(int index)
100
base.removeUnordered(index);
102
inline void insert(int index, Ref<T> el)
104
base.insert(index, el.getPtr());
110
inline void optimize()
115
inline Object **getObjectArray()
124
#endif // __ZMMF_ARRAY_H__