ReactOS 0.4.16-dev-2298-gcac013a
CFontInfo Class Reference

#include <CFontCache.hpp>

Collaboration diagram for CFontInfo:

Public Member Functions

 CFontInfo (PCWSTR name=L"", PCWSTR value=L"")
 
const CStringWName () const
 
const bool Valid () const
 
BOOL IsMarkDeleted () const
 
void MarkDeleted ()
 
const CStringWFile ()
 
const LARGE_INTEGERFileSize ()
 
const FILETIMEFileWriteTime ()
 
DWORD FileAttributes ()
 

Private Member Functions

void ReadAttrs ()
 

Private Attributes

CStringW m_Name
 
CStringW m_File
 
BOOL m_bMarkDeleted = FALSE
 
bool m_FileRead
 
bool m_AttrsRead
 
LARGE_INTEGER m_FileSize
 
FILETIME m_FileWriteTime
 
DWORD m_dwFileAttributes
 

Detailed Description

Definition at line 10 of file CFontCache.hpp.

Constructor & Destructor Documentation

◆ CFontInfo()

CFontInfo::CFontInfo ( PCWSTR  name = L"",
PCWSTR  value = L"" 
)

Definition at line 14 of file CFontCache.cpp.

15 : m_Name(name)
16 , m_File(value)
17 , m_FileRead(false)
18 , m_AttrsRead(false)
19 , m_FileWriteTime({})
21{
23}
CStringW m_Name
Definition: CFontCache.hpp:13
FILETIME m_FileWriteTime
Definition: CFontCache.hpp:19
LARGE_INTEGER m_FileSize
Definition: CFontCache.hpp:18
CStringW m_File
Definition: CFontCache.hpp:14
bool m_FileRead
Definition: CFontCache.hpp:16
DWORD m_dwFileAttributes
Definition: CFontCache.hpp:20
bool m_AttrsRead
Definition: CFontCache.hpp:17
Definition: name.c:39
LONGLONG QuadPart
Definition: typedefs.h:114
Definition: pdh_main.c:96

Member Function Documentation

◆ File()

const CStringW & CFontInfo::File ( )

Definition at line 35 of file CFontCache.cpp.

