ReactOS 0.4.15-dev-7934-g1dc8d80
ATL::CComEnumImpl< Base, piid, T, Copy > Class Template Reference

#include <atlcom.h>

Inheritance diagram for ATL::CComEnumImpl< Base, piid, T, Copy >:
Collaboration diagram for ATL::CComEnumImpl< Base, piid, T, Copy >:

Public Member Functions

 CComEnumImpl ()
 
virtual ~CComEnumImpl ()
 
HRESULT Init (T *begin, T *end, IUnknown *pUnk, CComEnumFlags flags=AtlFlagNoCopy)
 
STDMETHOD() Next (ULONG celt, T *rgelt, ULONG *pceltFetched)
 
STDMETHOD() Skip (ULONG celt)
 
STDMETHOD() Reset ()
 
STDMETHOD() Clone (Base **ppEnum)
 

Public Attributes

CComPtr< IUnknownm_spUnk
 
DWORD m_dwFlags
 
Tm_begin
 
Tm_end
 
Tm_iter
 

Protected Types

enum  FlagBits { BitCopy = 1 , BitOwn = 2 }
 

Private Types

typedef CComObject< CComEnum< Base, piid, T, Copy > > enumeratorClass
 

Detailed Description

template<class Base, const IID * piid, class T, class Copy>
class ATL::CComEnumImpl< Base, piid, T, Copy >

Definition at line 913 of file atlcom.h.

Member Typedef Documentation

◆ enumeratorClass

template<class Base , const IID * piid, class T , class Copy >
typedef CComObject<CComEnum<Base, piid, T, Copy> > ATL::CComEnumImpl< Base, piid, T, Copy >::enumeratorClass
private

Definition at line 916 of file atlcom.h.

Member Enumeration Documentation

◆ FlagBits

template<class Base , const IID * piid, class T , class Copy >
enum ATL::CComEnumImpl::FlagBits
protected
Enumerator
BitCopy 
BitOwn 

Definition at line 1081 of file atlcom.h.

1082 {
1083 BitCopy = 1,
1084 BitOwn = 2
1085 };

Constructor & Destructor Documentation

◆ CComEnumImpl()

template<class Base , const IID * piid, class T , class Copy >
ATL::CComEnumImpl< Base, piid, T, Copy >::CComEnumImpl ( )
inline

Definition at line 924 of file atlcom.h.

925 {
926 m_dwFlags = 0;
927 m_begin = NULL;
928 m_end = NULL;
929 m_iter = NULL;
930 }
DWORD m_dwFlags
Definition: atlcom.h:919
#define NULL
Definition: types.h:112

◆ ~CComEnumImpl()

template<class Base , const IID * piid, class T , class Copy >
virtual ATL::CComEnumImpl< Base, piid, T, Copy >::~CComEnumImpl ( )
inlinevirtual

Definition at line 932 of file atlcom.h.

933 {
934 T *x;
935
936 if ((m_dwFlags & BitOwn) != 0)
937 {
938 for (x = m_begin; x != m_end; x++)
939 Copy::destroy(x);
940 delete [] m_begin;
941 }
942 }
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
#define T
Definition: mbstring.h:31

Member Function Documentation

◆ Clone()

template<class Base , const IID * piid, class T , class Copy >
STDMETHOD() ATL::CComEnumImpl< Base, piid, T, Copy >::Clone ( Base **  ppEnum)
inline

Definition at line 1055 of file atlcom.h.

1056 {
1057 enumeratorClass *newInstance;
1058 HRESULT hResult;
1059
1060 hResult = E_POINTER;
1061 if (ppEnum != NULL)
1062 {
1063 *ppEnum = NULL;
1064 hResult = enumeratorClass::CreateInstance(&newInstance);
1065 if (SUCCEEDED(hResult))
1066 {
1067 hResult = newInstance->Init(m_begin, m_end, (m_dwFlags & BitOwn) ? this : m_spUnk);
1068 if (SUCCEEDED(hResult))
1069 {
1070 newInstance->m_iter = m_iter;
1071 hResult = newInstance->_InternalQueryInterface(*piid, (void **)ppEnum);
1072 }
1073 if (FAILED(hResult))
1074 delete newInstance;
1075 }
1076 }
1077 return hResult;
1078 }
CComPtr< IUnknown > m_spUnk
Definition: atlcom.h:918
CComObject< CComEnum< Base, piid, T, Copy > > enumeratorClass
Definition: atlcom.h:916
static HRESULT WINAPI CreateInstance(CComObject< Base > **pp)
Definition: atlcom.h:171
#define SUCCEEDED(hr)
Definition: intsafe.h:50
#define FAILED(hr)
Definition: intsafe.h:51
#define E_POINTER
Definition: winerror.h:2365

◆ Init()

template<class Base , const IID * piid, class T , class Copy >
HRESULT ATL::CComEnumImpl< Base, piid, T, Copy >::Init ( T begin,
T end,
IUnknown pUnk,
CComEnumFlags  flags = AtlFlagNoCopy 
)
inline

