4 * Copyright 1998 Juergen Schmied <juergen.schmied@metronet.de>
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
23 WINE_DEFAULT_DEBUG_CHANNEL(shell
);
25 CEnumIDListBase::CEnumIDListBase() :
32 CEnumIDListBase::~CEnumIDListBase()
37 /**************************************************************************
40 BOOL
CEnumIDListBase::AddToEnumList(LPITEMIDLIST pidl
)
44 TRACE("(%p)->(pidl=%p)\n", this, pidl
);
49 pNew
= static_cast<ENUMLIST
*>(SHAlloc(sizeof(ENUMLIST
)));
52 /*set the next pointer */
56 /*is This the first item in the list? */
65 /*add the new item to the end of the list */
69 /*update the last item pointer */
71 TRACE("-- (%p)->(first=%p, last=%p)\n", this, mpFirst
, mpLast
);
77 /**************************************************************************
80 BOOL
CEnumIDListBase::DeleteList()
84 TRACE("(%p)->()\n", this);
89 mpFirst
= pDelete
->pNext
;
90 SHFree(pDelete
->pidl
);
99 /**************************************************************************
102 BOOL
CEnumIDListBase::HasItemWithCLSID(LPITEMIDLIST pidl
)
105 IID
*ptr
= _ILGetGUIDPointer(pidl
);
114 LPGUID curid
= _ILGetGUIDPointer(pCur
->pidl
);
115 if (curid
&& IsEqualGUID(*curid
, refid
))
126 HRESULT
CEnumIDListBase::AppendItemsFromEnumerator(IEnumIDList
* pEnum
)
136 while((S_OK
== pEnum
->Next(1, &pidl
, &dwFetched
)) && dwFetched
)
142 /**************************************************************************
146 HRESULT WINAPI
CEnumIDListBase::Next(
148 LPITEMIDLIST
* rgelt
,
155 TRACE("(%p)->(%d,%p, %p)\n", this, celt
, rgelt
, pceltFetched
);
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)
165 if(celt
> 1 && !pceltFetched
)
166 { return E_INVALIDARG
;
169 if(celt
> 0 && !mpCurrent
)
173 for(i
= 0; i
< celt
; i
++)
177 temp
= ILClone(mpCurrent
->pidl
);
179 mpCurrent
= mpCurrent
->pNext
;
188 /**************************************************************************
191 HRESULT WINAPI
CEnumIDListBase::Skip(
197 TRACE("(%p)->(%u)\n", this, celt
);
199 for(dwIndex
= 0; dwIndex
< celt
; dwIndex
++)
204 mpCurrent
= mpCurrent
->pNext
;
209 /**************************************************************************
210 * IEnumIDList_fnReset
212 HRESULT WINAPI
CEnumIDListBase::Reset()
214 TRACE("(%p)\n", this);
219 /**************************************************************************
220 * IEnumIDList_fnClone
222 HRESULT WINAPI
CEnumIDListBase::Clone(LPENUMIDLIST
*ppenum
)
224 TRACE("(%p)->() to (%p)->() E_NOTIMPL\n", this, ppenum
);
228 /**************************************************************************
229 * IEnumIDList_Folder_Constructor
232 HRESULT
IEnumIDList_Constructor(IEnumIDList
**enumerator
)
234 return ShellObjectCreator
<CEnumIDListBase
>(IID_PPV_ARG(IEnumIDList
, enumerator
));