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
27class StdioStream;
28
34protected:
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
42public:
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
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
74protected:
75 const Config &_config;
76
77private:
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: abstract-fs.h:41
Definition: array.h:52
ListMode
Definition: fs.h:86
Definition: stream.h:745
Definition: stream.h:351
Definition: str.h:59
Definition: posix-drives-fs.h:33
bool getChildren(AbstractFSList &list, ListMode mode, bool hidden) const override
BufferingMode
Definition: posix-drives-fs.h:43
@ kBufferingModeDisabled
Definition: posix-drives-fs.h:45
@ kBufferingModeStdio
Definition: posix-drives-fs.h:47
@ kBufferingModeScummVM
Definition: posix-drives-fs.h:49
AbstractFSNode * getChild(const Common::String &n) const override
Common::SeekableWriteStream * createWriteStream(bool atomic) override
AbstractFSNode * getParent() const override
Common::SeekableReadStream * createReadStream() override
Definition: posix-fs.h:32
Definition: stdiostream.h:30
Definition: posix-drives-fs.h:52