ReactOS 0.4.15-dev-7659-ga55345b
ATL::CComDynamicUnkArray Class Reference

#include <atlcom.h>

Collaboration diagram for ATL::CComDynamicUnkArray:

Public Member Functions

 CComDynamicUnkArray ()
 
 ~CComDynamicUnkArray ()
 
IUnknown ** begin ()
 
IUnknown ** end ()
 
IUnknownGetAt (int nIndex)
 
IUnknown *WINAPI GetUnknown (DWORD dwCookie)
 
DWORD WINAPI GetCookie (IUnknown **ppFind)
 
DWORD Add (IUnknown *pUnk)
 
BOOL Remove (DWORD dwCookie)
 

Public Attributes

int m_nSize
 
IUnknown ** m_ppUnk
 

Private Member Functions

CComDynamicUnkArrayoperator= (const CComDynamicUnkArray &)
 
 CComDynamicUnkArray (const CComDynamicUnkArray &)
 

Detailed Description

Definition at line 1106 of file atlcom.h.

Constructor & Destructor Documentation

◆ CComDynamicUnkArray() [1/2]

ATL::CComDynamicUnkArray::CComDynamicUnkArray ( )
inline

Definition at line 1112 of file atlcom.h.

1113 {
1114 m_nSize = 0;
1115 m_ppUnk = NULL;
1116 }
IUnknown ** m_ppUnk
Definition: atlcom.h:1110
#define NULL
Definition: types.h:112

◆ ~CComDynamicUnkArray()

ATL::CComDynamicUnkArray::~CComDynamicUnkArray ( )
inline

Definition at line 1118 of file atlcom.h.

1119 {
1120 free(m_ppUnk);
1121 }
#define free
Definition: debug_ros.c:5

◆ CComDynamicUnkArray() [2/2]

ATL::CComDynamicUnkArray::CComDynamicUnkArray ( const CComDynamicUnkArray )
inlineprivate

Definition at line 1230 of file atlcom.h.

1231 {
1232 }

Member Function Documentation

◆ Add()

DWORD ATL::CComDynamicUnkArray::Add ( IUnknown pUnk)
inline

Definition at line 1170 of file atlcom.h.

1171 {
1172 IUnknown **x;
1173 IUnknown **newArray;
1174 int newSize;
1175 DWORD curCookie;
1176
1177 ATLASSERT(pUnk != NULL);
1178 if (m_nSize == 0)
1179 {
1180 newSize = _DEFAULT_VECTORLENGTH * sizeof(IUnknown *);
1181 ATLTRY(newArray = reinterpret_cast<IUnknown **>(malloc(newSize)));
1182 if (newArray == NULL)
1183 return 0;
1184 memset(newArray, 0, newSize);
1185 m_ppUnk = newArray;
1187 }
1188 curCookie = 1;
1189 for (x = begin(); x < end(); x++)
1190 {
1191 if (*x == NULL)
1192 {
1193 *x = pUnk;
1194 return curCookie;
1195 }
1196 curCookie++;
1197 }
1198 newSize = m_nSize * 2;
1199 newArray = reinterpret_cast<IUnknown **>(realloc(m_ppUnk, newSize * sizeof(IUnknown *)));
1200 if (newArray == NULL)
1201 return 0;
1202 m_ppUnk = newArray;
1203 memset(&m_ppUnk[m_nSize], 0, (newSize - m_nSize) * sizeof(IUnknown *));
1204 curCookie = m_nSize + 1;
1205 m_nSize = newSize;
1206 m_ppUnk[curCookie - 1] = pUnk;
1207 return curCookie;
1208 }
#define ATLASSERT(x)
Definition: CComVariant.cpp:10
#define ATLTRY(x)
Definition: atlcomcli.h:44
IUnknown ** end()
Definition: atlcom.h:1128
IUnknown ** begin()
Definition: atlcom.h:1123
#define realloc
Definition: debug_ros.c:6
#define malloc
Definition: debug_ros.c:4
static void *static void *static LPDIRECTPLAY IUnknown * pUnk
Definition: dplayx.c:30
unsigned long DWORD
Definition: ntddk_ex.h:95
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
#define _DEFAULT_VECTORLENGTH
Definition: atlcom.h:1103
#define memset(x, y, z)
Definition: compat.h:39

◆ begin()

IUnknown ** ATL::CComDynamicUnkArray::begin ( )
inline

Definition at line 1123 of file atlcom.h.

1124 {
1125 return m_ppUnk;
1126 }

Referenced by Add(), CShellBrowser::FireEvent(), GetCookie(), and CFindFolder::NotifyConnections().

◆ end()

IUnknown ** ATL::CComDynamicUnkArray::end ( )
inline

Definition at line 1128 of file atlcom.h.

1129 {
1130 return &m_ppUnk[m_nSize];
1131 }

Referenced by Add(), CShellBrowser::FireEvent(), GetCookie(), and CFindFolder::NotifyConnections().

◆ GetAt()

IUnknown * ATL::CComDynamicUnkArray::GetAt ( int  nIndex)
inline

Definition at line 1133 of file atlcom.h.

1134 {
1135 ATLASSERT(nIndex >= 0 && nIndex < m_nSize);
1136 if (nIndex >= 0 && nIndex < m_nSize)
1137 return m_ppUnk[nIndex];
1138 else
1139 return NULL;
1140 }

Referenced by GetUnknown().

◆ GetCookie()

DWORD WINAPI ATL::CComDynamicUnkArray::GetCookie ( IUnknown **  ppFind)
inline

Definition at line 1151 of file atlcom.h.

1152 {
1153 IUnknown **x;
1154 DWORD curCookie;
1155
1156 ATLASSERT(ppFind != NULL && *ppFind != NULL);
1157 if (ppFind != NULL && *ppFind != NULL)
1158 {
1159 curCookie = 1;
1160 for (x = begin(); x < end(); x++)
1161 {
1162 if (*x == *ppFind)
1163 return curCookie;
1164 curCookie++;
1165 }
1166 }
1167 return 0;
1168 }

◆ GetUnknown()

IUnknown *WINAPI ATL::CComDynamicUnkArray::GetUnknown ( DWORD  dwCookie)
inline

Definition at line 1142 of file atlcom.h.

1143 {
1144 ATLASSERT(dwCookie != 0 && dwCookie <= static_cast<DWORD>(m_nSize));
1145 if (dwCookie != 0 && dwCookie <= static_cast<DWORD>(m_nSize))
1146 return GetAt(dwCookie - 1);
1147 else
1148 return NULL;
1149 }
IUnknown * GetAt(int nIndex)
Definition: atlcom.h:1133

◆ operator=()

CComDynamicUnkArray & ATL::CComDynamicUnkArray::operator= ( const CComDynamicUnkArray )
inlineprivate

Definition at line 1225 of file atlcom.h.

1226 {
1227 return *this;
1228 }

◆ Remove()

BOOL ATL::CComDynamicUnkArray::Remove ( DWORD  dwCookie)
inline

Definition at line 1210 of file atlcom.h.

1211 {
1212 DWORD index;
1213
1214 index = dwCookie - 1;
1215 ATLASSERT(index < dwCookie && index < static_cast<DWORD>(m_nSize));
1216 if (index < dwCookie && index < static_cast<DWORD>(m_nSize) && m_ppUnk[index] != NULL)
1217 {
1218 m_ppUnk[index] = NULL;
1219 return TRUE;
1220 }
1221 return FALSE;
1222 }
#define index(s, c)
Definition: various.h:29
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
GLuint index
Definition: glext.h:6031

Member Data Documentation

◆ m_nSize

int ATL::CComDynamicUnkArray::m_nSize

Definition at line 1109 of file atlcom.h.

Referenced by Add(), CComDynamicUnkArray(), end(), GetAt(), GetUnknown(), and Remove().

◆ m_ppUnk

IUnknown** ATL::CComDynamicUnkArray::m_ppUnk

Definition at line 1110 of file atlcom.h.

Referenced by Add(), begin(), CComDynamicUnkArray(), end(), GetAt(), Remove(), and ~CComDynamicUnkArray().


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