ReactOS  0.4.12-dev-102-g4b7f1e0
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 1047 of file atlcom.h.

Constructor & Destructor Documentation

◆ CComDynamicUnkArray() [1/2]

ATL::CComDynamicUnkArray::CComDynamicUnkArray ( )
inline

Definition at line 1053 of file atlcom.h.

1054  {
1055  m_nSize = 0;
1056  m_ppUnk = NULL;
1057  }
smooth NULL
Definition: ftsmooth.c:416
IUnknown ** m_ppUnk
Definition: atlcom.h:1051

◆ ~CComDynamicUnkArray()

ATL::CComDynamicUnkArray::~CComDynamicUnkArray ( )
inline

Definition at line 1059 of file atlcom.h.

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

◆ CComDynamicUnkArray() [2/2]

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

Definition at line 1171 of file atlcom.h.

1172  {
1173  }

Member Function Documentation

◆ Add()

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

Definition at line 1111 of file atlcom.h.

1112  {
1113  IUnknown **x;
1114  IUnknown **newArray;
1115  int newSize;
1116  DWORD curCookie;
1117 
1118  ATLASSERT(pUnk != NULL);
1119  if (m_nSize == 0)
1120  {
1121  newSize = _DEFAULT_VECTORLENGTH * sizeof(IUnknown *);
1122  ATLTRY(newArray = reinterpret_cast<IUnknown **>(malloc(newSize)));
1123  if (newArray == NULL)
1124  return 0;
1125  memset(newArray, 0, newSize);
1126  m_ppUnk = newArray;
1128  }
1129  curCookie = 1;
1130  for (x = begin(); x < end(); x++)
1131  {
1132  if (*x == NULL)
1133  {
1134  *x = pUnk;
1135  return curCookie;
1136  }
1137  curCookie++;
1138  }
1139  newSize = m_nSize * 2;
1140  newArray = reinterpret_cast<IUnknown **>(realloc(m_ppUnk, newSize * sizeof(IUnknown *)));
1141  if (newArray == NULL)
1142  return 0;
1143  m_ppUnk = newArray;
1144  memset(&m_ppUnk[m_nSize], 0, (newSize - m_nSize) * sizeof(IUnknown *));
1145  curCookie = m_nSize + 1;
1146  m_nSize = newSize;
1147  m_ppUnk[curCookie - 1] = pUnk;
1148  return curCookie;
1149  }
#define realloc
Definition: debug_ros.c:6
#define ATLTRY(x)
Definition: atlcomcli.h:44
IUnknown ** begin()
Definition: atlcom.h:1064
#define ATLASSERT(x)
Definition: CComVariant.cpp:9
#define _DEFAULT_VECTORLENGTH
Definition: atlcom.h:1044
smooth NULL
Definition: ftsmooth.c:416
unsigned long DWORD
Definition: ntddk_ex.h:95
IUnknown ** m_ppUnk
Definition: atlcom.h:1051
IUnknown ** end()
Definition: atlcom.h:1069
INT x
Definition: msvc.h:62
#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 1064 of file atlcom.h.

Referenced by CShellBrowser::FireEvent().

1065  {
1066  return m_ppUnk;
1067  }
IUnknown ** m_ppUnk
Definition: atlcom.h:1051

◆ end()

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

Definition at line 1069 of file atlcom.h.

Referenced by CShellBrowser::FireEvent().

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

◆ GetAt()

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

Definition at line 1074 of file atlcom.h.

1075  {
1076  ATLASSERT(nIndex >= 0 && nIndex < m_nSize);
1077  if (nIndex >= 0 && nIndex < m_nSize)
1078  return m_ppUnk[nIndex];
1079  else
1080  return NULL;
1081  }
#define ATLASSERT(x)
Definition: CComVariant.cpp:9
smooth NULL
Definition: ftsmooth.c:416
IUnknown ** m_ppUnk
Definition: atlcom.h:1051
int nIndex
Definition: msvc.h:77

◆ GetCookie()

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

Definition at line 1092 of file atlcom.h.

1093  {
1094  IUnknown **x;
1095  DWORD curCookie;
1096 
1097  ATLASSERT(ppFind != NULL && *ppFind != NULL);
1098  if (ppFind != NULL && *ppFind != NULL)
1099  {
1100  curCookie = 1;
1101  for (x = begin(); x < end(); x++)
1102  {
1103  if (*x == *ppFind)
1104  return curCookie;
1105  curCookie++;
1106  }
1107  }
1108  return 0;
1109  }
IUnknown ** begin()
Definition: atlcom.h:1064
#define ATLASSERT(x)
Definition: CComVariant.cpp:9
smooth NULL
Definition: ftsmooth.c:416
unsigned long DWORD
Definition: ntddk_ex.h:95
IUnknown ** end()
Definition: atlcom.h:1069
INT x
Definition: msvc.h:62

◆ GetUnknown()

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

Definition at line 1083 of file atlcom.h.

1084  {
1085  ATLASSERT(dwCookie != 0 && dwCookie <= static_cast<DWORD>(m_nSize));
1086  if (dwCookie != 0 && dwCookie <= static_cast<DWORD>(m_nSize))
1087  return GetAt(dwCookie - 1);
1088  else
1089  return NULL;
1090  }
#define ATLASSERT(x)
Definition: CComVariant.cpp:9
smooth NULL
Definition: ftsmooth.c:416
IUnknown * GetAt(int nIndex)
Definition: atlcom.h:1074

◆ operator=()

Definition at line 1166 of file atlcom.h.

1167  {
1168  return *this;
1169  }

◆ Remove()

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

Definition at line 1151 of file atlcom.h.

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

Member Data Documentation

◆ m_nSize

int ATL::CComDynamicUnkArray::m_nSize

Definition at line 1050 of file atlcom.h.

◆ m_ppUnk

IUnknown** ATL::CComDynamicUnkArray::m_ppUnk

Definition at line 1051 of file atlcom.h.


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