ReactOS 0.4.16-dev-112-g52265ae
CEnumIDListBase Class Reference

#include <CEnumIDListBase.h>

Inheritance diagram for CEnumIDListBase:
Collaboration diagram for CEnumIDListBase:

Public Member Functions

 CEnumIDListBase ()
 
virtual ~CEnumIDListBase ()
 
BOOL AddToEnumList (LPITEMIDLIST pidl)
 
BOOL DeleteList ()
 
BOOL HasItemWithCLSID (LPITEMIDLIST pidl)
 
HRESULT AppendItemsFromEnumerator (IEnumIDList *pEnum)
 
template<class T >
BOOL HasItemWithCLSIDImpl (LPCITEMIDLIST pidl)
 
STDMETHOD() Next (ULONG celt, LPITEMIDLIST *rgelt, ULONG *pceltFetched) override
 
STDMETHOD() Skip (ULONG celt) override
 
STDMETHOD() Reset () override
 
STDMETHOD() Clone (IEnumIDList **ppenum) override
 
- Public Member Functions inherited from ATL::CComObjectRootEx< CComMultiThreadModelNoCS >
 ~CComObjectRootEx ()
 
ULONG InternalAddRef ()
 
ULONG InternalRelease ()
 
void Lock ()
 
void Unlock ()
 
HRESULT _AtlInitialConstruct ()
 
- Public Member Functions inherited from ATL::CComObjectRootBase
 CComObjectRootBase ()
 
 ~CComObjectRootBase ()
 
void SetVoid (void *)
 
HRESULT _AtlFinalConstruct ()
 
HRESULT FinalConstruct ()
 
void InternalFinalConstructAddRef ()
 
void InternalFinalConstructRelease ()
 
void FinalRelease ()
 
- Public Member Functions inherited from IEnumIDList
HRESULT Next ([in] ULONG celt, [out, size_is(celt), length_is(*pceltFetched)] PITEMID_CHILD *rgelt, [out] ULONG *pceltFetched)
 
HRESULT Skip ([in] ULONG celt)
 
HRESULT Reset ()
 
HRESULT Clone ([out] IEnumIDList **ppenum)
 
- Public Member Functions inherited from IUnknown
HRESULT QueryInterface ([in] REFIID riid, [out, iid_is(riid)] void **ppvObject)
 
ULONG AddRef ()
 
ULONG Release ()
 

Protected Attributes

ENUMLISTmpFirst
 
ENUMLISTmpLast
 
ENUMLISTmpCurrent
 

Additional Inherited Members

- Public Types inherited from IEnumIDList
typedef IEnumIDListLPENUMIDLIST
 
- Public Types inherited from IUnknown
typedef IUnknownLPUNKNOWN
 
- Static Public Member Functions inherited from ATL::CComObjectRootBase
static void WINAPI ObjectMain (bool)
 
static const struct _ATL_CATMAP_ENTRYGetCategoryMap ()
 
static HRESULT WINAPI InternalQueryInterface (void *pThis, const _ATL_INTMAP_ENTRY *pEntries, REFIID iid, void **ppvObject)
 
- Public Attributes inherited from ATL::CComObjectRootBase
LONG m_dwRef
 

Detailed Description

Definition at line 26 of file CEnumIDListBase.h.

Constructor & Destructor Documentation

◆ CEnumIDListBase()

CEnumIDListBase::CEnumIDListBase ( )

Definition at line 25 of file CEnumIDListBase.cpp.

25 :
27 mpLast(NULL),
29{
30}
ENUMLIST * mpLast
ENUMLIST * mpCurrent
ENUMLIST * mpFirst
#define NULL
Definition: types.h:112

◆ ~CEnumIDListBase()

CEnumIDListBase::~CEnumIDListBase ( )
virtual

Definition at line 32 of file CEnumIDListBase.cpp.

33{
34 DeleteList();
35}

Member Function Documentation

◆ AddToEnumList()

BOOL CEnumIDListBase::AddToEnumList ( LPITEMIDLIST  pidl)

Definition at line 40 of file CEnumIDListBase.cpp.

41{
42 ENUMLIST *pNew;
43
44 TRACE("(%p)->(pidl=%p)\n", this, pidl);
45
46 if (!pidl)
47 return FALSE;
48
49 pNew = static_cast<ENUMLIST *>(SHAlloc(sizeof(ENUMLIST)));
50 if (pNew)
51 {
52 /*set the next pointer */
53 pNew->pNext = NULL;
54 pNew->pidl = pidl;
55
56 /*is This the first item in the list? */
57 if (!mpFirst)
58 {
59 mpFirst = pNew;
60 mpCurrent = pNew;
61 }
62
63 if (mpLast)
64 {
65 /*add the new item to the end of the list */
66 mpLast->pNext = pNew;
67 }
68
69 /*update the last item pointer */
70 mpLast = pNew;
71 TRACE("-- (%p)->(first=%p, last=%p)\n", this, mpFirst, mpLast);
72 return TRUE;
73 }
74 return FALSE;
75}
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
LPVOID WINAPI SHAlloc(SIZE_T len)
Definition: shellole.c:304
#define TRACE(s)
Definition: solgame.cpp:4
ENUMLIST * pNext
LPITEMIDLIST pidl

Referenced by CFileSysEnum::_AddFindResult(), CRegFolderEnum::AddItemsFromKey(), AppendItemsFromEnumerator(), CRecycleBinEnum::CBEnumRecycleBin(), CPrintersEnum::CreatePrintersEnumList(), CNetFolderEnum::EnumerateRec(), CRegFolderEnum::Initialize(), CDrivesFolderEnum::Initialize(), and CControlPanelEnum::RegisterCPanelApp().

◆ AppendItemsFromEnumerator()

HRESULT CEnumIDListBase::AppendItemsFromEnumerator ( IEnumIDList pEnum)

Definition at line 99 of file CEnumIDListBase.cpp.

100{
101 LPITEMIDLIST pidl;
102 DWORD dwFetched;
103
104 if (!pEnum)
105 return E_INVALIDARG;
106
107 pEnum->Reset();
108
109 while((S_OK == pEnum->Next(1, &pidl, &dwFetched)) && dwFetched)
110 AddToEnumList(pidl);
111
112 return S_OK;
113}
BOOL AddToEnumList(LPITEMIDLIST pidl)
#define E_INVALIDARG
Definition: ddrawi.h:101
unsigned long DWORD
Definition: ntddk_ex.h:95
HRESULT Next([in] ULONG celt, [out, size_is(celt), length_is(*pceltFetched)] PITEMID_CHILD *rgelt, [out] ULONG *pceltFetched)
HRESULT Reset()
#define S_OK
Definition: intsafe.h:52
ITEMIDLIST UNALIGNED * LPITEMIDLIST
Definition: shtypes.idl:41

Referenced by CControlPanelEnum::Initialize(), CDrivesFolderEnum::Initialize(), and CDesktopFolderEnum::Initialize().

◆ Clone()

HRESULT WINAPI CEnumIDListBase::Clone ( IEnumIDList **  ppenum)
override

Implements IEnumIDList.

Definition at line 201 of file CEnumIDListBase.cpp.

202{
203 TRACE("(%p)->() to (%p)->() E_NOTIMPL\n", this, ppenum);
204 return E_NOTIMPL;
205}
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ DeleteList()

BOOL CEnumIDListBase::DeleteList ( )

Definition at line 80 of file CEnumIDListBase.cpp.

81{
82 ENUMLIST *pDelete;
83
84 TRACE("(%p)->()\n", this);
85
86 while (mpFirst)
87 {
88 pDelete = mpFirst;
89 mpFirst = pDelete->pNext;
90 SHFree(pDelete->pidl);
91 SHFree(pDelete);
92 }
93 mpFirst = NULL;
94 mpLast = NULL;
96 return TRUE;
97}
void WINAPI SHFree(LPVOID pv)
Definition: shellole.c:326

Referenced by ~CEnumIDListBase().

◆ HasItemWithCLSID()

BOOL CEnumIDListBase::HasItemWithCLSID ( LPITEMIDLIST  pidl)

◆ HasItemWithCLSIDImpl()

template<class T >
BOOL CEnumIDListBase::HasItemWithCLSIDImpl ( LPCITEMIDLIST  pidl)
inline

Definition at line 42 of file CEnumIDListBase.h.

43 {
44 const CLSID * const pClsid = static_cast<T*>(this)->GetPidlClsid((PCUITEMID_CHILD)pidl);
45 for (ENUMLIST *pCur = mpFirst; pClsid && pCur; pCur = pCur->pNext)
46 {
47 const CLSID * const pEnumClsid = static_cast<T*>(this)->GetPidlClsid((PCUITEMID_CHILD)pCur->pidl);
48 if (pEnumClsid && IsEqualCLSID(*pClsid, *pEnumClsid))
49 return TRUE;
50 }
51 return FALSE;
52 }
SINGLE_LIST_ENTRY * pCur
#define T
Definition: mbstring.h:31
#define IsEqualCLSID(rclsid1, rclsid2)
Definition: guiddef.h:96
const ITEMID_CHILD UNALIGNED * PCUITEMID_CHILD
Definition: shtypes.idl:70

◆ Next()

HRESULT WINAPI CEnumIDListBase::Next ( ULONG  celt,
LPITEMIDLIST rgelt,
ULONG pceltFetched 
)
override

Definition at line 119 of file CEnumIDListBase.cpp.

123{
124 ULONG i;
125 HRESULT hr = S_OK;
127
128 TRACE("(%p)->(%d,%p, %p)\n", this, celt, rgelt, pceltFetched);
129
130/* It is valid to leave pceltFetched NULL when celt is 1. Some of explorer's
131 * subsystems actually use it (and so may a third party browser)
132 */
133 if(pceltFetched)
134 *pceltFetched = 0;
135
136 *rgelt=0;
137
138 if(celt > 1 && !pceltFetched)
139 { return E_INVALIDARG;
140 }
141
142 if(celt > 0 && !mpCurrent)
143 { return S_FALSE;
144 }
145
146 for(i = 0; i < celt; i++)
147 { if(!mpCurrent)
148 { hr = S_FALSE;
149 break;
150 }
151
153 if (!temp)
154 { hr = i ? S_FALSE : E_OUTOFMEMORY;
155 break;
156 }
157 rgelt[i] = temp;
159 }
160 if(pceltFetched)
161 { *pceltFetched = i;
162 }
163
164 return hr;
165}
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
LPITEMIDLIST WINAPI ILClone(LPCITEMIDLIST pidl)
Definition: pidl.c:237
static calc_node_t temp
Definition: rpn_ieee.c:38
HRESULT hr
Definition: shlfolder.c:183
uint32_t ULONG
Definition: typedefs.h:59
#define S_FALSE
Definition: winerror.h:2357

◆ Reset()

HRESULT WINAPI CEnumIDListBase::Reset ( )
override

Implements IEnumIDList.

Definition at line 191 of file CEnumIDListBase.cpp.

192{
193 TRACE("(%p)\n", this);
195 return S_OK;
196}

◆ Skip()

HRESULT WINAPI CEnumIDListBase::Skip ( ULONG  celt)
override

Implements IEnumIDList.

Definition at line 170 of file CEnumIDListBase.cpp.

172{
173 DWORD dwIndex;
174 HRESULT hr = S_OK;
175
176 TRACE("(%p)->(%u)\n", this, celt);
177
178 for(dwIndex = 0; dwIndex < celt; dwIndex++)
179 { if(!mpCurrent)
180 { hr = S_FALSE;
181 break;
182 }
184 }
185 return hr;
186}

Member Data Documentation

◆ mpCurrent

ENUMLIST* CEnumIDListBase::mpCurrent
protected

Definition at line 33 of file CEnumIDListBase.h.

Referenced by AddToEnumList(), DeleteList(), Next(), Reset(), and Skip().

◆ mpFirst

ENUMLIST* CEnumIDListBase::mpFirst
protected

Definition at line 31 of file CEnumIDListBase.h.

Referenced by AddToEnumList(), DeleteList(), HasItemWithCLSIDImpl(), and Reset().

◆ mpLast

ENUMLIST* CEnumIDListBase::mpLast
protected

Definition at line 32 of file CEnumIDListBase.h.

Referenced by AddToEnumList(), and DeleteList().


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