36{
37 if (!m_FileRead)
38 {
39 if (Valid() && m_File.IsEmpty())
40 {
41 // Read the filename stored in the registry.
42 // This can be either a filename or a full path
45 {
47 DWORD dwAllocated = MAX_PATH;
49 do
50 {
51 DWORD dwSize = dwAllocated;
52 PWSTR Buffer = Value.GetBuffer(dwSize);
53 Status = key.QueryStringValue(m_Name, Buffer, &dwSize);
54 Value.ReleaseBuffer(dwSize);
55 if (Status == ERROR_SUCCESS)
56 {
57 // Ensure we do not re-use the same string object, by passing it a PCWSTR
59 break;
60 }
61 dwAllocated += 128;
62 } while (Status == ERROR_MORE_DATA);
63 }
64 }
65 m_FileRead = true;
66 }
67 return m_File;
68}
bool IsEmpty() const noexcept
Definition: atlsimpstr.h:394
PXSTR GetString() noexcept
Definition: atlsimpstr.h:367
Definition: bufpool.h:45
const bool Valid() const
Definition: CFontCache.cpp:30
#define ERROR_MORE_DATA
Definition: dderror.h:13
#define ERROR_SUCCESS
Definition: deptool.c:10
static LSTATUS(WINAPI *pRegDeleteTreeW)(HKEY
#define FONT_HIVE
Definition: precomp.h:50
#define FONT_KEY
Definition: precomp.h:51
#define MAX_PATH
Definition: compat.h:34
unsigned long DWORD
Definition: ntddk_ex.h:95
Status
Definition: gdiplustypes.h:25
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:56
#define KEY_READ
Definition: nt_native.h:1026
Definition: copy.c:22
uint16_t * PWSTR
Definition: typedefs.h:56
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING _Out_opt_ PUSHORT _Inout_opt_ PUNICODE_STRING Value
Definition: wdfregistry.h:413

Referenced by CFontCache::Insert().

◆ FileAttributes()

DWORD CFontInfo::FileAttributes ( )

Definition at line 109 of file CFontCache.cpp.

110{
111 if (!m_AttrsRead)
112 ReadAttrs();
113
114 return m_dwFileAttributes;
115}
void ReadAttrs()
Definition: CFontCache.cpp:70

◆ FileSize()

const LARGE_INTEGER & CFontInfo::FileSize ( )

Definition at line 93 of file CFontCache.cpp.

94{
95 if (!m_AttrsRead)
96 ReadAttrs();
97
98 return m_FileSize;
99}

◆ FileWriteTime()

const FILETIME & CFontInfo::FileWriteTime ( )

Definition at line 101 of file CFontCache.cpp.

102{
103 if (!m_AttrsRead)
104 ReadAttrs();
105
106 return m_FileWriteTime;
107}

◆ IsMarkDeleted()

BOOL CFontInfo::IsMarkDeleted ( ) const
inline

Definition at line 30 of file CFontCache.hpp.

30{ return m_bMarkDeleted; }
BOOL m_bMarkDeleted
Definition: CFontCache.hpp:15

◆ MarkDeleted()

void CFontInfo::MarkDeleted ( )
inline

Definition at line 31 of file CFontCache.hpp.

#define TRUE
Definition: types.h:120

◆ Name()

const CStringW & CFontInfo::Name ( ) const

Definition at line 25 of file CFontCache.cpp.

26{
27 return m_Name;
28}

◆ ReadAttrs()

void CFontInfo::ReadAttrs ( )
private

Definition at line 70 of file CFontCache.cpp.

71{
72 CStringW File = g_FontCache->Filename(this, true);
73
74 m_AttrsRead = true;
75
76 WIN32_FIND_DATAW findFileData;
77 HANDLE hFile = FindFirstFileW(File, &findFileData);
79 {
80
81 // File write time
83
84 // File size
85 m_FileSize.HighPart = findFileData.nFileSizeHigh;
86 m_FileSize.LowPart = findFileData.nFileSizeLow;
87
90 }
91}
CFontCache * g_FontCache
Definition: CFontCache.cpp:12
CStringW Filename(CFontInfo *info, bool alwaysFullPath=false)
Definition: CFontCache.cpp:193
Definition: File.h:16
#define INVALID_HANDLE_VALUE
Definition: compat.h:731
HANDLE WINAPI FindFirstFileW(IN LPCWSTR lpFileName, OUT LPWIN32_FIND_DATAW lpFindFileData)
Definition: find.c:320
BOOL WINAPI FindClose(HANDLE hFindFile)
Definition: find.c:502
BOOL WINAPI FileTimeToLocalFileTime(IN CONST FILETIME *lpFileTime, OUT LPFILETIME lpLocalFileTime)
Definition: time.c:221
_In_ HANDLE hFile
Definition: mswsock.h:90
FILETIME ftLastWriteTime
Definition: minwinbase.h:286
DWORD dwFileAttributes
Definition: minwinbase.h:283
ULONG LowPart
Definition: typedefs.h:106

Referenced by FileAttributes(), FileSize(), and FileWriteTime().

◆ Valid()

const bool CFontInfo::Valid ( ) const

Definition at line 30 of file CFontCache.cpp.

31{
32 return !m_Name.IsEmpty();
33}

Referenced by File().

Member Data Documentation

◆ m_AttrsRead

bool CFontInfo::m_AttrsRead
private

Definition at line 17 of file CFontCache.hpp.

Referenced by FileAttributes(), FileSize(), FileWriteTime(), and ReadAttrs().

◆ m_bMarkDeleted

BOOL CFontInfo::m_bMarkDeleted = FALSE
private

Definition at line 15 of file CFontCache.hpp.

Referenced by IsMarkDeleted(), and MarkDeleted().

◆ m_dwFileAttributes

DWORD CFontInfo::m_dwFileAttributes
private

Definition at line 20 of file CFontCache.hpp.

Referenced by FileAttributes(), and ReadAttrs().

◆ m_File

CStringW CFontInfo::m_File
private

Definition at line 14 of file CFontCache.hpp.

Referenced by File().

◆ m_FileRead

bool CFontInfo::m_FileRead
private

Definition at line 16 of file CFontCache.hpp.

Referenced by File().

◆ m_FileSize

LARGE_INTEGER CFontInfo::m_FileSize
private

Definition at line 18 of file CFontCache.hpp.

Referenced by FileSize(), and ReadAttrs().

◆ m_FileWriteTime

FILETIME CFontInfo::m_FileWriteTime
private

Definition at line 19 of file CFontCache.hpp.

Referenced by FileWriteTime(), and ReadAttrs().

◆ m_Name

CStringW CFontInfo::m_Name
private

Definition at line 13 of file CFontCache.hpp.

Referenced by File(), Name(), and Valid().


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