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
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 2
10  * of the License, or (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, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20  *
21  */
22 
23 #ifndef N64_FILESYSTEM_H
24 #define N64_FILESYSTEM_H
25 
26 #include "backends/fs/abstract-fs.h"
27 
28 /**
29  * Implementation of the ScummVM file system API based on N64 Hkz romfs.
30  *
31  * Parts of this class are documented in the base interface class, AbstractFSNode.
32  */
33 class N64FilesystemNode : public AbstractFSNode {
34 protected:
35 	Common::String _displayName;
36 	Common::String _path;
37 	bool _isDirectory;
38 	bool _isValid;
39 
40 public:
41 	/**
42 	 * Creates a N64FilesystemNode with the root node as path.
43 	 */
44 	N64FilesystemNode();
45 
46 	/**
47 	 * Creates a N64FilesystemNode for a given path.
48 	 *
49 	 * @param path Common::String with the path the new node should point to.
50 	 * @param verify true if the isValid and isDirectory flags should be verified during the construction.
51 	 */
52 	N64FilesystemNode(const Common::String &p, bool verify = true);
53 
54 	virtual bool exists() const;
getDisplayName()55 	virtual Common::String getDisplayName() const {
56 		return _displayName;
57 	}
getName()58 	virtual Common::String getName() const {
59 		return _displayName;
60 	}
getPath()61 	virtual Common::String getPath() const {
62 		return _path;
63 	}
isDirectory()64 	virtual bool isDirectory() const {
65 		return _isDirectory;
66 	}
67 	virtual bool isReadable() const;
68 	virtual bool isWritable() const;
69 
70 	virtual AbstractFSNode *getChild(const Common::String &n) const;
71 	virtual bool getChildren(AbstractFSList &list, ListMode mode, bool hidden) const;
72 	virtual AbstractFSNode *getParent() const;
73 
74 	virtual Common::SeekableReadStream *createReadStream();
75 	virtual Common::WriteStream *createWriteStream();
76 	virtual bool createDirectory();
77 };
78 
79 #endif
80