Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
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
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
30
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.
38class QWindowsFileSystemWatcherEngine : public QFileSystemWatcherEngine
39{
41public:
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:
53
54 Handle();
55 };
56
57 class PathInfo {
58 public:
61 bool isDir;
62
63 // fileinfo bits
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
89 void driveLockForRemovalFailed(const QString &);
90 void driveRemoved(const QString &);
91
92private:
93 QList<QWindowsFileSystemWatcherEngineThread *> threads;
94 QWindowsRemovableDriveListener *m_driveListener = nullptr;
95};
96
98{
99public:
101 explicit QFileSystemWatcherPathKey(const QString &other) : QString(other) {}
103 bool operator==(const QFileSystemWatcherPathKey &other) const { return !compare(other, Qt::CaseInsensitive); }
104};
105
107
108inline size_t qHash(const QFileSystemWatcherPathKey &key, size_t seed = 0)
109{
110 return qHash(key.toCaseFolded(), seed);
111}
112
139
140QT_END_NAMESPACE
141
142#endif // QFILESYSTEMWATCHER_WIN_P_H
QFileSystemWatcherPathKey(const QFileSystemWatcherPathKey &other)
bool operator==(const QFileSystemWatcherPathKey &other) const
QFileSystemWatcherPathKey(const QString &other)
void directoryChanged(const QString &path, bool removed)
QHash< Qt::HANDLE, PathInfoHash > pathInfoForHandle
QHash< QFileSystemWatcherPathKey, QWindowsFileSystemWatcherEngine::PathInfo > PathInfoHash
bool operator!=(const QFileInfo &fileInfo) const
PathInfo & operator=(const QFileInfo &fileInfo)
QStringList addPaths(const QStringList &paths, QStringList *files, QStringList *directories) override
void driveLockForRemovalFailed(const QString &)
QStringList removePaths(const QStringList &paths, QStringList *files, QStringList *directories) override
void driveRemoved(const QString &)
void driveLockForRemovalFailed(const QString &)
void driveLockForRemoval(const QString &)
void driveRemoved(const QString &)
bool nativeEventFilter(const QByteArray &, void *messageIn, qintptr *) override
This method is called for every native event.
QWindowsRemovableDriveListener(QObject *parent=nullptr)
static Qt::HANDLE createChangeNotification(const QString &path, uint flags)
static Iterator findByHDevNotify(Iterator i1, Iterator i2, HDEVNOTIFY hdevnotify)
static void stopDeviceNotification(QWindowsRemovableDriveListener::RemovableDriveEntry &e)
static QString pathFromEntry(const QWindowsRemovableDriveListener::RemovableDriveEntry &re)
size_t qHash(const QFileSystemWatcherPathKey &key, size_t seed=0)
Q_DECLARE_TYPEINFO(QFileSystemWatcherPathKey, Q_RELOCATABLE_TYPE)