Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Toggle main menu visibility
Loading...
Searching...
No Matches
fx_folder_windows.cpp
Go to the documentation of this file.
1
// Copyright 2021 The PDFium Authors
2
// Use of this source code is governed by a BSD-style license that can be
3
// found in the LICENSE file.
4
5
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6
7
#
include
"core/fxcrt/fx_folder.h"
8
9
#
include
<
memory
>
10
11
#
include
"build/build_config.h"
12
#
include
"core/fxcrt/ptr_util.h"
13
14
#
if
!
BUILDFLAG
(
IS_WIN
)
15
#
error
"built on wrong platform"
16
#
endif
17
18
#
include
<
direct
.
h
>
19
20
class
FX_WindowsFolder
:
public
FX_Folder
{
21
public
:
22
~
FX_WindowsFolder
()
override
;
23
bool
GetNextFile
(
ByteString
* filename,
bool
* bFolder)
override
;
24
25
private
:
26
friend
class
FX_Folder
;
27
FX_WindowsFolder();
28
29
HANDLE m_Handle =
INVALID_HANDLE_VALUE
;
30
bool
m_bReachedEnd =
false
;
31
WIN32_FIND_DATAA m_FindData;
32
};
33
34
std::unique_ptr<FX_Folder>
FX_Folder
::OpenFolder(
const
ByteString
& path) {
35
// Private ctor.
36
auto
handle =
pdfium
::WrapUnique(
new
FX_WindowsFolder
());
37
ByteString
search_path = path
+
"/*.*"
;
38
handle->m_Handle =
39
FindFirstFileExA(search_path.c_str(), FindExInfoStandard,
40
&handle->m_FindData, FindExSearchNameMatch,
nullptr
, 0);
41
if
(handle->m_Handle == INVALID_HANDLE_VALUE)
42
return
nullptr
;
43
44
return
handle;
45
}
46
47
FX_WindowsFolder
::FX_WindowsFolder() =
default
;
48
49
FX_WindowsFolder
::~
FX_WindowsFolder
() {
50
if
(m_Handle != INVALID_HANDLE_VALUE)
51
FindClose(m_Handle);
52
}
53
54
bool
FX_WindowsFolder
::
GetNextFile
(
ByteString
* filename,
bool
* bFolder) {
55
if
(m_bReachedEnd)
56
return
false
;
57
58
*filename = m_FindData.cFileName;
59
*bFolder = !!(m_FindData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY);
60
if
(!FindNextFileA(m_Handle, &m_FindData))
61
m_bReachedEnd =
true
;
62
return
true
;
63
}
ByteString
fxcrt::ByteString ByteString
Definition
bytestring.h:180
FX_Folder
Definition
fx_folder.h:14
FX_WindowsFolder
Definition
fx_folder_windows.cpp:20
FX_WindowsFolder::~FX_WindowsFolder
~FX_WindowsFolder() override
Definition
fx_folder_windows.cpp:49
FX_WindowsFolder::GetNextFile
bool GetNextFile(ByteString *filename, bool *bFolder) override
Definition
fx_folder_windows.cpp:54
pdfium::CFDETextOutLargeBitmapTest
Definition
cfde_textout_unittest.cpp:117
fxcrt::operator+
ByteString operator+(const ByteString &str1, const char *str2)
Definition
bytestring.h:155
qtwebengine
src
3rdparty
chromium
third_party
pdfium
core
fxcrt
fx_folder_windows.cpp
Generated on
for Qt by
1.18.0