ReactOS  0.4.12-dev-102-g4b7f1e0
ATL::IConnectionPointContainerImpl< T > Class Template Reference

#include <atlcom.h>

Inheritance diagram for ATL::IConnectionPointContainerImpl< T >:
Collaboration diagram for ATL::IConnectionPointContainerImpl< T >:

Public Member Functions

STDMETHOD() EnumConnectionPoints (IEnumConnectionPoints **ppEnum)
 
STDMETHOD() FindConnectionPoint (REFIID riid, IConnectionPoint **ppCP)
 
- Public Member Functions inherited from IUnknown
HRESULT QueryInterface ([in] REFIID riid, [out, iid_is(riid)] void **ppvObject)
 
ULONG AddRef ()
 
ULONG Release ()
 

Private Types

typedef const _ATL_CONNMAP_ENTRY *(* handlerFunctionType) (int *)
 
typedef CComEnum< IEnumConnectionPoints, &IID_IEnumConnectionPoints, IConnectionPoint *, _CopyInterface< IConnectionPoint > > CComEnumConnectionPoints
 

Additional Inherited Members

- Public Types inherited from IConnectionPointContainer
typedef IConnectionPointContainerPCONNECTIONPOINTCONTAINER
 
typedef IConnectionPointContainerLPCONNECTIONPOINTCONTAINER
 
- Public Types inherited from IUnknown
typedef IUnknownLPUNKNOWN
 

Detailed Description

template<class T>
class ATL::IConnectionPointContainerImpl< T >

Definition at line 1329 of file atlcom.h.

Member Typedef Documentation

◆ CComEnumConnectionPoints

◆ handlerFunctionType

template<class T>
typedef const _ATL_CONNMAP_ENTRY*(* ATL::IConnectionPointContainerImpl< T >::handlerFunctionType) (int *)
private

Definition at line 1331 of file atlcom.h.

Member Function Documentation

◆ EnumConnectionPoints()

template<class T>
STDMETHOD() ATL::IConnectionPointContainerImpl< T >::EnumConnectionPoints ( IEnumConnectionPoints **  ppEnum)
inline

Implements IConnectionPointContainer.

Definition at line 1336 of file atlcom.h.

1337  {
1338  const _ATL_CONNMAP_ENTRY *entryPtr;
1339  int connectionPointCount;
1340  IConnectionPoint **itemBuffer;
1341  int destIndex;
1342  handlerFunctionType handlerFunction;
1343  CComEnumConnectionPoints *newEnumerator;
1344  HRESULT hResult;
1345 
1346  ATLASSERT(ppEnum != NULL);
1347  if (ppEnum == NULL)
1348  return E_POINTER;
1349  *ppEnum = NULL;
1350 
1351  entryPtr = T::GetConnMap(&connectionPointCount);
1352  ATLTRY(itemBuffer = new IConnectionPoint * [connectionPointCount])
1353  if (itemBuffer == NULL)
1354  return E_OUTOFMEMORY;
1355 
1356  destIndex = 0;
1357  while (entryPtr->dwOffset != static_cast<DWORD_PTR>(-1))
1358  {
1359  if (entryPtr->dwOffset == static_cast<DWORD_PTR>(-2))
1360  {
1361  entryPtr++;
1362  handlerFunction = reinterpret_cast<handlerFunctionType>(entryPtr->dwOffset);
1363  entryPtr = handlerFunction(NULL);
1364  }
1365  else
1366  {
1367  itemBuffer[destIndex++] = reinterpret_cast<IConnectionPoint *>((char *)this + entryPtr->dwOffset);
1368  entryPtr++;
1369  }
1370  }
1371 
1372  ATLTRY(newEnumerator = new CComObject<CComEnumConnectionPoints>)
1373  if (newEnumerator == NULL)
1374  {
1375  delete [] itemBuffer;
1376  return E_OUTOFMEMORY;
1377  }
1378 
1379  newEnumerator->Init(&itemBuffer[0], &itemBuffer[destIndex], NULL, AtlFlagTakeOwnership); // can't fail
1380  hResult = newEnumerator->QueryInterface(IID_IEnumConnectionPoints, (void**)ppEnum);
1381  if (FAILED(hResult))
1382  delete newEnumerator;
1383  return hResult;
1384  }
#define ATLTRY(x)
Definition: atlcomcli.h:44
#define ATLASSERT(x)
Definition: CComVariant.cpp:9
CComEnum< IEnumConnectionPoints, &IID_IEnumConnectionPoints, IConnectionPoint *, _CopyInterface< IConnectionPoint > > CComEnumConnectionPoints
Definition: atlcom.h:1333
const _ATL_CONNMAP_ENTRY *(* handlerFunctionType)(int *)
Definition: atlcom.h:1331
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
smooth NULL
Definition: ftsmooth.c:416
LONG HRESULT
Definition: typedefs.h:77
const GUID IID_IEnumConnectionPoints
#define E_POINTER
Definition: winerror.h:2365

◆ FindConnectionPoint()

template<class T>
STDMETHOD() ATL::IConnectionPointContainerImpl< T >::FindConnectionPoint ( REFIID  riid,
IConnectionPoint **  ppCP 
)
inline

Implements IConnectionPointContainer.

Definition at line 1386 of file atlcom.h.

1387  {
1388  IID interfaceID;
1389  const _ATL_CONNMAP_ENTRY *entryPtr;
1390  handlerFunctionType handlerFunction;
1391  IConnectionPoint *connectionPoint;
1392  HRESULT hResult;
1393 
1394  if (ppCP == NULL)
1395  return E_POINTER;
1396  *ppCP = NULL;
1397  hResult = CONNECT_E_NOCONNECTION;
1398  entryPtr = T::GetConnMap(NULL);
1399  while (entryPtr->dwOffset != static_cast<DWORD_PTR>(-1))
1400  {
1401  if (entryPtr->dwOffset == static_cast<DWORD_PTR>(-2))
1402  {
1403  entryPtr++;
1404  handlerFunction = reinterpret_cast<handlerFunctionType>(entryPtr->dwOffset);
1405  entryPtr = handlerFunction(NULL);
1406  }
1407  else
1408  {
1409  connectionPoint = reinterpret_cast<IConnectionPoint *>(reinterpret_cast<char *>(this) + entryPtr->dwOffset);
1410  if (SUCCEEDED(connectionPoint->GetConnectionInterface(&interfaceID)) && InlineIsEqualGUID(riid, interfaceID))
1411  {
1412  *ppCP = connectionPoint;
1413  connectionPoint->AddRef();
1414  hResult = S_OK;
1415  break;
1416  }
1417  entryPtr++;
1418  }
1419  }
1420  return hResult;
1421  }
REFIID riid
Definition: precomp.h:44
HRESULT GetConnectionInterface([out] IID *pIID)
#define CONNECT_E_NOCONNECTION
Definition: olectl.h:251
const _ATL_CONNMAP_ENTRY *(* handlerFunctionType)(int *)
Definition: atlcom.h:1331
smooth NULL
Definition: ftsmooth.c:416
LONG HRESULT
Definition: typedefs.h:77
ULONG AddRef()
#define S_OK
Definition: intsafe.h:59
#define E_POINTER
Definition: winerror.h:2365
#define InlineIsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:137
#define SUCCEEDED(hr)
Definition: intsafe.h:57

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