ZFFramework
Loading...
Searching...
No Matches
ZFArray.h
Go to the documentation of this file.
1
5
6#ifndef _ZFI_ZFArray_h_
7#define _ZFI_ZFArray_h_
8
9#include "ZFContainer.h"
10
12
13zfclassFwd _ZFP_ZFArrayPrivate;
22zfclass ZFLIB_ZFCore ZFArray : zfextend ZFContainer {
23 ZFOBJECT_DECLARE(ZFArray, ZFContainer)
24
25public:
30
31
35
41 ZF_IN ZFObject *obj
42 , ZF_IN_OPT ZFComparer<ZFObject *>::Comparer comparer = ZFComparerDefault
43 );
49 , ZFMP_IN(ZFObject *, obj)
50 , ZFMP_IN(const ZFListener &, comparer)
51 )
52
57 , ZFMP_IN(zfindex, index)
58 )
59
64
69
73 virtual zfindex find(
74 ZF_IN ZFObject *obj
75 , ZF_IN_OPT ZFComparer<ZFObject *>::Comparer comparer = ZFComparerDefault
76 );
81 , ZFMP_IN(ZFObject *, obj)
82 , ZFMP_IN(const ZFListener &, comparer)
83 )
84
89 ZF_IN ZFObject *obj
90 , ZF_IN_OPT ZFComparer<ZFObject *>::Comparer comparer = ZFComparerDefault
91 );
96 , ZFMP_IN(ZFObject *, obj)
97 , ZFMP_IN(const ZFListener &, comparer)
98 )
99
100public:
107 , ZFMP_IN(ZFObject *, obj)
108 , ZFMP_IN(zfindex, indexAddTo)
114 , ZFMP_IN(ZFObject *, obj)
120 , ZFMP_IN(ZFContainer *, another)
122
127 , ZFMP_IN(zfindex, index)
128 , ZFMP_IN(ZFObject *, obj)
130
135 ZF_IN ZFObject *obj
136 , ZF_IN_OPT ZFComparer<ZFObject *>::Comparer comparer = ZFComparerDefault
137 );
142 , ZFMP_IN(ZFObject *, obj)
143 , ZFMP_IN(const ZFListener &, comparer)
149 ZF_IN ZFObject *obj
150 , ZF_IN_OPT ZFComparer<ZFObject *>::Comparer comparer = ZFComparerDefault
151 );
156 , ZFMP_IN(ZFObject *, obj)
157 , ZFMP_IN(const ZFListener &, comparer)
163 ZF_IN ZFObject *obj
164 , ZF_IN_OPT ZFComparer<ZFObject *>::Comparer comparer = ZFComparerDefault
165 );
170 , ZFMP_IN(ZFObject *, obj)
171 , ZFMP_IN(const ZFListener &, comparer)
173
178 , ZFMP_IN(zfindex, index)
185 , ZFMP_IN(zfindex, index)
207
212 , ZFMP_IN(zfindex, fromIndex)
213 , ZFMP_IN(zfindex, toIndexOrIndexMax)
215
219 virtual void sort(
220 ZF_IN_OPT zfindex start = 0
222 , ZF_IN_OPT ZFComparer<ZFObject *>::Comparer comparer = ZFComparerDefault
223 );
228 , ZFMP_IN(zfindex, start)
230 , ZFMP_IN(const ZFListener &, comparer)
235 virtual void sortReversely(
236 ZF_IN_OPT zfindex start = 0
238 , ZF_IN_OPT ZFComparer<ZFObject *>::Comparer comparer = ZFComparerDefault
239 );
244 , ZFMP_IN(zfindex, start)
246 , ZFMP_IN(const ZFListener &, comparer)
248
249 // ============================================================
250 // extra iterable
251public:
254 , ZFMP_IN(zfindex, index)
256
257 // ============================================================
258 // ZFIterable
259public:
262
265 , ZFMP_IN(ZFObject *, element)
267
270 , ZFMP_IN(const zfiter &, it)
272
273public:
276 , ZFMP_IN_OUT(zfiter &, it)
277 , ZFMP_IN(ZFObject *, value)
281 , ZFMP_IN_OUT(zfiter &, it)
283
286 , ZFMP_IN(ZFObject *, value)
290 , ZFMP_IN(ZFObject *, value)
291 , ZFMP_IN_OUT(zfiter &, it)
293
294protected:
296 ZFOBJECT_ON_INIT_DECLARE_1(ZFMP_IN(ZFContainer *, another))
298 virtual void objectOnInit(void);
300 virtual void objectOnDealloc(void);
301
302private:
303 _ZFP_ZFArrayPrivate *d;
304};
305
307#endif // #ifndef _ZFI_ZFArray_h_
308
#define ZFComparerDefault
default comparer for common types, see ZFComparer
Definition ZFComparer.h:250
container of ZFObject
#define ZFLIB_ZFCore
used to export symbols
Definition ZFCoreEnvDef.h:30
#define zfextend
dummy macro shows class inherit from another
Definition ZFCoreTypeDef_ClassType.h:53
#define zfoverride
dummy macro shows that method override parent's method
Definition ZFCoreTypeDef_ClassType.h:58
#define ZF_IN
dummy macro that shows the param used as required input
Definition ZFCoreTypeDef_ClassType.h:184
#define ZF_IN_OPT
dummy macro that shows the param used as optional input
Definition ZFCoreTypeDef_ClassType.h:188
#define zfclassFwd
forward declaration of a class type
Definition ZFCoreTypeDef_ClassType.h:31
_ZFT_t_zfbool zfbool
bool type
Definition ZFCoreTypeDef_CoreType.h:103
_ZFT_t_zfindex zfindex
similar to size_t, used for index and size only
Definition ZFCoreTypeDef_CoreType.h:154
#define zfindexMax()
(zfindex)-1, indicate a max index value, see zfindex
Definition ZFCoreTypeDef_CoreType.h:159
#define ZFMP_IN_OUT(ParamType, paramName)
see ZFMP_IN
Definition ZFMethod.h:117
#define ZFMP_IN_OPT(ParamType, paramName, DefaultValue)
see ZFMP_IN
Definition ZFMethod.h:108
#define ZFMP_IN(ParamType, paramName)
macro to wrap param types for ZFMETHOD_INLINE_0 series
Definition ZFMethod.h:105
#define ZFMETHOD_DECLARE_0(ReturnType, MethodName)
see ZFMethod
Definition ZFMethodDeclare.h:693
#define ZFMETHOD_DECLARE_2(ReturnType, MethodName, ZFMP_0, ZFMP_1)
see ZFMethod
Definition ZFMethodDeclare.h:1025
#define ZFMETHOD_DECLARE_3(ReturnType, MethodName, ZFMP_0, ZFMP_1, ZFMP_2)
see ZFMethod
Definition ZFMethodDeclare.h:1206
#define ZFMETHOD_DECLARE_1(ReturnType, MethodName, ZFMP_0)
see ZFMethod
Definition ZFMethodDeclare.h:854
#define ZF_NAMESPACE_GLOBAL_BEGIN
begin namespace ZFFramework
Definition ZFNamespace.h:97
#define ZF_NAMESPACE_GLOBAL_END
end namespace ZFFramework
Definition ZFNamespace.h:98
#define zfclass
same as class, shows that this class is a ZFObject type
Definition ZFObjectClassTypeFwd.h:38
#define ZFOBJECT_ON_INIT_DECLARE_1(ZFMP_0)
see ZFOBJECT_ON_INIT_INLINE_1
Definition ZFObjectDeclare.h:263
#define ZFOBJECT_DECLARE(ChildClass, SuperClass,...)
necessary for every class inherit from ZFObject
Definition ZFObjectDeclare.h:126
virtual zfbool isContain(ZFObject *obj, ZFComparer< ZFObject * >::Comparer comparer=_ZFP_ZFComparerDefault)
return true if contains the object, compared by instance compare by default
virtual void removeAll()
remove all object
virtual zfauto removeAndGet(zfindex index)
remove object at index and return removed item, assert failure if out of range
virtual void removeLast()
remove last object, assert fail if out of range
virtual void iterAdd(ZFObject *value)
see zfiter
virtual zfany getLast()
return last object, assert failure if out of range
virtual zfauto removeFirstAndGet()
remove first object and return removed item, assert fail if out of range
virtual zfbool removeElement(ZFObject *obj, ZFComparer< ZFObject * >::Comparer comparer=_ZFP_ZFComparerDefault)
remove first matched object, return whether the element removed
virtual zfindex findReversely(ZFObject *obj, ZFComparer< ZFObject * >::Comparer comparer=_ZFP_ZFComparerDefault)
find element, compared by instance compare by default
virtual void addFrom(ZFContainer *another)
add objects from another container
virtual zfiter iterFind(ZFObject *element)
see zfiter
virtual void objectOnInit(ZFContainer *another)
see ZFObject::objectOnInit
virtual zfany iterValue(const zfiter &it)
see zfiter
virtual zfany get(zfindex index)
return object at index, assert failure if out of range
virtual void sort(zfindex start=0, zfindex count=((zfindex) -1), ZFComparer< ZFObject * >::Comparer comparer=_ZFP_ZFComparerDefault)
sort content in range [start, start + count), all of content must be comparable
virtual zfbool isEmpty()
return true if empty or false if not empty
virtual zfauto removeLastAndGet()
remove last object and return removed item, assert fail if out of range
virtual zfbool removeElementReversely(ZFObject *obj, ZFComparer< ZFObject * >::Comparer comparer=_ZFP_ZFComparerDefault)
remove last matched object, return whether the element removed
virtual void set(zfindex index, ZFObject *obj)
replace object at index, assert fail if index out of range
virtual zfiter iter()
see zfiter
virtual zfany getFirst()
return first object, assert failure if out of range
virtual void add(ZFObject *obj, zfindex indexAddTo)
insert object at index, assert failure if obj = zfnull or index out of range [0, count]
virtual void remove(zfindex index, zfindex count=(1))
remove object at index, assert failure if out of range
virtual zfindex removeElementAll(ZFObject *obj, ZFComparer< ZFObject * >::Comparer comparer=_ZFP_ZFComparerDefault)
remove all matched object, return number of element removed
virtual void iterRemove(zfiter &it)
see zfiter
virtual zfindex count()
return number of content
virtual void move(zfindex fromIndex, zfindex toIndexOrIndexMax)
move element
virtual zfiter iterForIndex(zfindex index)
see zfiter
virtual void objectOnDealloc(void)
override this to destroy your object
virtual zfindex find(ZFObject *obj, ZFComparer< ZFObject * >::Comparer comparer=_ZFP_ZFComparerDefault)
find element, compared by instance compare by default
virtual void removeFirst()
remove first object, assert fail if out of range
virtual void sortReversely(zfindex start=0, zfindex count=((zfindex) -1), ZFComparer< ZFObject * >::Comparer comparer=_ZFP_ZFComparerDefault)
sort content in range [start, start + count), all of content must be comparable
comparar for template types
Definition ZFCoreTypeDef_OtherType.h:125
listener as ZFCallback, mostly used by ZFObject::observerNotify
Definition ZFObjectObserver.h:30
util method to cast ZFObject types freely
Definition zfany.h:35
a ZFObject holder which would release content object automatically when destroyed
Definition zfautoFwd.h:34
iterator for ZFFramework
Definition zfiter.h:40