ZFFramework
Loading...
Searching...
No Matches
Public Member Functions | List of all members
ZFCoreArray< T_Element > Class Template Reference

light weight array More...

#include <ZFCoreArray.h>

Inheritance diagram for ZFCoreArray< T_Element >:
ZFCoreArrayBase

Public Member Functions

 ZFCoreArray (void)
 main constructor
 
 ZFCoreArray (const ZFCoreArray< T_Element > &ref)
 construct from another array
 
virtual ZFCoreArrayBaserefNew (void) const
 new reference
 
virtual void * refImpl (void) const
 get the impl
 
ZFCoreArray< T_Element > & operator= (const ZFCoreArray< T_Element > &ref)
 retain the array, if you want to copy, use copyFrom instead
 
void swap (ZFCoreArray< T_Element > &ref)
 swap internal data
 
void copyFrom (const ZFCoreArray< T_Element > &ref)
 copy all settings and contents from another array
 
zfindex objectRetainCount (void) const
 get retain count
 
ZFCompareResult objectCompare (const ZFCoreArray< T_Element > &ref, typename ZFComparer< T_Element >::Comparer comparer=_ZFP_ZFComparerCheckEqual) const
 compare by content
 
virtual void objectInfoOfContentT (zfstring &ret, zfindex maxCount=((zfindex) -1), const ZFTokenForContainer &token=_ZFP_ZFTokenForContainerDefault) const
 return content info
 
void objectInfoOfContentT (zfstring &ret, zfindex maxCount, const ZFTokenForContainer &token, typename ZFCoreInfoGetter< T_Element >::InfoGetter infoGetter) const
 see objectInfoOfContent
 
zfstring objectInfoOfContent (zfindex maxCount=((zfindex) -1), const ZFTokenForContainer &token=_ZFP_ZFTokenForContainerDefault, typename ZFCoreInfoGetter< T_Element >::InfoGetter infoGetter=0) const
 return content info
 
virtual void capacity (zfindex newCapacity)
 change capacity to hold at least newCapacity
 
virtual void capacityTrim (void)
 trim current capacity
 
virtual zfindex capacity (void) const
 get capacity
 
void add (T_Element const &e)
 add element
 
void add (zfindex index, T_Element const &e)
 add element at index
 
void addFrom (const T_Element *src, zfindex count)
 add elements, src can be part of this array's buffer
 
void addFrom (const ZFCoreArray< T_Element > &ref)
 add from another array
 
zfindex find (T_Element const &e, typename ZFComparer< T_Element >::Comparer comparer=_ZFP_ZFComparerCheckEqual) const
 find element
 
zfindex findReversely (T_Element const &e, typename ZFComparer< T_Element >::Comparer comparer=_ZFP_ZFComparerCheckEqual) const
 find element reversely
 
template<typename T_Another >
zfindex find (T_Another const &e, typename ZFComparer< T_Element, T_Another >::Comparer comparer) const
 find element
 
template<typename T_Another >
zfindex findReversely (T_Another const &e, typename ZFComparer< T_Element, T_Another >::Comparer comparer) const
 find element reversely
 
zfbool removeElement (T_Element const &e, typename ZFComparer< T_Element >::Comparer comparer=_ZFP_ZFComparerCheckEqual)
 remove first matched element, return whether the element removed
 
template<typename T_Another >
zfbool removeElement (T_Another const &e, typename ZFComparer< T_Element, T_Another >::Comparer comparer)
 remove first matched element, return whether the element removed
 
zfbool removeElementReversely (T_Element const &e, typename ZFComparer< T_Element >::Comparer comparer=_ZFP_ZFComparerCheckEqual)
 remove last matched element, return whether the element removed
 
template<typename T_Another >
zfbool removeElementReversely (T_Another const &e, typename ZFComparer< T_Element, T_Another >::Comparer comparer)
 remove last matched element, return whether the element removed
 
zfindex removeElementAll (T_Element const &e, typename ZFComparer< T_Element >::Comparer comparer=_ZFP_ZFComparerCheckEqual)
 remove all matched element, return number of removed element
 
template<typename T_Another >
zfindex removeElementAll (T_Another const &e, typename ZFComparer< T_Element, T_Another >::Comparer comparer)
 remove all matched element, return number of removed element
 
