ScummVM API documentation
abstract-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 BACKENDS_ABSTRACT_FS_H
23 #define BACKENDS_ABSTRACT_FS_H
24 
25 #include "common/array.h"
26 #include "common/str.h"
27 #include "common/fs.h"
28 
29 class AbstractFSNode;
30 
32 
42 protected:
43  friend class Common::FSNode;
45 
63  virtual AbstractFSNode *getChild(const Common::String &name) const = 0;
64 
69  virtual AbstractFSNode *getParent() const = 0;
70 
82  static const char *lastPathComponent(const Common::String &str, const char sep);
83 
84 public:
96  return Common::FSNode(realNode);
97  }
98 
102  virtual ~AbstractFSNode() {}
103 
104  /*
105  * Indicates whether the object referred by this path exists in the filesystem or not.
106  */
107  virtual bool exists() const = 0;
108 
119  virtual bool getChildren(AbstractFSList &list, ListMode mode, bool hidden) const = 0;
120 
126  virtual Common::U32String getDisplayName() const = 0;
127 
137  virtual Common::String getName() const = 0;
138 
142  virtual Common::String getPath() const = 0;
143 
147  virtual bool isDirectory() const = 0;
148 
160  virtual bool isReadable() const = 0;
161 
173  virtual bool isWritable() const = 0;
174 
175 
184 
193  virtual Common::SeekableReadStream *createReadStreamForAltStream(Common::AltStreamType altStreamType);
194 
207  virtual Common::SeekableWriteStream *createWriteStream(bool atomic) = 0;
208 
214  virtual bool createDirectory() = 0;
215 };
216 
217 
218 
219 #endif //BACKENDS_ABSTRACT_FS_H
Definition: str.h:59
virtual Common::U32String getDisplayName() const =0
Definition: array.h:52
virtual AbstractFSNode * getChild(const Common::String &name) const =0
virtual Common::String getName() const =0
static const char * lastPathComponent(const Common::String &str, const char sep)
virtual ~AbstractFSNode()
Definition: abstract-fs.h:102
Definition: stream.h:745
virtual Common::SeekableReadStream * createReadStreamForAltStream(Common::AltStreamType altStreamType)
virtual bool isWritable() const =0
virtual bool isDirectory() const =0
static Common::FSNode makeFSNode(AbstractFSNode *realNode)
Definition: abstract-fs.h:95
Definition: ustr.h:57
ListMode
Definition: fs.h:86
Definition: fs.h:69
virtual bool createDirectory()=0
virtual bool getChildren(AbstractFSList &list, ListMode mode, bool hidden) const =0
virtual Common::SeekableReadStream * createReadStream()=0
virtual bool isReadable() const =0
bool exists() const
Definition: stream.h:351
virtual AbstractFSNode * getParent() const =0
virtual Common::SeekableWriteStream * createWriteStream(bool atomic)=0
Definition: abstract-fs.h:41
virtual Common::String getPath() const =0