ReactOS  0.4.15-dev-506-ga3ec01c
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)
 
virtual HRESULT STDMETHODCALLTYPE Next (ULONG celt, LPITEMIDLIST *rgelt, ULONG *pceltFetched)
 
virtual HRESULT STDMETHODCALLTYPE Skip (ULONG celt)
 
virtual HRESULT STDMETHODCALLTYPE Reset ()
 
virtual HRESULT STDMETHODCALLTYPE Clone (IEnumIDList **ppenum)
 
- 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)
 
- Public Member Functions inherited from IUnknown
HRESULT QueryInterface ([in] REFIID riid, [out, iid_is(riid)] void **ppvObject)
 
ULONG AddRef ()
 
ULONG Release ()
 

Private 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  :
26  mpFirst(NULL),
27  mpLast(NULL),
29 {
30 }
ENUMLIST * mpLast
smooth NULL
Definition: ftsmooth.c:416
ENUMLIST * mpFirst
ENUMLIST * mpCurrent

◆ ~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
LPITEMIDLIST pidl
ENUMLIST * mpLast
smooth NULL
Definition: ftsmooth.c:416
ENUMLIST * pNext
#define TRACE(s)
Definition: solgame.cpp:4
ENUMLIST * mpFirst
ENUMLIST * mpCurrent
LPVOID WINAPI SHAlloc(SIZE_T len)
Definition: shellole.c:309

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

◆ AppendItemsFromEnumerator()

HRESULT CEnumIDListBase::AppendItemsFromEnumerator ( IEnumIDList pEnum)

Definition at line 126 of file CEnumIDListBase.cpp.

127 {
128  LPITEMIDLIST pidl;
129  DWORD dwFetched;
130 
131  if (!pEnum)
132  return E_INVALIDARG;
133 
134  pEnum->Reset();
135 
136  while((S_OK == pEnum->Next(1, &pidl, &dwFetched)) && dwFetched)
137  AddToEnumList(pidl);
138 
139  return S_OK;
140 }
HRESULT Reset()
BOOL AddToEnumList(LPITEMIDLIST pidl)
HRESULT Next([in] ULONG celt, [out, size_is(celt), length_is(*pceltFetched)] PITEMID_CHILD *rgelt, [out] ULONG *pceltFetched)
#define E_INVALIDARG
Definition: ddrawi.h:101
unsigned long DWORD
Definition: ntddk_ex.h:95
#define S_OK
Definition: intsafe.h:59
ITEMIDLIST UNALIGNED * LPITEMIDLIST
Definition: shtypes.idl:41

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

◆ Clone()

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

Implements IEnumIDList.

Definition at line 222 of file CEnumIDListBase.cpp.

223 {
224  TRACE("(%p)->() to (%p)->() E_NOTIMPL\n", this, ppenum);
225  return E_NOTIMPL;
226 }
#define TRACE(s)
Definition: solgame.cpp:4
#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;
95  mpCurrent = NULL;
96  return TRUE;
97 }
#define TRUE
Definition: types.h:120
LPITEMIDLIST pidl
ENUMLIST * mpLast
smooth NULL
Definition: ftsmooth.c:416
ENUMLIST * pNext
#define TRACE(s)
Definition: solgame.cpp:4
ENUMLIST * mpFirst
ENUMLIST * mpCurrent
void WINAPI SHFree(LPVOID pv)
Definition: shellole.c:331

Referenced by ~CEnumIDListBase().

◆ HasItemWithCLSID()

BOOL CEnumIDListBase::HasItemWithCLSID ( LPITEMIDLIST  pidl)

Definition at line 102 of file CEnumIDListBase.cpp.

103 {
104  ENUMLIST *pCur;
105  IID *ptr = _ILGetGUIDPointer(pidl);
106 
107  if (ptr)
108  {
109  REFIID refid = *ptr;
110  pCur = mpFirst;
111 
112  while(pCur)
113  {
114  LPGUID curid = _ILGetGUIDPointer(pCur->pidl);
115  if (curid && IsEqualGUID(*curid, refid))
116  {
117  return TRUE;
118  }
119  pCur = pCur->pNext;
120  }
121  }
122 
123  return FALSE;
124 }
#define REFIID
Definition: guiddef.h:118
#define TRUE
Definition: types.h:120
LPITEMIDLIST pidl
static PVOID ptr
Definition: dispmode.c:27
ENUMLIST * pNext
IID * _ILGetGUIDPointer(LPCITEMIDLIST pidl)
Definition: pidl.c:2308
ENUMLIST * mpFirst
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4112