Definition at line 944 of file atlcom.h.

945 {
946 T *newBuffer;
947 T *sourcePtr;
948 T *destPtr;
949 T *cleanupPtr;
950 HRESULT hResult;
951
952 if (flags == AtlFlagCopy)
953 {
954 ATLTRY(newBuffer = new T[end - begin])
955 if (newBuffer == NULL)
956 return E_OUTOFMEMORY;
957 destPtr = newBuffer;
958 for (sourcePtr = begin; sourcePtr != end; sourcePtr++)
959 {
960 Copy::init(destPtr);
961 hResult = Copy::copy(destPtr, sourcePtr);
962 if (FAILED(hResult))
963 {
964 cleanupPtr = m_begin;
965 while (cleanupPtr < destPtr)
966 Copy::destroy(cleanupPtr++);
967 delete [] newBuffer;
968 return hResult;
969 }
970 destPtr++;
971 }
973 m_end = m_begin + (end - begin);
974 }
975 else
976 {
977 m_begin = begin;
978 m_end = end;
979 }
980 m_spUnk = pUnk;
982 m_iter = m_begin;
983 return S_OK;
984 }
#define ATLTRY(x)
Definition: atlcomcli.h:44
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
static void *static void *static LPDIRECTPLAY IUnknown * pUnk
Definition: dplayx.c:30
GLuint GLuint end
Definition: gl.h:1545
GLbitfield flags
Definition: glext.h:7161
#define S_OK
Definition: intsafe.h:52
@ AtlFlagCopy
Definition: atlcom.h:909
CHAR_INFO * newBuffer()
Definition: tconsole.cpp:995
static clock_t begin
Definition: xmllint.c:458

Referenced by ATL::IConnectionPointContainerImpl< T >::EnumConnectionPoints().

◆ Next()

template<class Base , const IID * piid, class T , class Copy >
STDMETHOD() ATL::CComEnumImpl< Base, piid, T, Copy >::Next ( ULONG  celt,
T rgelt,
ULONG pceltFetched 
)
inline

Definition at line 986 of file atlcom.h.

987 {
988 ULONG numAvailable;
989 ULONG numToFetch;
990 T *rgeltTemp;
991 HRESULT hResult;
992
993 if (pceltFetched != NULL)
994 *pceltFetched = 0;
995 if (celt == 0)
996 return E_INVALIDARG;
997 if (rgelt == NULL || (celt != 1 && pceltFetched == NULL))
998 return E_POINTER;
999 if (m_begin == NULL || m_end == NULL || m_iter == NULL)
1000 return E_FAIL;
1001
1002 numAvailable = static_cast<ULONG>(m_end - m_iter);
1003 if (celt < numAvailable)
1004 numToFetch = celt;
1005 else
1006 numToFetch = numAvailable;
1007 if (pceltFetched != NULL)
1008 *pceltFetched = numToFetch;
1009 rgeltTemp = rgelt;
1010 while (numToFetch != 0)
1011 {
1012 hResult = Copy::copy(rgeltTemp, m_iter);
1013 if (FAILED(hResult))
1014 {
1015 while (rgelt < rgeltTemp)
1016 Copy::destroy(rgelt++);
1017 if (pceltFetched != NULL)
1018 *pceltFetched = 0;
1019 return hResult;
1020 }
1021 rgeltTemp++;
1022 m_iter++;
1023 numToFetch--;
1024 }
1025 if (numAvailable < celt)
1026 return S_FALSE;
1027 return S_OK;
1028 }
#define E_INVALIDARG
Definition: ddrawi.h:101
#define E_FAIL
Definition: ddrawi.h:102
uint32_t ULONG
Definition: typedefs.h:59
#define S_FALSE
Definition: winerror.h:2357

◆ Reset()

template<class Base , const IID * piid, class T , class Copy >
STDMETHOD() ATL::CComEnumImpl< Base, piid, T, Copy >::Reset ( )
inline

Definition at line 1049 of file atlcom.h.

1050 {
1051 m_iter = m_begin;
1052 return S_OK;
1053 }

◆ Skip()

template<class Base , const IID * piid, class T , class Copy >
STDMETHOD() ATL::CComEnumImpl< Base, piid, T, Copy >::Skip ( ULONG  celt)
inline

Definition at line 1030 of file atlcom.h.

1031 {
1032 ULONG numAvailable;
1033 ULONG numToSkip;
1034
1035 if (celt == 0)
1036 return E_INVALIDARG;
1037
1038 numAvailable = static_cast<ULONG>(m_end - m_iter);
1039 if (celt < numAvailable)
1040 numToSkip = celt;
1041 else
1042 numToSkip = numAvailable;
1043 m_iter += numToSkip;
1044 if (numAvailable < celt)
1045 return S_FALSE;
1046 return S_OK;
1047 }

Member Data Documentation

◆ m_begin

◆ m_dwFlags

◆ m_end

◆ m_iter

◆ m_spUnk


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