ReactOS 0.4.16-dev-91-g764881a
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 1388 of file atlcom.h.

Member Typedef Documentation

◆ CComEnumConnectionPoints

Definition at line 1392 of file atlcom.h.

◆ handlerFunctionType

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

Definition at line 1390 of file atlcom.h.

Member Function Documentation

◆ EnumConnectionPoints()

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

Implements IConnectionPointContainer.

Definition at line 1395 of file atlcom.h.

1396 {
1397 const _ATL_CONNMAP_ENTRY *entryPtr;
1398 int connectionPointCount;
1399 IConnectionPoint **itemBuffer;
1400 int destIndex;
1401 handlerFunctionType handlerFunction;
1402 CComEnumConnectionPoints *newEnumerator;
1403 HRESULT hResult;
1404
1405 ATLASSERT(ppEnum != NULL);
1406 if (ppEnum == NULL)
1407 return E_POINTER;
1408 *ppEnum = NULL;
1409
1410 entryPtr = T::GetConnMap(&connectionPointCount);
1411 ATLTRY(itemBuffer = new IConnectionPoint * [connectionPointCount])
1412 if (itemBuffer == NULL)
1413 return E_OUTOFMEMORY;
1414
1415 destIndex = 0;
1416 while (entryPtr->dwOffset != static_cast<DWORD_PTR>(-1))
1417 {
1418 if (entryPtr->dwOffset == static_cast<DWORD_PTR>(-2))
1419 {
1420 entryPtr++;
1421 handlerFunction = reinterpret_cast<handlerFunctionType>(entryPtr->dwOffset);
1422 entryPtr = handlerFunction(NULL);
1423 }
1424 else
1425 {
1426 itemBuffer[destIndex++] = reinterpret_cast<IConnectionPoint *>((char *)this + entryPtr->dwOffset);
1427 entryPtr++;
1428 }
1429 }
1430
1431 ATLTRY(newEnumerator = new CComObject<CComEnumConnectionPoints>)
1432 if (newEnumerator == NULL)
1433 {
1434 delete [] itemBuffer;
1435 return E_OUTOFMEMORY;
1436 }
1437
1438 newEnumerator->Init(&itemBuffer[0], &itemBuffer[destIndex], NULL, AtlFlagTakeOwnership); // can't fail
1439 hResult = newEnumerator->QueryInterface(IID_IEnumConnectionPoints, (void**)ppEnum);
1440 if (FAILED(hResult))
1441 delete newEnumerator;
1442 return hResult;
1443 }
#define ATLASSERT(x)
Definition: CComVariant.cpp:10
#define ATLTRY(x)
Definition: atlcomcli.h:44
const _ATL_CONNMAP_ENTRY *(* handlerFunctionType)(int *)
Definition: atlcom.h:1390
CComEnum< IEnumConnectionPoints, &IID_IEnumConnectionPoints, IConnectionPoint *, _CopyInterface< IConnectionPoint > > CComEnumConnectionPoints
Definition: atlcom.h:1392
#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:908
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 1445 of file atlcom.h.

1446 {
1447 IID interfaceID;
1448 const _ATL_CONNMAP_ENTRY *entryPtr;
1449 handlerFunctionType handlerFunction;
1450 IConnectionPoint *connectionPoint;
1451 HRESULT hResult;
1452
1453 if (ppCP == NULL)
1454 return E_POINTER;
1455 *ppCP = NULL;
1456 hResult = CONNECT_E_NOCONNECTION;
1457 entryPtr = T::GetConnMap(NULL);
1458 while (entryPtr->dwOffset != static_cast<DWORD_PTR>(-1))
1459 {
1460 if (entryPtr->dwOffset == static_cast<DWORD_PTR>(-2))
1461 {
1462 entryPtr++;
1463 handlerFunction = reinterpret_cast<handlerFunctionType>(entryPtr->dwOffset);
1464 entryPtr = handlerFunction(NULL);
1465 }
1466 else
1467 {
1468 connectionPoint = reinterpret_cast<IConnectionPoint *>(reinterpret_cast<char *>(this) + entryPtr->dwOffset);
1469 if (SUCCEEDED(connectionPoint->GetConnectionInterface(&interfaceID)) && InlineIsEqualGUID(riid, interfaceID))
1470 {
1471 *ppCP = connectionPoint;
1472 connectionPoint->AddRef();
1473 hResult = S_OK;
1474 break;
1475 }
1476 entryPtr++;
1477 }
1478 }
1479 return hResult;
1480 }
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: