xref: /reactos/dll/shellext/fontext/CFontCache.hpp (revision b5218987)
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,2020 Mark Jansen (mark.jansen@reactos.org)
6  */
7 
8 #pragma once
9 
10 
11 class CFontInfo
12 {
13 private:
14     CStringW m_Name;
15     CStringW m_File;
16     bool m_FileRead;
17 public:
18     CFontInfo(LPCWSTR name = L"");
19 
20     const CStringW& Name() const;
21     const CStringW& File();
22     const bool Valid() const;
23 };
24 
25 
26 class CFontCache
27 {
28 private:
29     CAtlArray<CFontInfo> m_Fonts;
30     CStringW m_FontFolderPath;
31 
32 protected:
33     CFontCache();
34 
35     void Insert(CAtlList<CFontInfo>& fonts, const CStringW& KeyName);
36     void Read();
37 
38 public:
39     void SetFontDir(const LPCWSTR Path);
40     const CStringW& FontPath() const { return m_FontFolderPath; }
41 
42     size_t Size();
43     CStringW Name(size_t Index);
44     CStringW Filename(const FontPidlEntry* fontEntry, bool alwaysFullPath = false);
45 
46     friend class CFontExtModule;
47 };
48 
49 
50 extern CFontCache* g_FontCache;
51 
52 
53