ReactOS 0.4.15-dev-8417-gb6b82fe
CicArray< T_ITEM > Class Template Reference

#include <cicarray.h>

Inheritance diagram for CicArray< T_ITEM >:
Collaboration diagram for CicArray< T_ITEM >:

Public Member Functions

 CicArray ()
 
T_ITEM * data () const
 
size_t size () const
 
bool empty () const
 
void clear ()
 
T_ITEM & operator[] (size_t iItem)
 
const T_ITEM & operator[] (size_t iItem) const
 
T_ITEM * Append (size_t cGrow)
 
BOOL Add (const T_ITEM &item)
 
ptrdiff_t Find (const T_ITEM &item) const
 
BOOL Insert (size_t iItem, size_t cGrow)
 
void Remove (size_t iItem, size_t cRemove=1)
 

Additional Inherited Members

- Protected Member Functions inherited from CicArrayBase
 CicArrayBase (size_t cbItem)
 
virtual ~CicArrayBase ()
 
BOOL Insert (size_t iItem, size_t cGrow)
 
LPVOID Append (size_t cGrow)
 
void Remove (size_t iItem, size_t cRemove=1)
 
- Protected Attributes inherited from CicArrayBase
LPBYTE m_pb
 
size_t m_cItems
 
size_t m_cbItem
 
size_t m_cCapacity
 

Detailed Description

template<typename T_ITEM>
class CicArray< T_ITEM >

Definition at line 28 of file cicarray.h.

Constructor & Destructor Documentation

◆ CicArray()

template<typename T_ITEM >
CicArray< T_ITEM >::CicArray ( )
inline

Definition at line 31 of file cicarray.h.

31: CicArrayBase(sizeof(T_ITEM)) { }

Member Function Documentation

◆ Add()

template<typename T_ITEM >
BOOL CicArray< T_ITEM >::Add ( const T_ITEM &  item)
inline

Definition at line 60 of file cicarray.h.

61 {
62 T_ITEM *pItem = Append(1);
63 if (!pItem)
64 return FALSE;
65 CopyMemory(pItem, &item, sizeof(T_ITEM));
66 return TRUE;
67 }
T_ITEM * Append(size_t cGrow)
Definition: cicarray.h:52
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
static ATOM item
Definition: dde.c:856
#define CopyMemory
Definition: winbase.h:1710

Referenced by CTipbarWnd::_CreateThread(), CTipbarAccessible::AddAccItem(), CStaticIconList::AddIcon(), CCicLibMenu::AddMenuItem(), CTipbarWnd::AddThreadToThreadCreatingList(), CTrayIconWnd::CreateWnd(), CTipbarAccessible::CTipbarAccessible(), InitDisplayAttrbuteLib(), CUIFMenu::InsertItem(), CUIFMenu::InsertSeparator(), and CTrayIconWnd::SetIcon().

◆ Append()

template<typename T_ITEM >
T_ITEM * CicArray< T_ITEM >::Append ( size_t  cGrow)
inline

Definition at line 52 of file cicarray.h.

53 {
54 return (T_ITEM*)CicArrayBase::Append(cGrow);
55 }
LPVOID Append(size_t cGrow)
Definition: cicarray.cpp:23

Referenced by CCompartmentEventSink::_Advise(), and CicArray< T_ITEM >::Add().

◆ clear()

template<typename T_ITEM >
void CicArray< T_ITEM >::clear ( )
inline

Definition at line 36 of file cicarray.h.

37 {
39 m_pb = NULL;
41 }
static void cicMemFree(LPVOID ptr)
Definition: cicbase.h:27
size_t m_cCapacity
Definition: cicarray.h:16
size_t m_cItems
Definition: cicarray.h:16
LPBYTE m_pb
Definition: cicarray.h:15
#define NULL
Definition: types.h:112

Referenced by CTipbarThread::_UninitItemList(), CTipbarAccessible::ClearAccItems(), CPolyText::RemoveAll(), CTipbarThread::RemoveAllSeparators(), CTipbarWnd::UnInit(), and CUIFObject::~CUIFObject().

◆ data()

template<typename T_ITEM >
T_ITEM * CicArray< T_ITEM >::data ( ) const
inline

Definition at line 33 of file cicarray.h.

