ScummVM API documentation
posix-drives-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_DRIVES_FILESYSTEM_H
23 #define POSIX_DRIVES_FILESYSTEM_H
24 
25 #include "backends/fs/posix/posix-fs.h"
26 
27 class StdioStream;
28 
34 protected:
35  virtual AbstractFSNode *makeNode() const {
36  return new DrivePOSIXFilesystemNode(_config);
37  }
38  AbstractFSNode *makeNode(const Common::String &path) const override {
39  return new DrivePOSIXFilesystemNode(path, _config);
40  }
41 
42 public:
50  };
51 
52  struct Config {
53  // Use the default stdio buffer size
54  Config() : bufferingMode(kBufferingModeStdio), bufferSize(0) { }
55  virtual ~Config() { }
56 
57  virtual bool getDrives(AbstractFSList &list, bool hidden) const = 0;
58  virtual bool isDrive(const Common::String &path) const = 0;
59 
60  BufferingMode bufferingMode;
61  uint32 bufferSize;
62  };
63 
64  DrivePOSIXFilesystemNode(const Common::String &path, const Config &config);
65  DrivePOSIXFilesystemNode(const Config &config);
66 
67  // AbstractFSNode API
69  Common::SeekableWriteStream *createWriteStream(bool atomic) override;
70  AbstractFSNode *getChild(const Common::String &n) const override;
71  bool getChildren(AbstractFSList &list, ListMode mode, bool hidden) const override;
72  AbstractFSNode *getParent() const override;
73 
74 protected:
75  const Config &_config;
76 
77 private:
78  bool _isPseudoRoot;
79 
80  DrivePOSIXFilesystemNode *getChildWithKnownType(const Common::String &n, bool isDirectoryFlag) const;
81  bool isDrive(const Common::String &path) const;
82  void configureStream(StdioStream *stream);
83 };
84 
85 #endif
Definition: posix-drives-fs.h:49
Definition: str.h:59
AbstractFSNode * getChild(const Common::String &n) const override
Definition: array.h:52
Common::SeekableReadStream * createReadStream() override
Definition: stream.h:745
Definition: posix-drives-fs.h:45
Common::SeekableWriteStream * createWriteStream(bool atomic) override
AbstractFSNode * getParent() const override
ListMode
Definition: fs.h:86
bool getChildren(AbstractFSList &list, ListMode mode, bool hidden) const override
Definition: posix-drives-fs.h:47
Definition: stdiostream.h:30
Definition: posix-drives-fs.h:33
Definition: posix-drives-fs.h:52
Definition: stream.h:351
BufferingMode
Definition: posix-drives-fs.h:43
Definition: abstract-fs.h:41
Definition: posix-fs.h:32