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
qfilesystemwatcher_win_p.h
Go to the documentation of this file.
1
// Copyright (C) 2016 The Qt Company Ltd.
2
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
// Qt-Security score:significant reason:default
4
5
#
ifndef
QFILESYSTEMWATCHER_WIN_P_H
6
#
define
QFILESYSTEMWATCHER_WIN_P_H
7
8
//
9
// W A R N I N G
10
// -------------
11
//
12
// This file is not part of the Qt API. It exists purely as an
13
// implementation detail. This header file may change from version to
14
// version without notice, or even be removed.
15
//
16
// We mean it.
17
//
18
19
#
include
"qfilesystemwatcher_p.h"
20
21
#
include
<
QtCore
/
qdatetime
.
h
>
22
#
include
<
QtCore
/
qfile
.
h
>
23
#
include
<
QtCore
/
qfileinfo
.
h
>
24
#
include
<
QtCore
/
qhash
.
h
>
25
#
include
<
QtCore
/
qlist
.
h
>
26
#
include
<
QtCore
/
qmutex
.
h
>
27
#
include
<
QtCore
/
qthread
.
h
>
28
29
QT_BEGIN_NAMESPACE
30
31
class
QWindowsFileSystemWatcherEngineThread
;
32
class
QWindowsRemovableDriveListener
;
33
34
// Even though QWindowsFileSystemWatcherEngine is derived of QThread
35
// via QFileSystemWatcher, it does not start a thread.
36
// Instead QWindowsFileSystemWatcher creates QWindowsFileSystemWatcherEngineThreads
37
// to do the actually watching.
38
class
QWindowsFileSystemWatcherEngine
:
public
QFileSystemWatcherEngine
39
{
40
Q_OBJECT
41
public
:
42
explicit
QWindowsFileSystemWatcherEngine
(
QObject
*
parent
);
43
~
QWindowsFileSystemWatcherEngine
();
44
45
QStringList
addPaths
(
const
QStringList &paths, QStringList *files, QStringList *directories)
override
;
46
QStringList
removePaths
(
const
QStringList &paths, QStringList *files, QStringList *directories)
override
;
47
48
class
Handle
49
{
50
public
:
51
Qt
::
HANDLE
handle
;
52
uint
flags
;
53
54
Handle
();
55
};
56
57
class
PathInfo
{
58
public
:
59
QString
absolutePath
;
60
QString
path
;
61
bool
isDir
;
62
63
// fileinfo bits
64
uint
ownerId
;
65
uint
groupId
;
66
QFile
::
Permissions
permissions
;
67
QDateTime
lastModified
;
68
69
PathInfo
&
operator
=(
const
QFileInfo &fileInfo)
70
{
71
ownerId = fileInfo.ownerId();
72
groupId = fileInfo.groupId();
73
permissions = fileInfo.permissions();
74
lastModified = fileInfo.lastModified();
75
return
*
this
;
76
}
77
78
bool
operator
!=(
const
QFileInfo &fileInfo)
const
79
{
80
return
(ownerId != fileInfo.ownerId()
81
|| groupId != fileInfo.groupId()
82
|| permissions != fileInfo.permissions()
83
|| lastModified != fileInfo.lastModified());
84
}
85
};
86
87
Q_SIGNALS
:
88
void
driveLockForRemoval
(
const
QString
&);
89
void
driveLockForRemovalFailed
(
const
QString &);
90
void
driveRemoved
(
const
QString &);
91
92
private
:
93
QList<QWindowsFileSystemWatcherEngineThread *> threads;
94
QWindowsRemovableDriveListener
*m_driveListener =
nullptr
;
95
};
96
97
class
QFileSystemWatcherPathKey
:
public
QString
98
{
99
public
:
100
QFileSystemWatcherPathKey
() {}
101
explicit
QFileSystemWatcherPathKey
(
const
QString &other) :
QString
(
other
) {}
102
QFileSystemWatcherPathKey
(
const
QFileSystemWatcherPathKey
&other) :
QString
(
other
) {}
103
bool
operator
==(
const
QFileSystemWatcherPathKey
&other)
const
{
return
!compare(other, Qt::CaseInsensitive); }
104
};
105
106
Q_DECLARE_TYPEINFO
(
QFileSystemWatcherPathKey
,
Q_RELOCATABLE_TYPE
);
107
108
inline
size_t
qHash
(
const
QFileSystemWatcherPathKey
&key, size_t seed = 0)
109
{
110
return
qHash(key.toCaseFolded(), seed);
111
}
112
113
class
QWindowsFileSystemWatcherEngineThread
:
public
QThread
114
{
115
Q_OBJECT
116
117
public
:
118
typedef
QHash
<
QFileSystemWatcherPathKey
,
QWindowsFileSystemWatcherEngine
::
Handle
>
HandleForDirHash
;
119
typedef
QHash
<
QFileSystemWatcherPathKey
,
QWindowsFileSystemWatcherEngine
::
PathInfo
>
PathInfoHash
;
120
121
QWindowsFileSystemWatcherEngineThread
();
122
~
QWindowsFileSystemWatcherEngineThread
();
123
void
run
()
override
;
124
void
stop
();
125
void
wakeup
();
126
127
QMutex
mutex
;
128
QList
<
Qt
::
HANDLE
>
handles
;
129
int
msg
;
130
131
HandleForDirHash
handleForDir
;
132
133
QHash
<
Qt
::
HANDLE
,
PathInfoHash
>
pathInfoForHandle
;
134
135
Q_SIGNALS
:
136
void
fileChanged
(
const
QString
&
path
,
bool
removed
);
137
void
directoryChanged
(
const
QString &path,
bool
removed);
138
};
139
140
QT_END_NAMESPACE
141
142
#
endif
// QFILESYSTEMWATCHER_WIN_P_H
QFileSystemWatcherPathKey
Definition
qfilesystemwatcher_win_p.h:98
QFileSystemWatcherPathKey::QFileSystemWatcherPathKey
QFileSystemWatcherPathKey(const QFileSystemWatcherPathKey &other)
Definition
qfilesystemwatcher_win_p.h:102
QFileSystemWatcherPathKey::operator==
bool operator==(const QFileSystemWatcherPathKey &other) const
Definition
qfilesystemwatcher_win_p.h:103
QFileSystemWatcherPathKey::QFileSystemWatcherPathKey
QFileSystemWatcherPathKey(const QString &other)
Definition
qfilesystemwatcher_win_p.h:101
QFileSystemWatcherPathKey::QFileSystemWatcherPathKey
QFileSystemWatcherPathKey()
Definition
qfilesystemwatcher_win_p.h:100
QWindowsFileSystemWatcherEngineThread
Definition
qfilesystemwatcher_win_p.h:114
QWindowsFileSystemWatcherEngineThread::stop
void stop()
Definition
qfilesystemwatcher_win.cpp:697
QWindowsFileSystemWatcherEngineThread::wakeup
void wakeup()
Definition
qfilesystemwatcher_win.cpp:703
QWindowsFileSystemWatcherEngineThread::~QWindowsFileSystemWatcherEngineThread
~QWindowsFileSystemWatcherEngineThread()
Definition
qfilesystemwatcher_win.cpp:577
QWindowsFileSystemWatcherEngineThread::handleForDir
HandleForDirHash handleForDir
Definition
qfilesystemwatcher_win_p.h:131
QWindowsFileSystemWatcherEngineThread::directoryChanged
void directoryChanged(const QString &path, bool removed)
QWindowsFileSystemWatcherEngineThread::handles
QList< Qt::HANDLE > handles
Definition
qfilesystemwatcher_win_p.h:128
QWindowsFileSystemWatcherEngineThread::msg
int msg
Definition
qfilesystemwatcher_win_p.h:129
QWindowsFileSystemWatcherEngineThread::pathInfoForHandle
QHash< Qt::HANDLE, PathInfoHash > pathInfoForHandle
Definition
qfilesystemwatcher_win_p.h:133
QWindowsFileSystemWatcherEngineThread::QWindowsFileSystemWatcherEngineThread
QWindowsFileSystemWatcherEngineThread()
Definition
qfilesystemwatcher_win.cpp:567
QWindowsFileSystemWatcherEngineThread::run
void run() override
Definition
qfilesystemwatcher_win.cpp:600
QWindowsFileSystemWatcherEngineThread::PathInfoHash
QHash< QFileSystemWatcherPathKey, QWindowsFileSystemWatcherEngine::PathInfo > PathInfoHash
Definition
qfilesystemwatcher_win_p.h:119
QWindowsFileSystemWatcherEngineThread::mutex
QMutex mutex
Definition
qfilesystemwatcher_win_p.h:127
QWindowsFileSystemWatcherEngine::Handle
Definition
qfilesystemwatcher_win_p.h:49
QWindowsFileSystemWatcherEngine::Handle::handle
Qt::HANDLE handle
Definition
qfilesystemwatcher_win_p.h:51
QWindowsFileSystemWatcherEngine::Handle::Handle
Handle()
Definition
qfilesystemwatcher_win.cpp:293
QWindowsFileSystemWatcherEngine::Handle::flags
uint flags
Definition
qfilesystemwatcher_win_p.h:52
QWindowsFileSystemWatcherEngine::PathInfo
Definition
qfilesystemwatcher_win_p.h:57
QWindowsFileSystemWatcherEngine::PathInfo::isDir
bool isDir
Definition
qfilesystemwatcher_win_p.h:61
QWindowsFileSystemWatcherEngine::PathInfo::groupId
uint groupId
Definition
qfilesystemwatcher_win_p.h:65
QWindowsFileSystemWatcherEngine::PathInfo::lastModified
QDateTime lastModified
Definition
qfilesystemwatcher_win_p.h:67
QWindowsFileSystemWatcherEngine::PathInfo::operator!=
bool operator!=(const QFileInfo &fileInfo) const
Definition
qfilesystemwatcher_win_p.h:78
QWindowsFileSystemWatcherEngine::PathInfo::permissions
QFile::Permissions permissions
Definition
qfilesystemwatcher_win_p.h:66
QWindowsFileSystemWatcherEngine::PathInfo::ownerId
uint ownerId
Definition
qfilesystemwatcher_win_p.h:64
QWindowsFileSystemWatcherEngine::PathInfo::operator=
PathInfo & operator=(const QFileInfo &fileInfo)
Definition
qfilesystemwatcher_win_p.h:69
QWindowsFileSystemWatcherEngine::PathInfo::absolutePath
QString absolutePath
Definition
qfilesystemwatcher_win_p.h:59
QWindowsFileSystemWatcherEngine::PathInfo::path
QString path
Definition
qfilesystemwatcher_win_p.h:60
QWindowsFileSystemWatcherEngine
Definition
qfilesystemwatcher_win_p.h:39
QWindowsFileSystemWatcherEngine::addPaths
QStringList addPaths(const QStringList &paths, QStringList *files, QStringList *directories) override
Definition
qfilesystemwatcher_win.cpp:328
QWindowsFileSystemWatcherEngine::~QWindowsFileSystemWatcherEngine
~QWindowsFileSystemWatcherEngine()
Definition
qfilesystemwatcher_win.cpp:319
QWindowsFileSystemWatcherEngine::driveLockForRemovalFailed
void driveLockForRemovalFailed(const QString &)
QWindowsFileSystemWatcherEngine::removePaths
QStringList removePaths(const QStringList &paths, QStringList *files, QStringList *directories) override
Definition
qfilesystemwatcher_win.cpp:486
QWindowsFileSystemWatcherEngine::driveRemoved
void driveRemoved(const QString &)
QWindowsRemovableDriveListener
Definition
qfilesystemwatcher_win.cpp:59
QWindowsRemovableDriveListener::addPath
void addPath(const QString &path)
Definition
qfilesystemwatcher_win.cpp:242
QWindowsRemovableDriveListener::driveLockForRemovalFailed
void driveLockForRemovalFailed(const QString &)
QWindowsRemovableDriveListener::driveLockForRemoval
void driveLockForRemoval(const QString &)
QWindowsRemovableDriveListener::driveRemoved
void driveRemoved(const QString &)
QWindowsRemovableDriveListener::~QWindowsRemovableDriveListener
~QWindowsRemovableDriveListener()
Definition
qfilesystemwatcher_win.cpp:114
QWindowsRemovableDriveListener::driveRemoved
void driveRemoved()
QWindowsRemovableDriveListener::nativeEventFilter
bool nativeEventFilter(const QByteArray &, void *messageIn, qintptr *) override
This method is called for every native event.
Definition
qfilesystemwatcher_win.cpp:224
QWindowsRemovableDriveListener::QWindowsRemovableDriveListener
QWindowsRemovableDriveListener(QObject *parent=nullptr)
Definition
qfilesystemwatcher_win.cpp:95
QT_BEGIN_NAMESPACE
Combined button and popup list for selecting options.
Definition
qsequentialanimationgroup.cpp:47
std
[33]
Definition
src_corelib_tools_qhash.cpp:421
DEBUG
#define DEBUG
Definition
qfilesystemwatcher_fsevents.mm:24
createChangeNotification
static Qt::HANDLE createChangeNotification(const QString &path, uint flags)
Definition
qfilesystemwatcher_win.cpp:40
findByHDevNotify
static Iterator findByHDevNotify(Iterator i1, Iterator i2, HDEVNOTIFY hdevnotify)
Definition
qfilesystemwatcher_win.cpp:108
stopDeviceNotification
static void stopDeviceNotification(QWindowsRemovableDriveListener::RemovableDriveEntry &e)
Definition
qfilesystemwatcher_win.cpp:101
pathFromEntry
static QString pathFromEntry(const QWindowsRemovableDriveListener::RemovableDriveEntry &re)
Definition
qfilesystemwatcher_win.cpp:119
qHash
size_t qHash(const QFileSystemWatcherPathKey &key, size_t seed=0)
Definition
qfilesystemwatcher_win_p.h:108
Q_DECLARE_TYPEINFO
Q_DECLARE_TYPEINFO(QFileSystemWatcherPathKey, Q_RELOCATABLE_TYPE)
QWindowsRemovableDriveListener::RemovableDriveEntry
Definition
qfilesystemwatcher_win.cpp:66
QWindowsRemovableDriveListener::RemovableDriveEntry::drive
wchar_t drive
Definition
qfilesystemwatcher_win.cpp:68
QWindowsRemovableDriveListener::RemovableDriveEntry::devNotify
HDEVNOTIFY devNotify
Definition
qfilesystemwatcher_win.cpp:67
qtbase
src
corelib
io
qfilesystemwatcher_win_p.h
Generated on
for Qt by
1.18.0