virtual void remove (zfindex index)
 remove element at index with count, assert fail if out of range
 
virtual void remove (zfindex index, zfindex count)
 remove element at index with count, assert fail if out of range
 
T_Element removeAndGet (zfindex index)
 remove and return the removed value
 
virtual void removeFirst (void)
 remove first or do nothing if empty
 
T_Element removeFirstAndGet (void)
 remove first and return the removed value, or assert fail if empty
 
virtual void removeLast (void)
 remove last or do nothing if empty
 
T_Element removeLastAndGet (void)
 remove last and return the removed value, or assert fail if empty
 
virtual void removeAll (void)
 remove all content
 
virtual void move (zfindex fromIndex, zfindex toIndexOrIndexMax)
 move element
 
void set (zfindex index, T_Element const &e)
 set element at index, or assert fail if index out of range
 
T_Element & get (zfindex index)
 get element's reference at index
 
T_Element const & get (zfindex index) const
 get element's const reference at index
 
T_Element & operator[] (zfindex index)
 get element's reference at index
 
T_Element const & operator[] (zfindex index) const
 get element's const reference at index
 
T_Element const & getFirst (void) const
 try to get first element, assert fail if empty
 
T_Element const & getLast (void) const
 try to get first element, assert fail if empty
 
T_Element * arrayBuf (void)
 directly access the array
 
const T_Element * arrayBuf (void) const
 see arrayBuf
 
virtual zfindex count (void) const
 element count of this array
 
virtual zfbool isEmpty (void) const
 true if empty
 
void sort (zfindex start=0, zfindex count=((zfindex) -1), typename ZFComparer< T_Element >::Comparer elementComparer=_ZFP_ZFComparerDefault)
 sort element
 
void sortReversely (zfindex start=0, zfindex count=((zfindex) -1), typename ZFComparer< T_Element >::Comparer elementComparer=_ZFP_ZFComparerDefault)
 sort element
 
virtual void genericSwap (ZFCoreArrayBase &ref)
 generic version
 
virtual void genericCopyFrom (const ZFCoreArrayBase &ref)
 generic version
 
virtual void genericAdd (const void *e)
 generic version
 
virtual void genericAdd (zfindex index, const void *e)
 generic version
 
virtual void genericAddFrom (const void *e, zfindex count)
 generic version
 
virtual void genericAddFrom (const ZFCoreArrayBase &ref)
 generic version
 
virtual void genericSet (zfindex index, const void *e)
 generic version
 
virtual const void * genericGet (zfindex index) const
 generic version
 
- Public Member Functions inherited from ZFCoreArrayBase
virtual void refDelete (void)
 delete reference
 
virtual void objectInfoT (zfstring &ret) const
 see objectInfo
 
virtual zfstring objectInfo (void) const
 return object info
 
virtual zfstring objectInfoOfContent (zfindex maxCount=((zfindex) -1), const ZFTokenForContainer &token=_ZFP_ZFTokenForContainerDefault) const
 return content info
 

Detailed Description

template<typename T_Element>
class ZFCoreArray< T_Element >

light weight array

Warning
element must support: constructor with no argument, copy constructor to create from existing value, operator = to copy value

REMARKS:

Member Function Documentation

◆ refNew()

template<typename T_Element >
virtual ZFCoreArrayBase * ZFCoreArray< T_Element >::refNew ( void ) const
inlinevirtual

new reference

Implements ZFCoreArrayBase.

◆ refImpl()

template<typename T_Element >
virtual void * ZFCoreArray< T_Element >::refImpl ( void ) const
inlinevirtual

get the impl

Implements ZFCoreArrayBase.

◆ objectInfoOfContentT()

template<typename T_Element >
virtual void ZFCoreArray< T_Element >::objectInfoOfContentT ( zfstring & ret,
zfindex maxCount = ((zfindex) -1),
const ZFTokenForContainer & token = _ZFP_ZFTokenForContainerDefault ) const
inlinevirtual

return content info

Implements ZFCoreArrayBase.

◆ capacity() [1/2]

template<typename T_Element >
virtual void ZFCoreArray< T_Element >::capacity ( zfindex newCapacity)
inlinevirtual

change capacity to hold at least newCapacity

do nothing if newCapacity not changed or less than current capacity

Implements ZFCoreArrayBase.