Referenced by CDesktopFolderEnum::AddItemsFromClassicStartMenuKey(), and CDesktopFolderEnum::Initialize().

◆ Next()

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

Definition at line 146 of file CEnumIDListBase.cpp.

150 {
151  ULONG i;
152  HRESULT hr = S_OK;
154 
155  TRACE("(%p)->(%d,%p, %p)\n", this, celt, rgelt, pceltFetched);
156 
157 /* It is valid to leave pceltFetched NULL when celt is 1. Some of explorer's
158  * subsystems actually use it (and so may a third party browser)
159  */
160  if(pceltFetched)
161  *pceltFetched = 0;
162 
163  *rgelt=0;
164 
165  if(celt > 1 && !pceltFetched)
166  { return E_INVALIDARG;
167  }
168 
169  if(celt > 0 && !mpCurrent)
170  { return S_FALSE;
171  }
172 
173  for(i = 0; i < celt; i++)
174  { if(!mpCurrent)
175  break;
176 
178  rgelt[i] = temp;
180  }
181  if(pceltFetched)
182  { *pceltFetched = i;
183  }
184 
185  return hr;
186 }
HRESULT hr
Definition: shlfolder.c:183
LPITEMIDLIST pidl
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
#define S_FALSE
Definition: winerror.h:2357
#define E_INVALIDARG
Definition: ddrawi.h:101
ENUMLIST * pNext
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:78
ENUMLIST * mpCurrent
#define S_OK
Definition: intsafe.h:59
static calc_node_t temp
Definition: rpn_ieee.c:38
LPITEMIDLIST WINAPI ILClone(LPCITEMIDLIST pidl)
Definition: pidl.c:228
unsigned int ULONG
Definition: retypes.h:1
ITEMIDLIST UNALIGNED * LPITEMIDLIST
Definition: shtypes.idl:41

◆ Reset()

HRESULT WINAPI CEnumIDListBase::Reset ( void  )
virtual

Implements IEnumIDList.

Definition at line 212 of file CEnumIDListBase.cpp.

213 {
214  TRACE("(%p)\n", this);
215  mpCurrent = mpFirst;
216  return S_OK;
217 }
#define TRACE(s)
Definition: solgame.cpp:4
ENUMLIST * mpFirst
ENUMLIST * mpCurrent
#define S_OK
Definition: intsafe.h:59

◆ Skip()

HRESULT WINAPI CEnumIDListBase::Skip ( ULONG  celt)
virtual

Implements IEnumIDList.

Definition at line 191 of file CEnumIDListBase.cpp.

193 {
194  DWORD dwIndex;
195  HRESULT hr = S_OK;
196 
197  TRACE("(%p)->(%u)\n", this, celt);
198 
199  for(dwIndex = 0; dwIndex < celt; dwIndex++)
200  { if(!mpCurrent)
201  { hr = S_FALSE;
202  break;
203  }
205  }
206  return hr;
207 }
HRESULT hr
Definition: shlfolder.c:183
#define S_FALSE
Definition: winerror.h:2357
ENUMLIST * pNext
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:78
unsigned long DWORD
Definition: ntddk_ex.h:95
ENUMLIST * mpCurrent
#define S_OK
Definition: intsafe.h:59

Member Data Documentation

◆ mpCurrent

ENUMLIST* CEnumIDListBase::mpCurrent
private

Definition at line 33 of file CEnumIDListBase.h.

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

◆ mpFirst

ENUMLIST* CEnumIDListBase::mpFirst
private

Definition at line 31 of file CEnumIDListBase.h.

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

◆ mpLast

ENUMLIST* CEnumIDListBase::mpLast
private

Definition at line 32 of file CEnumIDListBase.h.

Referenced by AddToEnumList(), and DeleteList().


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