33{ return (T_ITEM*)m_pb; }

Referenced by CCompartmentEventSink::_Unadvise().

◆ empty()

template<typename T_ITEM >
bool CicArray< T_ITEM >::empty ( ) const
inline

Definition at line 35 of file cicarray.h.

35{ return !size(); }
size_t size() const
Definition: cicarray.h:34

◆ Find()

template<typename T_ITEM >
ptrdiff_t CicArray< T_ITEM >::Find ( const T_ITEM &  item) const
inline

Definition at line 69 of file cicarray.h.

70 {
71 for (size_t iItem = 0; iItem < m_cItems; ++iItem)
72 {
73 if ((*this)[iItem] == item)
74 return iItem;
75 }
76 return -1;
77 }

Referenced by CTipbarWnd::CleanUpThreadPointer(), and CTipbarWnd::RemoveThredFromThreadCreatingList().

◆ Insert()

template<typename T_ITEM >
BOOL CicArrayBase::Insert ( size_t  iItem,
size_t  cGrow 
)

Definition at line 22 of file cicarray.cpp.

31{
32 size_t cNewCapacity = m_cItems + cGrow;
33 if (m_cCapacity < cNewCapacity)
34 {
35 if (cNewCapacity <= m_cItems + m_cItems / 2)
36 cNewCapacity = m_cItems + m_cItems / 2;
37
38 LPBYTE pbNew = (LPBYTE)cicMemReAlloc(m_pb, cNewCapacity * m_cbItem);
39 if (!pbNew)
40 return FALSE;
41
42 m_pb = pbNew;
43 m_cCapacity = cNewCapacity;
44 }
45
46 if (iItem < m_cItems)
47 {
48 MoveMemory(&m_pb[(cGrow + iItem) * m_cbItem],
49 &m_pb[iItem * m_cbItem],
50 (m_cItems - iItem) * m_cbItem);
51 }
52
53 m_cItems += cGrow;
54 return TRUE;
55}
static LPVOID cicMemReAlloc(LPVOID ptr, SIZE_T newSize)
Definition: cicbase.h:20
size_t m_cbItem
Definition: cicarray.h:16
unsigned char * LPBYTE
Definition: typedefs.h:53
#define MoveMemory
Definition: winbase.h:1709

◆ operator[]() [1/2]

template<typename T_ITEM >
T_ITEM & CicArray< T_ITEM >::operator[] ( size_t  iItem)
inline

Definition at line 43 of file cicarray.h.

44 {
45 return *(T_ITEM*)&m_pb[iItem * m_cbItem];
46 }

◆ operator[]() [2/2]

template<typename T_ITEM >
const T_ITEM & CicArray< T_ITEM >::operator[] ( size_t  iItem) const
inline

Definition at line 47 of file cicarray.h.

48 {
49 return *(const T_ITEM*)&m_pb[iItem * m_cbItem];
50 }

◆ Remove()

template<typename T_ITEM >
void CicArrayBase::Remove ( size_t  iItem,
size_t  cRemove = 1 
)

Definition at line 24 of file cicarray.cpp.

58{
59 if (iItem + cRemove < m_cItems)
60 {
61 MoveMemory(&m_pb[iItem * m_cbItem],
62 &m_pb[(iItem + cRemove) * m_cbItem],
63 (m_cItems - iItem - cRemove) * m_cbItem);
64 }
65
66 m_cItems -= cRemove;
67
68 size_t cHalfCapacity = m_cCapacity / 2;
69 if (cHalfCapacity <= m_cItems)
70 return;
71
72 LPBYTE pb = (LPBYTE)cicMemReAlloc(m_pb, cHalfCapacity * m_cbItem);
73 if (pb)
74 {
75 m_pb = pb;
76 m_cCapacity = cHalfCapacity;
77 }
78}

Referenced by CCompartmentEventSink::_Advise(), CTipbarWnd::CleanUpThreadPointer(), CTipbarWnd::OnThreadTerminateInternal(), CTipbarAccessible::RemoveAccItem(), CPolyText::RemoveLastLine(), and CTipbarWnd::RemoveThredFromThreadCreatingList().

◆ size()

template<typename T_ITEM >
size_t CicArray< T_ITEM >::size ( ) const
inline

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