ReactOS  0.4.15-dev-5606-gf34e425
CFontCache.hpp
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: font list cache handling
5  * COPYRIGHT: Copyright 2019-2021 Mark Jansen <mark.jansen@reactos.org>
6  */
7 
8 #pragma once
9 
10 
11 class CFontInfo
12 {
13 private:
16  bool m_FileRead;
17 
22 
23  void ReadAttrs();
24 
25 public:
26  CFontInfo(LPCWSTR name = L"");
27 
28  const CStringW& Name() const; // Font display name stored in the registry
29  const bool Valid() const;
30 
31  const CStringW& File(); // Full path or file, depending on how it's stored in the registry
32  const LARGE_INTEGER& FileSize();
33  const FILETIME& FileWriteTime();
35 };
36 
37 
39 {
40 private:
41  CAtlArray<CFontInfo> m_Fonts;
43 
44 protected:
45  CFontCache();
46 
47  void Insert(CAtlList<CFontInfo>& fonts, const CStringW& KeyName);
48 
49 public:
50  void Read();
51 
52  void SetFontDir(const LPCWSTR Path);
53  const CStringW& FontPath() const { return m_FontFolderPath; }
54 
55  size_t Size();
56  CStringW Name(size_t Index); // Font display name stored in the registry
57 
58  CFontInfo* Find(const FontPidlEntry* fontEntry);
59  CStringW Filename(CFontInfo* info, bool alwaysFullPath = false);
60 
61  friend class CFontExtModule;
62 };
63 
64 
65 extern CFontCache* g_FontCache;
66 
67 
CStringW m_File
Definition: CFontCache.hpp:15
FILETIME m_FileWriteTime
Definition: CFontCache.hpp:20
const bool Valid() const
Definition: CFontCache.cpp:29
void Insert(CAtlList< CFontInfo > &fonts, const CStringW &KeyName)
Definition: CFontCache.cpp:184
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
CStringW m_Name
Definition: CFontCache.hpp:14
CFontCache * g_FontCache
Definition: CFontCache.cpp:12
LARGE_INTEGER m_FileSize
Definition: CFontCache.hpp:19
#define L(x)
Definition: ntvdm.h:50
_Must_inspect_result_ _In_ WDFDEVICE _In_ PCUNICODE_STRING KeyName
Definition: wdfdevice.h:2697
void SetFontDir(const LPCWSTR Path)
Definition: CFontCache.cpp:120
CStringW m_FontFolderPath
Definition: CFontCache.hpp:42
_In_ WDFCOLLECTION _In_ ULONG Index
CAtlArray< CFontInfo > m_Fonts
Definition: CFontCache.hpp:41
unsigned long DWORD
Definition: ntddk_ex.h:95
DWORD m_dwFileAttributes
Definition: CFontCache.hpp:21
void ReadAttrs()
Definition: CFontCache.cpp:69
DWORD FileAttributes()
Definition: CFontCache.cpp:108
const CStringW & FontPath() const
Definition: CFontCache.hpp:53
void Read()
Definition: CFontCache.cpp:200
const LARGE_INTEGER & FileSize()
Definition: CFontCache.cpp:92
CStringW Name(size_t Index)
Definition: CFontCache.cpp:134
PRTL_UNICODE_STRING_BUFFER Path
bool m_AttrsRead
Definition: CFontCache.hpp:18
const CStringW & File()
Definition: CFontCache.cpp:34
bool m_FileRead
Definition: CFontCache.hpp:16
size_t Size()
Definition: CFontCache.cpp:126
const FILETIME & FileWriteTime()
Definition: CFontCache.cpp:100
Definition: name.c:38
CFontInfo * Find(const FontPidlEntry *fontEntry)
Definition: CFontCache.cpp:145
CAtlStringW CStringW
Definition: atlstr.h:130
CStringW Filename(CFontInfo *info, bool alwaysFullPath=false)
Definition: CFontCache.cpp:164
const CStringW & Name() const
Definition: CFontCache.cpp:24
CFontInfo(LPCWSTR name=L"")
Definition: CFontCache.cpp:14