ReactOS 0.4.15-dev-5666-gc548b97
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)
 
HRESULT EnumConnectionPoints ([out] IEnumConnectionPoints **ppEnum)
 
HRESULT FindConnectionPoint ([in] REFIID riid, [out] 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 1330 of file atlcom.h.

Member Typedef Documentation

◆ CComEnumConnectionPoints

Definition at line 1334 of file atlcom.h.

◆ handlerFunctionType

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

Definition at line 1332 of file atlcom.h.

Member Function Documentation

◆ EnumConnectionPoints()

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

Implements IConnectionPointContainer.

Definition at line 1337 of file atlcom.h.

1338 {
1339 const _ATL_CONNMAP_ENTRY *entryPtr;
1340 int connectionPointCount;
1341 IConnectionPoint **itemBuffer;
1342 int destIndex;
1343 handlerFunctionType handlerFunction;
1344 CComEnumConnectionPoints *newEnumerator;
1345 HRESULT hResult;
1346
1347 ATLASSERT(ppEnum != NULL);
1348 if (ppEnum == NULL)
1349 return E_POINTER;
1350 *ppEnum = NULL;
1351
1352 entryPtr = T::GetConnMap(&connectionPointCount);
1353 ATLTRY(itemBuffer = new IConnectionPoint * [connectionPointCount])
1354 if (itemBuffer == NULL)
1355 return E_OUTOFMEMORY;
1356
1357 destIndex = 0;
1358 while (entryPtr->dwOffset != static_cast<DWORD_PTR>(-1))
1359 {
1360 if (entryPtr->dwOffset == static_cast<DWORD_PTR>(-2))
1361 {
1362 entryPtr++;
1363 handlerFunction = reinterpret_cast<handlerFunctionType>(entryPtr->dwOffset);
1364 entryPtr = handlerFunction(NULL);
1365 }
1366 else
1367 {
1368 itemBuffer[destIndex++] = reinterpret_cast<IConnectionPoint *>((char *)this + entryPtr->dwOffset);
1369 entryPtr++;
1370 }
1371 }
1372
1373 ATLTRY(newEnumerator = new CComObject<CComEnumConnectionPoints>)
1374 if (newEnumerator == NULL)
1375 {
1376 delete [] itemBuffer;
1377 return E_OUTOFMEMORY;
1378 }
1379
1380 newEnumerator->Init(&itemBuffer[0], &itemBuffer[destIndex], NULL, AtlFlagTakeOwnership); // can't fail
1381 hResult = newEnumerator->QueryInterface(IID_IEnumConnectionPoints, (void**)ppEnum);
1382 if (FAILED(hResult))
1383 delete newEnumerator;
1384 return hResult;
1385 }
#define ATLASSERT(x)
Definition: CComVariant.cpp:10
#define ATLTRY(x)
Definition: atlcomcli.h:44
const _ATL_CONNMAP_ENTRY *(* handlerFunctionType)(int *)
Definition: atlcom.h:1332
CComEnum< IEnumConnectionPoints, &IID_IEnumConnectionPoints, IConnectionPoint *, _CopyInterface< IConnectionPoint > > CComEnumConnectionPoints
Definition: atlcom.h:1334
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define NULL
Definition: types.h:112
HRESULT QueryInterface([in] REFIID riid, [out, iid_is(riid)] void **ppvObject)
#define FAILED(hr)
Definition: intsafe.h:51
@ AtlFlagTakeOwnership
Definition: atlcom.h:850
const GUID IID_IEnumConnectionPoints
uint32_t DWORD_PTR
Definition: typedefs.h:65
#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 1387 of file atlcom.h.

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

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