ScummVM API documentation
posix-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 POSIX_FILESYSTEM_H
23 #define POSIX_FILESYSTEM_H
24 
25 #include "backends/fs/abstract-fs.h"
26 
33 protected:
34  Common::String _displayName;
35  Common::String _path;
36  bool _isDirectory;
37  bool _isValid;
38 
39  virtual AbstractFSNode *makeNode(const Common::String &path) const {
40  return new POSIXFilesystemNode(path);
41  }
42 
46  POSIXFilesystemNode() : _isDirectory(false), _isValid(false) {}
47 
48 public:
55 
56  bool exists() const override;
57  Common::U32String getDisplayName() const override { return _displayName; }
58  Common::String getName() const override { return _displayName; }
59  Common::String getPath() const override { return _path; }
60  bool isDirectory() const override { return _isDirectory; }
61  bool isReadable() const override;
62  bool isWritable() const override;
63 
64  AbstractFSNode *getChild(const Common::String &n) const override;
65  bool getChildren(AbstractFSList &list, ListMode mode, bool hidden) const override;
66  AbstractFSNode *getParent() const override;
67 
69  Common::SeekableReadStream *createReadStreamForAltStream(Common::AltStreamType altStreamType) override;
70  Common::SeekableWriteStream *createWriteStream(bool atomic) override;
71  bool createDirectory() override;
72 
73 protected:
77  virtual void setFlags();
78 };
79 
80 namespace Posix {
81 
90 bool assureDirectoryExists(const Common::String &dir, const char *prefix = nullptr);
91 
92 } // End of namespace Posix
93 
94 #endif
Common::String getName() const override
Definition: posix-fs.h:58
Definition: str.h:59
Common::String getPath() const override
Definition: posix-fs.h:59
bool getChildren(AbstractFSList &list, ListMode mode, bool hidden) const override
Definition: array.h:52
virtual void setFlags()
Common::SeekableReadStream * createReadStream() override
Definition: posix-fs.h:80
bool isWritable() const override
Common::SeekableWriteStream * createWriteStream(bool atomic) override
Definition: stream.h:745
bool isDirectory() const override
Definition: posix-fs.h:60
AbstractFSNode * getChild(const Common::String &n) const override
Definition: ustr.h:57
ListMode
Definition: fs.h:86
AbstractFSNode * getParent() const override
bool createDirectory() override
POSIXFilesystemNode()
Definition: posix-fs.h:46
Definition: stream.h:351
Common::SeekableReadStream * createReadStreamForAltStream(Common::AltStreamType altStreamType) override
Common::U32String getDisplayName() const override
Definition: posix-fs.h:57
bool isReadable() const override
Definition: abstract-fs.h:41
Definition: posix-fs.h:32