◆ capacityTrim()

template<typename T_Element >
virtual void ZFCoreArray< T_Element >::capacityTrim ( void )
inlinevirtual

trim current capacity

do nothing if not necessary to trim

Implements ZFCoreArrayBase.

◆ capacity() [2/2]

template<typename T_Element >
virtual zfindex ZFCoreArray< T_Element >::capacity ( void ) const
inlinevirtual

get capacity

Implements ZFCoreArrayBase.

◆ remove() [1/2]

template<typename T_Element >
virtual void ZFCoreArray< T_Element >::remove ( zfindex index)
inlinevirtual

remove element at index with count, assert fail if out of range

Implements ZFCoreArrayBase.

◆ remove() [2/2]

template<typename T_Element >
virtual void ZFCoreArray< T_Element >::remove ( zfindex index,
zfindex count )
inlinevirtual

remove element at index with count, assert fail if out of range

Implements ZFCoreArrayBase.

◆ removeFirst()

template<typename T_Element >
virtual void ZFCoreArray< T_Element >::removeFirst ( void )
inlinevirtual

remove first or do nothing if empty

Implements ZFCoreArrayBase.

◆ removeLast()

template<typename T_Element >
virtual void ZFCoreArray< T_Element >::removeLast ( void )
inlinevirtual

remove last or do nothing if empty

Implements ZFCoreArrayBase.

◆ removeAll()

template<typename T_Element >
virtual void ZFCoreArray< T_Element >::removeAll ( void )
inlinevirtual

remove all content

Implements ZFCoreArrayBase.

◆ move()

template<typename T_Element >
virtual void ZFCoreArray< T_Element >::move ( zfindex fromIndex,
zfindex toIndexOrIndexMax )
inlinevirtual

move element

Implements ZFCoreArrayBase.

◆ arrayBuf()

template<typename T_Element >
T_Element * ZFCoreArray< T_Element >::arrayBuf ( void )
inline

directly access the array

Warning
the returned pointer may changed after modify the array
return null if current capacity is 0

◆ count()

template<typename T_Element >
virtual zfindex ZFCoreArray< T_Element >::count ( void ) const
inlinevirtual

element count of this array

Implements ZFCoreArrayBase.

◆ isEmpty()

template<typename T_Element >
virtual zfbool ZFCoreArray< T_Element >::isEmpty ( void ) const
inlinevirtual

true if empty

Implements ZFCoreArrayBase.

◆ genericSwap()

template<typename T_Element >
virtual void ZFCoreArray< T_Element >::genericSwap ( ZFCoreArrayBase & ref)
inlinevirtual

generic version

Implements ZFCoreArrayBase.

◆ genericCopyFrom()

template<typename T_Element >
virtual void ZFCoreArray< T_Element >::genericCopyFrom ( const ZFCoreArrayBase & ref)
inlinevirtual

generic version

Implements ZFCoreArrayBase.

◆ genericAdd() [1/2]

template<typename T_Element >
virtual void ZFCoreArray< T_Element >::genericAdd ( const void * e)
inlinevirtual

generic version

Implements ZFCoreArrayBase.

◆ genericAdd() [2/2]

template<typename T_Element >
virtual void ZFCoreArray< T_Element >::genericAdd ( zfindex index,
const void * e )
inlinevirtual

generic version

Implements ZFCoreArrayBase.

◆ genericAddFrom() [1/2]

template<typename T_Element >
virtual void ZFCoreArray< T_Element >::genericAddFrom ( const void * e,
zfindex count )
inlinevirtual

generic version

Implements ZFCoreArrayBase.

◆ genericAddFrom() [2/2]

template<typename T_Element >
virtual void ZFCoreArray< T_Element >::genericAddFrom ( const ZFCoreArrayBase & ref)
inlinevirtual

generic version

Implements ZFCoreArrayBase.

◆ genericSet()

template<typename T_Element >
virtual void ZFCoreArray< T_Element >::genericSet ( zfindex index,
const void * e )
inlinevirtual

generic version

Implements ZFCoreArrayBase.

◆ genericGet()

template<typename T_Element >
virtual const void * ZFCoreArray< T_Element >::genericGet ( zfindex index) const
inlinevirtual

generic version

Implements ZFCoreArrayBase.


The documentation for this class was generated from the following file: