ReactOS  0.4.15-dev-3456-g4a17d4b
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 1048 of file atlcom.h.

Constructor & Destructor Documentation

◆ CComDynamicUnkArray() [1/2]

ATL::CComDynamicUnkArray::CComDynamicUnkArray ( )
inline

Definition at line 1054 of file atlcom.h.

1055  {
1056  m_nSize = 0;
1057  m_ppUnk = NULL;
1058  }
IUnknown ** m_ppUnk
Definition: atlcom.h:1052
#define NULL
Definition: types.h:112

◆ ~CComDynamicUnkArray()

ATL::CComDynamicUnkArray::~CComDynamicUnkArray ( )
inline

Definition at line 1060 of file atlcom.h.

1061  {
1062  free(m_ppUnk);
1063  }
#define free
Definition: debug_ros.c:5
IUnknown ** m_ppUnk
Definition: atlcom.h:1052

◆ CComDynamicUnkArray() [2/2]

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

Definition at line 1172 of file atlcom.h.

1173  {
1174  }

Member Function Documentation

◆ Add()

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

Definition at line 1112 of file atlcom.h.

1113  {
1114  IUnknown **x;
1115  IUnknown **newArray;
1116  int newSize;
1117  DWORD curCookie;
1118 
1119  ATLASSERT(pUnk != NULL);
1120  if (m_nSize == 0)
1121  {
1122  newSize = _DEFAULT_VECTORLENGTH * sizeof(IUnknown *);
1123  ATLTRY(newArray = reinterpret_cast<IUnknown **>(malloc(newSize)));
1124  if (newArray == NULL)
1125  return 0;
1126  memset(newArray, 0, newSize);
1127  m_ppUnk = newArray;
1129  }
1130  curCookie = 1;
1131  for (x = begin(); x < end(); x++)
1132  {
1133  if (*x == NULL)
1134  {
1135  *x = pUnk;
1136  return curCookie;
1137  }
1138  curCookie++;
1139  }
1140  newSize = m_nSize * 2;
1141  newArray = reinterpret_cast<IUnknown **>(realloc(m_ppUnk, newSize * sizeof(IUnknown *)));
1142  if (newArray == NULL)
1143  return 0;
1144  m_ppUnk = newArray;
1145  memset(&m_ppUnk[m_nSize], 0, (newSize - m_nSize) * sizeof(IUnknown *));
1146  curCookie = m_nSize + 1;
1147  m_nSize = newSize;
1148  m_ppUnk[curCookie - 1] = pUnk;
1149  return curCookie;
1150  }
#define realloc
Definition: debug_ros.c:6
#define ATLTRY(x)
Definition: atlcomcli.h:44
IUnknown ** begin()
Definition: atlcom.h:1065
#define ATLASSERT(x)
Definition: CComVariant.cpp:10
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
#define _DEFAULT_VECTORLENGTH
Definition: atlcom.h:1045
unsigned long DWORD
Definition: ntddk_ex.h:95
IUnknown ** m_ppUnk
Definition: atlcom.h:1052
IUnknown ** end()
Definition: atlcom.h:1070
#define NULL
Definition: types.h:112
#define malloc
Definition: debug_ros.c:4
#define memset(x, y, z)
Definition: compat.h:39
static void *static void *static LPDIRECTPLAY IUnknown * pUnk
Definition: dplayx.c:30

◆ begin()

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

Definition at line 1065 of file atlcom.h.

1066  {
1067  return m_ppUnk;
1068  }
IUnknown ** m_ppUnk
Definition: atlcom.h:1052

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

◆ end()

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

Definition at line 1070 of file atlcom.h.

1071  {
1072  return &m_ppUnk[m_nSize];
1073  }
IUnknown ** m_ppUnk
Definition: atlcom.h:1052

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

◆ GetAt()

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

Definition at line 1075 of file atlcom.h.

1076  {
1077  ATLASSERT(nIndex >= 0 && nIndex < m_nSize);
1078  if (nIndex >= 0 && nIndex < m_nSize)
1079  return m_ppUnk[nIndex];
1080  else
1081  return NULL;
1082  }
#define ATLASSERT(x)
Definition: CComVariant.cpp:10
IUnknown ** m_ppUnk
Definition: atlcom.h:1052
#define NULL
Definition: types.h:112

Referenced by GetUnknown().

◆ GetCookie()

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

Definition at line 1093 of file atlcom.h.

1094  {
1095  IUnknown **x;
1096  DWORD curCookie;
1097 
1098  ATLASSERT(ppFind != NULL && *ppFind != NULL);
1099  if (ppFind != NULL && *ppFind != NULL)
1100  {
1101  curCookie = 1;
1102  for (x = begin(); x < end(); x++)
1103  {
1104  if (*x == *ppFind)
1105  return curCookie;
1106  curCookie++;
1107  }
1108  }
1109  return 0;
1110  }
IUnknown ** begin()
Definition: atlcom.h:1065
#define ATLASSERT(x)
Definition: CComVariant.cpp:10
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
unsigned long DWORD
Definition: ntddk_ex.h:95
IUnknown ** end()
Definition: atlcom.h:1070
#define NULL
Definition: types.h:112

◆ GetUnknown()

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

Definition at line 1084 of file atlcom.h.

1085  {
1086  ATLASSERT(dwCookie != 0 && dwCookie <= static_cast<DWORD>(m_nSize));
1087  if (dwCookie != 0 && dwCookie <= static_cast<DWORD>(m_nSize))
1088  return GetAt(dwCookie - 1);
1089  else
1090  return NULL;
1091  }
#define ATLASSERT(x)
Definition: CComVariant.cpp:10
IUnknown * GetAt(int nIndex)
Definition: atlcom.h:1075
#define NULL
Definition: types.h:112

◆ operator=()

Definition at line 1167 of file atlcom.h.

1168  {
1169  return *this;
1170  }

◆ Remove()

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

Definition at line 1152 of file atlcom.h.

1153  {
1154  DWORD index;
1155 
1156  index = dwCookie - 1;
1157  ATLASSERT(index < dwCookie && index < static_cast<DWORD>(m_nSize));
1158  if (index < dwCookie && index < static_cast<DWORD>(m_nSize) && m_ppUnk[index] != NULL)
1159  {
1160  m_ppUnk[index] = NULL;
1161  return TRUE;
1162  }
1163  return FALSE;
1164  }
#define ATLASSERT(x)
Definition: CComVariant.cpp:10
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
GLuint index
Definition: glext.h:6031
unsigned long DWORD
Definition: ntddk_ex.h:95
IUnknown ** m_ppUnk
Definition: atlcom.h:1052
#define index(s, c)
Definition: various.h:29
#define NULL
Definition: types.h:112

Member Data Documentation

◆ m_nSize

int ATL::CComDynamicUnkArray::m_nSize

Definition at line 1051 of file atlcom.h.

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

◆ m_ppUnk

IUnknown** ATL::CComDynamicUnkArray::m_ppUnk

Definition at line 1052 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: