ScummVM API documentation
windows-fs.h
1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 #ifndef WINDOWS_FILESYSTEM_H
23 #define WINDOWS_FILESYSTEM_H
24 
25 #include <windows.h>
26 
27 #include "backends/fs/abstract-fs.h"
28 
29 #include <io.h>
30 #include <stdio.h>
31 #include <stdlib.h>
32 #include <tchar.h>
33 
39 class WindowsFilesystemNode final : public AbstractFSNode {
40 protected:
41  Common::String _displayName;
42  Common::String _path;
43  bool _isDirectory;
44  bool _isPseudoRoot;
45  bool _isValid;
46 
47 public:
54 
66  WindowsFilesystemNode(const Common::String &path, const bool currentDir);
67 
68  bool exists() const override;
69  Common::U32String getDisplayName() const override { return _displayName; }
70  Common::String getName() const override { return _displayName; }
71  Common::String getPath() const override { return _path; }
72  bool isDirectory() const override { return _isDirectory; }
73  bool isReadable() const override;
74  bool isWritable() const override;
75 
76  AbstractFSNode *getChild(const Common::String &n) const override;
77  bool getChildren(AbstractFSList &list, ListMode mode, bool hidden) const override;
78  AbstractFSNode *getParent() const override;
79 
81  Common::SeekableWriteStream *createWriteStream(bool atomic) override;
82  bool createDirectory() override;
83 
84 private:
95  static void addFile(AbstractFSList &list, ListMode mode, const char *base, bool hidden, WIN32_FIND_DATA* find_data);
96 
106  static const char *tcharToChar(const TCHAR *str);
107 
117  static const TCHAR* charToTchar(const char *str);
118 
122  virtual void setFlags();
123 };
124 
125 #endif
Definition: str.h:59
Definition: array.h:52
bool isDirectory() const override
Definition: windows-fs.h:72
Definition: stream.h:745
bool createDirectory() override
Common::String getName() const override
Definition: windows-fs.h:70
Definition: ustr.h:57
bool isReadable() const override
ListMode
Definition: fs.h:86
AbstractFSNode * getParent() const override
AbstractFSNode * getChild(const Common::String &n) const override
bool getChildren(AbstractFSList &list, ListMode mode, bool hidden) const override
Definition: stream.h:351
bool isWritable() const override
Common::String getPath() const override
Definition: windows-fs.h:71
Common::U32String getDisplayName() const override
Definition: windows-fs.h:69
Common::SeekableWriteStream * createWriteStream(bool atomic) override
Common::SeekableReadStream * createReadStream() override
Definition: abstract-fs.h:41
Definition: windows-fs.h:39