ReactOS 0.4.16-dev-319-g6cf4263
CFontInfo Class Reference

#include <CFontCache.hpp>

Collaboration diagram for CFontInfo:

Public Member Functions

 CFontInfo (LPCWSTR name=L"")
 
const CStringWName () const
 
const bool Valid () const
 
const CStringWFile ()
 
const LARGE_INTEGERFileSize ()
 
const FILETIMEFileWriteTime ()
 
DWORD FileAttributes ()
 

Private Member Functions

void ReadAttrs ()
 

Private Attributes

CStringW m_Name
 
CStringW m_File
 
bool m_FileRead
 
bool m_AttrsRead
 
LARGE_INTEGER m_FileSize
 
FILETIME m_FileWriteTime
 
DWORD m_dwFileAttributes
 

Detailed Description

Definition at line 11 of file CFontCache.hpp.

Constructor & Destructor Documentation

◆ CFontInfo()

CFontInfo::CFontInfo ( LPCWSTR  name = L"")

Definition at line 14 of file CFontCache.cpp.

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

Member Function Documentation

◆ File()

const CStringW & CFontInfo::File ( )

Definition at line 34 of file CFontCache.cpp.

35{
36 if (!m_FileRead)
37 {
38 if (Valid())
39 {
40 // Read the filename stored in the registry.
41 // This can be either a filename or a full path
44 {
46 DWORD dwAllocated = 128;
48 do
49 {
50 DWORD dwSize = dwAllocated;
51 PWSTR Buffer = Value.GetBuffer(dwSize);
52 Status = key.QueryStringValue(m_Name, Buffer, &dwSize);
53 Value.ReleaseBuffer(dwSize);
54 if (Status == ERROR_SUCCESS)
55 {
56 // Ensure we do not re-use the same string object, by passing it a PCWSTR
58 break;
59 }
60 dwAllocated += 128;
61 } while (Status == ERROR_MORE_DATA);
62 }
63 }
64 m_FileRead = true;
65 }
66 return m_File;
67}
PXSTR GetString() noexcept
Definition: atlsimpstr.h:367
Definition: bufpool.h:45
CStringW m_File
Definition: CFontCache.hpp:15
const bool Valid() const
Definition: CFontCache.cpp:29
#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:30
#define FONT_KEY
Definition: precomp.h:31
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:1023
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

◆ FileAttributes()

DWORD CFontInfo::FileAttributes ( )

Definition at line 108 of file CFontCache.cpp.

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

◆ FileSize()

const LARGE_INTEGER & CFontInfo::FileSize ( )

Definition at line 92 of file CFontCache.cpp.

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

◆ FileWriteTime()

const FILETIME & CFontInfo::FileWriteTime ( )

Definition at line 100 of file CFontCache.cpp.

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

◆ Name()

const CStringW & CFontInfo::Name ( ) const

Definition at line 24 of file CFontCache.cpp.

25{
26 return m_Name;
27}

◆ ReadAttrs()

void CFontInfo::ReadAttrs ( )
private

Definition at line 69 of file CFontCache.cpp.

70{
71 CStringW File = g_FontCache->Filename(this, true);
72
73 m_AttrsRead = true;
74
75 WIN32_FIND_DATAW findFileData;
76 HANDLE hFile = FindFirstFileW(File, &findFileData);
78 {
79
80 // File write time
81 FileTimeToLocalFileTime(&findFileData.ftLastWriteTime, &m_FileWriteTime);
82
83 // File size
84 m_FileSize.HighPart = findFileData.nFileSizeHigh;
85 m_FileSize.LowPart = findFileData.nFileSizeLow;
86
87 m_dwFileAttributes = findFileData.dwFileAttributes;
89 }
90}
CFontCache * g_FontCache
Definition: CFontCache.cpp:12
CStringW Filename(CFontInfo *info, bool alwaysFullPath=false)
Definition: CFontCache.cpp:164
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
ULONG LowPart
Definition: typedefs.h:106

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

◆ Valid()

const bool CFontInfo::Valid ( ) const

Definition at line 29 of file CFontCache.cpp.

30{
31 return !m_Name.IsEmpty();
32}
bool IsEmpty() const noexcept
Definition: atlsimpstr.h:394

Referenced by File().

Member Data Documentation

◆ m_AttrsRead

bool CFontInfo::m_AttrsRead
private

Definition at line 18 of file CFontCache.hpp.

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

◆ m_dwFileAttributes

DWORD CFontInfo::m_dwFileAttributes
private

Definition at line 21 of file CFontCache.hpp.

Referenced by FileAttributes(), and ReadAttrs().

◆ m_File

CStringW CFontInfo::m_File
private

Definition at line 15 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 19 of file CFontCache.hpp.

Referenced by FileSize(), and ReadAttrs().

◆ m_FileWriteTime

FILETIME CFontInfo::m_FileWriteTime
private

Definition at line 20 of file CFontCache.hpp.

Referenced by FileWriteTime(), and ReadAttrs().

◆ m_Name

CStringW CFontInfo::m_Name
private

Definition at line 14 of file CFontCache.hpp.

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


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