ReactOS 0.4.15-dev-7958-gcd0bb1a
CPointerArray< T, GrowthRate > Class Template Reference

#include <rosui.h>

Collaboration diagram for CPointerArray< T, GrowthRate >:

Public Member Functions

 CPointerArray ()
 
 ~CPointerArray ()
 
virtual BOOL OnRemoveItem (T *ptr)
 
virtual INT OnCompareItems (T *p1, T *p2)
 
INT GetCount () const
 
TGet (INT i) const
 
BOOL Set (INT i, T *ptr)
 
INT Insert (INT at, T *ptr)
 
INT Append (T *ptr)
 
INT IndexOf (T *ptr) const
 
BOOL Remove (T *ptr)
 
BOOL RemoveAt (INT i)
 
BOOL Clear ()
 
BOOL Sort ()
 
INT Search (T *item, INT iStart, UINT uFlags)
 

Protected Attributes

HDPA m_hDpa
 

Static Private Member Functions

static INT CALLBACK s_OnRemoveItem (PVOID ptr, PVOID context)
 
static INT CALLBACK s_OnCompareItems (PVOID p1, PVOID p2, LPARAM lParam)
 

Detailed Description

template<class T, INT GrowthRate = 10>
class CPointerArray< T, GrowthRate >

Definition at line 12 of file rosui.h.

Constructor & Destructor Documentation

◆ CPointerArray()

template<class T , INT GrowthRate = 10>
CPointerArray< T, GrowthRate >::CPointerArray ( )
inline

Definition at line 18 of file rosui.h.

19 {
20 m_hDpa = DPA_Create(GrowthRate);
21 }
HDPA m_hDpa
Definition: rosui.h:15
HDPA WINAPI DPA_Create(INT nGrow)
Definition: dpa.c:950

◆ ~CPointerArray()

template<class T , INT GrowthRate = 10>
CPointerArray< T, GrowthRate >::~CPointerArray ( )
inline

Definition at line 23 of file rosui.h.

24 {
26 }
static INT CALLBACK s_OnRemoveItem(PVOID ptr, PVOID context)
Definition: rosui.h:30
void WINAPI DPA_DestroyCallback(HDPA hdpa, PFNDPAENUMCALLBACK enumProc, LPVOID lParam)
Definition: dpa.c:1003

Member Function Documentation

◆ Append()

template<class T , INT GrowthRate = 10>
INT CPointerArray< T, GrowthRate >::Append ( T ptr)
inline

◆ Clear()

template<class T , INT GrowthRate = 10>
BOOL CPointerArray< T, GrowthRate >::Clear ( )
inline

Definition at line 120 of file rosui.h.

121 {
124 }
BOOL WINAPI DPA_DeleteAllPtrs(HDPA hdpa)
Definition: dpa.c:730
VOID WINAPI DPA_EnumCallback(HDPA hdpa, PFNDPAENUMCALLBACK enumProc, LPVOID lParam)
Definition: dpa.c:969

◆ Get()

template<class T , INT GrowthRate = 10>
T * CPointerArray< T, GrowthRate >::Get ( INT  i) const
inline

Definition at line 69 of file rosui.h.

70 {
71 return (T *)DPA_GetPtr(m_hDpa, i);
72 }
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define T
Definition: mbstring.h:31
#define DPA_GetPtr
Definition: commctrl.h:5

Referenced by CUiPanel::ComputeContentBounds(), CUiPanel::ComputeMinimalSize(), CUiPanel::CountSizableChildren(), and CUiPanel::OnParentSize().

◆ GetCount()

template<class T , INT GrowthRate = 10>
INT CPointerArray< T, GrowthRate >::GetCount ( ) const
inline

Definition at line 63 of file rosui.h.

64 {
65 return DPA_GetPtrCount(m_hDpa);
66 }
#define DPA_GetPtrCount(hdpa)
Definition: commctrl.h:4955

Referenced by CUiPanel::ComputeContentBounds(), CUiPanel::ComputeMinimalSize(), CUiPanel::CountSizableChildren(), and CUiPanel::OnParentSize().

◆ IndexOf()

template<class T , INT GrowthRate = 10>
INT CPointerArray< T, GrowthRate >::IndexOf ( T ptr) const
inline

Definition at line 93 of file rosui.h.

94 {
95 return DPA_GetPtrIndex(m_hDpa, ptr);
96 }
INT WINAPI DPA_GetPtrIndex(HDPA hdpa, LPCVOID p)
Definition: dpa.c:561

Referenced by CPointerArray< T, GrowthRate >::Remove().

◆ Insert()

template<class T , INT GrowthRate = 10>
INT CPointerArray< T, GrowthRate >::Insert ( INT  at,
T ptr 
)
inline

Definition at line 81 of file rosui.h.

82 {
83 return DPA_InsertPtr(m_hDpa, at, ptr);
84 }

◆ OnCompareItems()

template<class T , INT GrowthRate = 10>
virtual INT CPointerArray< T, GrowthRate >::OnCompareItems ( T p1,
T p2 
)
inlinevirtual

Definition at line 51 of file rosui.h.

