ReactOS 0.4.15-dev-8100-g1887773
CEnumFonts.cpp
Go to the documentation of this file.
1/*
2 * PROJECT: ReactOS Font Shell Extension
3 * LICENSE: GPL-2.0-or-later (https://spdx.org/licenses/GPL-2.0-or-later)
4 * PURPOSE: CEnumFonts implementation
5 * COPYRIGHT: Copyright 2019 Mark Jansen <mark.jansen@reactos.org>
6 */
7
8#include "precomp.h"
9
11
12
13
15 public CComObjectRootEx<CComMultiThreadModelNoCS>,
16 public IEnumIDList
17{
18private:
21
22public:
24 :m_dwFlags(0)
25 ,m_Index(0)
26 {
27 }
28
30 {
32 m_Index = 0;
33 return S_OK;
34 }
35
36 // *** IEnumIDList methods ***
37 STDMETHODIMP Next(ULONG celt, LPITEMIDLIST *rgelt, ULONG *pceltFetched)
38 {
39 if (!rgelt || (!pceltFetched && celt != 1))
40 return E_POINTER;
41
42 HRESULT hr = S_OK;
43 ULONG Fetched = 0;
44
45 while (celt)
46 {
47 celt--;
48
49 if (m_Index < g_FontCache->Size())
50 {
53 if (!item)
54 {
55 hr = Fetched ? S_FALSE : E_OUTOFMEMORY;
56 break;
57 }
58 rgelt[Fetched] = item;
59 m_Index++;
60 Fetched++;
61 }
62 else
63 {
64 hr = S_FALSE;
65 }
66 }
67
68 if (pceltFetched)
69 *pceltFetched = Fetched;
70 return hr;
71 }
73 {
74 m_Index += celt;
75 return S_OK;
76 }
78 {
79 m_Index = 0;
80 return S_OK;
81 }
83 {
84 return E_NOTIMPL;
85 }
86
87
88public:
91
93 COM_INTERFACE_ENTRY_IID(IID_IEnumIDList, IEnumIDList)
95};
96
97
99{
100 return ShellObjectCreatorInit<CEnumFonts>(zip, flags, riid, ppvOut);
101}
102
HRESULT _CEnumFonts_CreateInstance(CFontExt *zip, DWORD flags, REFIID riid, LPVOID *ppvOut)
Definition: CEnumFonts.cpp:98
CFontCache * g_FontCache
Definition: CFontCache.cpp:12
#define WINE_DEFAULT_DEBUG_CHANNEL(t)
Definition: precomp.h:23
#define STDMETHODIMP
Definition: basetyps.h:43
ULONG m_Index
Definition: CEnumFonts.cpp:20
DWORD m_dwFlags
Definition: CEnumFonts.cpp:19
STDMETHODIMP Clone(IEnumIDList **ppenum)
Definition: CEnumFonts.cpp:82
STDMETHODIMP Next(ULONG celt, LPITEMIDLIST *rgelt, ULONG *pceltFetched)
Definition: CEnumFonts.cpp:37
STDMETHODIMP Skip(ULONG celt)
Definition: CEnumFonts.cpp:72
STDMETHODIMP Initialize(CFontExt *folder, DWORD flags)
Definition: CEnumFonts.cpp:29
STDMETHODIMP Reset()
Definition: CEnumFonts.cpp:77
CStringW Name(size_t Index)
Definition: CFontCache.cpp:134
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define E_NOTIMPL
Definition: ddrawi.h:99
unsigned long DWORD
Definition: ntddk_ex.h:95
LPITEMIDLIST _ILCreate(LPCWSTR lpString, ULONG Index)
Definition: fontpidl.cpp:10
GLbitfield flags
Definition: glext.h:7161
REFIID riid
Definition: atlbase.h:39
#define S_OK
Definition: intsafe.h:52
#define BEGIN_COM_MAP(x)
Definition: atlcom.h:581
#define COM_INTERFACE_ENTRY_IID(iid, x)
Definition: atlcom.h:601
#define DECLARE_PROTECT_FINAL_CONSTRUCT()
Definition: atlcom.h:679
#define DECLARE_NOT_AGGREGATABLE(x)
Definition: atlcom.h:651
#define END_COM_MAP()
Definition: atlcom.h:592
static ATOM item
Definition: dde.c:856
#define REFIID
Definition: guiddef.h:118
HRESULT hr
Definition: shlfolder.c:183
ITEMIDLIST UNALIGNED * LPITEMIDLIST
Definition: shtypes.idl:41
Definition: fci.c:116
uint32_t ULONG
Definition: typedefs.h:59
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
Definition: wdfdevice.h:4533
#define S_FALSE
Definition: winerror.h:2357
#define E_POINTER
Definition: winerror.h:2365