File indexing completed on 2024-04-21 05:48:32
0001 // SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL 0002 // SPDX-FileCopyrightText: 2022 Harald Sitter <sitter@kde.org> 0003 0004 #pragma once 0005 0006 #include <windows.h> 0007 0008 #include <QByteArray> 0009 0010 #include "directoryEntry.h" 0011 0012 class WindowsWalker 0013 { 0014 public: 0015 explicit WindowsWalker(const QByteArray &path); 0016 ~WindowsWalker(); 0017 0018 void next(); 0019 0020 HANDLE m_handle = INVALID_HANDLE_VALUE; 0021 const QByteArray m_path; 0022 DirectoryEntry m_entry{}; 0023 WIN32_FIND_DATAW m_fileinfo{}; 0024 0025 private: 0026 // Returns the last Win32 error, in string format. Returns an empty string if there is no error. 0027 QString GetLastErrorAsString(DWORD error); 0028 void updateEntry(); 0029 void close(); 0030 0031 const std::wstring m_pathW; 0032 0033 Q_DISABLE_COPY_MOVE(WindowsWalker); // we hold a pointer, disable sharing 0034 };