52 {
53 INT_PTR t = (reinterpret_cast<INT_PTR>(p2) - reinterpret_cast<INT_PTR>(p1));
54 if (t > 0)
55 return 1;
56 if (t < 0)
57 return -1;
58 return 0;
59 }
GLdouble GLdouble t
Definition: gl.h:2047
int32_t INT_PTR
Definition: typedefs.h:64

Referenced by CPointerArray< T, GrowthRate >::s_OnCompareItems().

◆ OnRemoveItem()

template<class T , INT GrowthRate = 10>
virtual BOOL CPointerArray< T, GrowthRate >::OnRemoveItem ( T ptr)
inlinevirtual

Reimplemented in CUiCollection.

Definition at line 45 of file rosui.h.

46 {
47 return TRUE;
48 }
#define TRUE
Definition: types.h:120

Referenced by CPointerArray< T, GrowthRate >::RemoveAt(), and CPointerArray< T, GrowthRate >::s_OnRemoveItem().

◆ Remove()

template<class T , INT GrowthRate = 10>
BOOL CPointerArray< T, GrowthRate >::Remove ( T ptr)
inline

Definition at line 99 of file rosui.h.

100 {
101 INT i = IndexOf(ptr);
102 if (i < 0)
103 return FALSE;
104 return RemoveAt(i);
105 }
BOOL RemoveAt(INT i)
Definition: rosui.h:108
INT IndexOf(T *ptr) const
Definition: rosui.h:93
#define FALSE
Definition: types.h:117
int32_t INT
Definition: typedefs.h:58

◆ RemoveAt()

template<class T , INT GrowthRate = 10>
BOOL CPointerArray< T, GrowthRate >::RemoveAt ( INT  i)
inline

Definition at line 108 of file rosui.h.

109 {
111 if (ptr != NULL)
112 {
113 OnRemoveItem(reinterpret_cast<T *>(ptr));
114 return TRUE;
115 }
116 return FALSE;
117 }
virtual BOOL OnRemoveItem(T *ptr)
Definition: rosui.h:45
#define NULL
Definition: types.h:112
LPVOID WINAPI DPA_DeletePtr(HDPA hdpa, INT i)
Definition: dpa.c:677

Referenced by CPointerArray< T, GrowthRate >::Remove().

◆ s_OnCompareItems()

template<class T , INT GrowthRate = 10>
static INT CALLBACK CPointerArray< T, GrowthRate >::s_OnCompareItems ( PVOID  p1,
PVOID  p2,
LPARAM  lParam 
)
inlinestaticprivate

Definition at line 37 of file rosui.h.

38 {
40 return self->OnCompareItems(reinterpret_cast<T *>(p1), reinterpret_cast<T *>(p2));
41 }
virtual INT OnCompareItems(T *p1, T *p2)
Definition: rosui.h:51
LPARAM lParam
Definition: combotst.c:139

Referenced by CPointerArray< T, GrowthRate >::Search(), and CPointerArray< T, GrowthRate >::Sort().

◆ s_OnRemoveItem()

template<class T , INT GrowthRate = 10>
static INT CALLBACK CPointerArray< T, GrowthRate >::s_OnRemoveItem ( PVOID  ptr,
PVOID  context 
)
inlinestaticprivate

Definition at line 30 of file rosui.h.

31 {
33 return (INT)self->OnRemoveItem(reinterpret_cast<T *>(ptr));
34 }
Definition: http.c:7252

Referenced by CPointerArray< T, GrowthRate >::Clear(), and CPointerArray< T, GrowthRate >::~CPointerArray().

◆ Search()

template<class T , INT GrowthRate = 10>
INT CPointerArray< T, GrowthRate >::Search ( T item,
INT  iStart,
UINT  uFlags 
)
inline

Definition at line 133 of file rosui.h.

134 {
135 return DPA_Search(m_hDpa, item, 0, s_OnCompareItems, (LPARAM)this, 0);
136 }
static INT CALLBACK s_OnCompareItems(PVOID p1, PVOID p2, LPARAM lParam)
Definition: rosui.h:37
INT WINAPI DPA_Search(HDPA hdpa, LPVOID pFind, INT nStart, PFNDPACOMPARE pfnCompare, LPARAM lParam, UINT uOptions)
Definition: dpa.c:845
static ATOM item
Definition: dde.c:856
LONG_PTR LPARAM
Definition: windef.h:208

◆ Set()

template<class T , INT GrowthRate = 10>
BOOL CPointerArray< T, GrowthRate >::Set ( INT  i,
T ptr 
)
inline

Definition at line 75 of file rosui.h.

76 {
77 return DPA_SetPtr(m_hDpa, i, ptr);
78 }
BOOL WINAPI DPA_SetPtr(HDPA hdpa, INT i, LPVOID p)
Definition: dpa.c:626

◆ Sort()

template<class T , INT GrowthRate = 10>
BOOL CPointerArray< T, GrowthRate >::Sort ( )
inline

Definition at line 127 of file rosui.h.

128 {
129 return DPA_Sort(m_hDpa, s_OnCompareItems, (LPARAM)this);
130 }
BOOL WINAPI DPA_Sort(HDPA hdpa, PFNDPACOMPARE pfnCompare, LPARAM lParam)
Definition: dpa.c:813

Member Data Documentation

◆ m_hDpa


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