aboutsummaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorMax Horn2008-10-02 16:58:59 +0000
committerMax Horn2008-10-02 16:58:59 +0000
commitc7fde102e325b423b1b153a78f7544697c052b72 (patch)
tree051aa4e66c66a20fa52fbb771328df5ea8d4790a /common
parent31be8a6b3f22880378db870600b29906135c8ef5 (diff)
downloadscummvm-rg350-c7fde102e325b423b1b153a78f7544697c052b72.tar.gz
scummvm-rg350-c7fde102e325b423b1b153a78f7544697c052b72.tar.bz2
scummvm-rg350-c7fde102e325b423b1b153a78f7544697c052b72.zip
Renamed FilesystemNode -> FSNode
svn-id: r34716
Diffstat (limited to 'common')
-rw-r--r--common/advancedDetector.cpp6
-rw-r--r--common/archive.cpp22
-rw-r--r--common/archive.h14
-rw-r--r--common/config-manager.cpp2
-rw-r--r--common/file.cpp16
-rw-r--r--common/file.h10
-rw-r--r--common/fs.cpp58
-rw-r--r--common/fs.h35
-rw-r--r--common/md5.cpp10
-rw-r--r--common/md5.h6
-rw-r--r--common/system.cpp4
-rw-r--r--common/unzip.cpp2
12 files changed, 93 insertions, 92 deletions
diff --git a/common/advancedDetector.cpp b/common/advancedDetector.cpp
index b0a8001587..1ec8c47715 100644
--- a/common/advancedDetector.cpp
+++ b/common/advancedDetector.cpp
@@ -246,9 +246,9 @@ PluginError AdvancedMetaEngine::createInstance(OSystem *syst, Engine **engine) c
path = ".";
warning("No path was provided. Assuming the data files are in the current directory");
}
- FilesystemNode dir(path);
+ FSNode dir(path);
FSList files;
- if (!dir.isDirectory() || !dir.getChildren(files, FilesystemNode::kListAll)) {
+ if (!dir.isDirectory() || !dir.getChildren(files, FSNode::kListAll)) {
warning("Game data path does not exist or is not a directory (%s)", path.c_str());
return kNoGameDataFoundError;
}
@@ -290,7 +290,7 @@ PluginError AdvancedMetaEngine::createInstance(OSystem *syst, Engine **engine) c
typedef HashMap<String, bool, IgnoreCase_Hash, IgnoreCase_EqualTo> StringSet;
typedef HashMap<String, int32, IgnoreCase_Hash, IgnoreCase_EqualTo> IntMap;
-typedef HashMap<String, FilesystemNode, IgnoreCase_Hash, IgnoreCase_EqualTo> FileMap;
+typedef HashMap<String, FSNode, IgnoreCase_Hash, IgnoreCase_EqualTo> FileMap;
static void reportUnknown(const StringMap &filesMD5, const IntMap &filesSize) {
// TODO: This message should be cleaned up / made more specific.
diff --git a/common/archive.cpp b/common/archive.cpp
index 11db62cc01..e65a680d37 100644
--- a/common/archive.cpp
+++ b/common/archive.cpp
@@ -54,7 +54,7 @@ int Archive::matchPattern(StringList &list, const String &pattern) {
}
-FSDirectory::FSDirectory(const FilesystemNode &node, int depth)
+FSDirectory::FSDirectory(const FSNode &node, int depth)
: _node(node), _cached(false), _depth(depth) {
}
@@ -65,11 +65,11 @@ FSDirectory::FSDirectory(const String &name, int depth)
FSDirectory::~FSDirectory() {
}
-FilesystemNode FSDirectory::getFSNode() const {
+FSNode FSDirectory::getFSNode() const {
return _node;
}
-FilesystemNode FSDirectory::lookupCache(NodeCache &cache, const String &name) {
+FSNode FSDirectory::lookupCache(NodeCache &cache, const String &name) {
// make caching as lazy as possible
if (!name.empty()) {
if (!_cached) {
@@ -81,7 +81,7 @@ FilesystemNode FSDirectory::lookupCache(NodeCache &cache, const String &name) {
return cache[name];
}
- return FilesystemNode();
+ return FSNode();
}
bool FSDirectory::hasFile(const String &name) {
@@ -89,7 +89,7 @@ bool FSDirectory::hasFile(const String &name) {
return false;
}
- FilesystemNode node = lookupCache(_fileCache, name);
+ FSNode node = lookupCache(_fileCache, name);
return node.exists();
}
@@ -98,13 +98,13 @@ SeekableReadStream *FSDirectory::openFile(const String &name) {
return 0;
}
- FilesystemNode node = lookupCache(_fileCache, name);
+ FSNode node = lookupCache(_fileCache, name);
if (!node.exists()) {
- warning("FSDirectory::openFile: FilesystemNode does not exist");
+ warning("FSDirectory::openFile: FSNode does not exist");
return 0;
} else if (node.isDirectory()) {
- warning("FSDirectory::openFile: FilesystemNode is a directory");
+ warning("FSDirectory::openFile: FSNode is a directory");
return 0;
}
@@ -121,17 +121,17 @@ FSDirectory *FSDirectory::getSubDirectory(const String &name) {
return 0;
}
- FilesystemNode node = lookupCache(_subDirCache, name);
+ FSNode node = lookupCache(_subDirCache, name);
return new FSDirectory(node);
}
-void FSDirectory::cacheDirectoryRecursive(FilesystemNode node, int depth, const String& prefix) {
+void FSDirectory::cacheDirectoryRecursive(FSNode node, int depth, const String& prefix) {
if (depth <= 0) {
return;
}
FSList list;
- node.getChildren(list, FilesystemNode::kListAll, false);
+ node.getChildren(list, FSNode::kListAll, false);
FSList::iterator it = list.begin();
for ( ; it != list.end(); it++) {
diff --git a/common/archive.h b/common/archive.h
index b2a2550094..9103586d7d 100644
--- a/common/archive.h
+++ b/common/archive.h
@@ -93,21 +93,21 @@ typedef SharedPtr<Archive> ArchivePtr;
* Searching is case-insensitive, as the main intended goal is supporting
* retrieval of game data. First case-insensitive match is returned when
* searching, thus making FSDirectory heavily dependant on the underlying
- * FilesystemNode implementation.
+ * FSNode implementation.
*/
class FSDirectory : public Archive {
- FilesystemNode _node;
+ FSNode _node;
// Caches are case insensitive, clashes are dealt with when creating
// Key is stored in lowercase.
- typedef HashMap<String, FilesystemNode, IgnoreCase_Hash, IgnoreCase_EqualTo> NodeCache;
+ typedef HashMap<String, FSNode, IgnoreCase_Hash, IgnoreCase_EqualTo> NodeCache;
NodeCache _fileCache, _subDirCache;
// look for a match
- FilesystemNode lookupCache(NodeCache &cache, const String &name);
+ FSNode lookupCache(NodeCache &cache, const String &name);
// cache management
- void cacheDirectoryRecursive(FilesystemNode node, int depth, const String& prefix);
+ void cacheDirectoryRecursive(FSNode node, int depth, const String& prefix);
bool _cached;
int _depth;
@@ -122,14 +122,14 @@ public:
* Create a FSDirectory representing a tree with the specified depth. Will result in an
* unbound FSDirectory if node does not exist or is not a directory.
*/
- FSDirectory(const FilesystemNode &node, int depth = 1);
+ FSDirectory(const FSNode &node, int depth = 1);
virtual ~FSDirectory();
/**
* This return the underlying FSNode of the FSDirectory.
*/
- FilesystemNode getFSNode() const;
+ FSNode getFSNode() const;
/**
* Create a new FSDirectory pointing to a sub directory of the instance.
diff --git a/common/config-manager.cpp b/common/config-manager.cpp
index f157763926..0d01c39c4f 100644
--- a/common/config-manager.cpp
+++ b/common/config-manager.cpp
@@ -77,7 +77,7 @@ void ConfigManager::loadDefaultConfigFile() {
void ConfigManager::loadConfigFile(const String &filename) {
_filename = filename;
- FilesystemNode node(filename);
+ FSNode node(filename);
File cfg_file;
if (!cfg_file.open(node)) {
printf("Creating configuration file: %s\n", filename.c_str());
diff --git a/common/file.cpp b/common/file.cpp
index ec605d45c1..ed432ce565 100644
--- a/common/file.cpp
+++ b/common/file.cpp
@@ -32,20 +32,20 @@
namespace Common {
void File::addDefaultDirectory(const String &directory) {
- FilesystemNode dir(directory);
+ FSNode dir(directory);
addDefaultDirectoryRecursive(dir, 1);
}
void File::addDefaultDirectoryRecursive(const String &directory, int level) {
- FilesystemNode dir(directory);
+ FSNode dir(directory);
addDefaultDirectoryRecursive(dir, level);
}
-void File::addDefaultDirectory(const FilesystemNode &directory) {
+void File::addDefaultDirectory(const FSNode &directory) {
addDefaultDirectoryRecursive(directory, 1);
}
-void File::addDefaultDirectoryRecursive(const FilesystemNode &dir, int level) {
+void File::addDefaultDirectoryRecursive(const FSNode &dir, int level) {
if (level <= 0 || !dir.exists() || !dir.isDirectory())
return;
@@ -89,7 +89,7 @@ bool File::open(const String &filename, Archive &archive) {
return open(stream, filename);
}
-bool File::open(const FilesystemNode &node) {
+bool File::open(const FSNode &node) {
assert(!_handle);
if (!node.exists()) {
@@ -196,15 +196,15 @@ bool DumpFile::open(const String &filename) {
assert(!filename.empty());
assert(!_handle);
- FilesystemNode node(filename);
+ FSNode node(filename);
return open(node);
}
-bool DumpFile::open(const FilesystemNode &node) {
+bool DumpFile::open(const FSNode &node) {
assert(!_handle);
if (node.isDirectory()) {
- warning("DumpFile::open: FilesystemNode is a directory");
+ warning("DumpFile::open: FSNode is a directory");
return false;
}
diff --git a/common/file.h b/common/file.h
index 079b0bba84..0634aecdd3 100644
--- a/common/file.h
+++ b/common/file.h
@@ -34,7 +34,7 @@
namespace Common {
-class FilesystemNode;
+class FSNode;
/**
* TODO: vital to document this core class properly!!! For both users and implementors
@@ -52,8 +52,8 @@ public:
static void addDefaultDirectory(const String &directory);
static void addDefaultDirectoryRecursive(const String &directory, int level = 4);
- static void addDefaultDirectory(const FilesystemNode &directory);
- static void addDefaultDirectoryRecursive(const FilesystemNode &directory, int level = 4);
+ static void addDefaultDirectory(const FSNode &directory);
+ static void addDefaultDirectoryRecursive(const FSNode &directory, int level = 4);
static void resetDefaultDirectories();
@@ -100,7 +100,7 @@ public:
* @param archive the archive in which to search for the file
* @return true if file was opened successfully, false otherwise
*/
- virtual bool open(const FilesystemNode &node);
+ virtual bool open(const FSNode &node);
/**
* Try to 'open' the given stream. That is, we just wrap around it, and if stream
@@ -161,7 +161,7 @@ public:
virtual ~DumpFile();
virtual bool open(const String &filename);
- virtual bool open(const FilesystemNode &node);
+ virtual bool open(const FSNode &node);
virtual void close();
diff --git a/common/fs.cpp b/common/fs.cpp
index 4d31ac09fa..c1ef26e42d 100644
--- a/common/fs.cpp
+++ b/common/fs.cpp
@@ -29,48 +29,48 @@
namespace Common {
-FilesystemNode::FilesystemNode() {
+FSNode::FSNode() {
}
-FilesystemNode::FilesystemNode(AbstractFilesystemNode *realNode)
+FSNode::FSNode(AbstractFSNode *realNode)
: _realNode(realNode) {
}
-FilesystemNode::FilesystemNode(const Common::String &p) {
+FSNode::FSNode(const Common::String &p) {
FilesystemFactory *factory = g_system->getFilesystemFactory();
- AbstractFilesystemNode *tmp = 0;
+ AbstractFSNode *tmp = 0;
if (p.empty() || p == ".")
tmp = factory->makeCurrentDirectoryFileNode();
else
tmp = factory->makeFileNodePath(p);
- _realNode = Common::SharedPtr<AbstractFilesystemNode>(tmp);
+ _realNode = Common::SharedPtr<AbstractFSNode>(tmp);
}
-bool FilesystemNode::operator<(const FilesystemNode& node) const {
+bool FSNode::operator<(const FSNode& node) const {
if (isDirectory() != node.isDirectory())
return isDirectory();
return getDisplayName().compareToIgnoreCase(node.getDisplayName()) < 0;
}
-bool FilesystemNode::exists() const {
+bool FSNode::exists() const {
if (_realNode == 0)
return false;
return _realNode->exists();
}
-FilesystemNode FilesystemNode::getChild(const Common::String &n) const {
+FSNode FSNode::getChild(const Common::String &n) const {
// If this node is invalid or not a directory, return an invalid node
if (_realNode == 0 || !_realNode->isDirectory())
- return FilesystemNode();
+ return FSNode();
- AbstractFilesystemNode *node = _realNode->getChild(n);
- return FilesystemNode(node);
+ AbstractFSNode *node = _realNode->getChild(n);
+ return FSNode(node);
}
-bool FilesystemNode::getChildren(FSList &fslist, ListMode mode, bool hidden) const {
+bool FSNode::getChildren(FSList &fslist, ListMode mode, bool hidden) const {
if (!_realNode || !_realNode->isDirectory())
return false;
@@ -81,61 +81,61 @@ bool FilesystemNode::getChildren(FSList &fslist, ListMode mode, bool hidden) con
fslist.clear();
for (AbstractFSList::iterator i = tmp.begin(); i != tmp.end(); ++i) {
- fslist.push_back(FilesystemNode(*i));
+ fslist.push_back(FSNode(*i));
}
return true;
}
-Common::String FilesystemNode::getDisplayName() const {
+Common::String FSNode::getDisplayName() const {
assert(_realNode);
return _realNode->getDisplayName();
}
-Common::String FilesystemNode::getName() const {
+Common::String FSNode::getName() const {
assert(_realNode);
return _realNode->getName();
}
-FilesystemNode FilesystemNode::getParent() const {
+FSNode FSNode::getParent() const {
if (_realNode == 0)
return *this;
- AbstractFilesystemNode *node = _realNode->getParent();
+ AbstractFSNode *node = _realNode->getParent();
if (node == 0) {
return *this;
} else {
- return FilesystemNode(node);
+ return FSNode(node);
}
}
-Common::String FilesystemNode::getPath() const {
+Common::String FSNode::getPath() const {
assert(_realNode);
return _realNode->getPath();
}
-bool FilesystemNode::isDirectory() const {
+bool FSNode::isDirectory() const {
if (_realNode == 0)
return false;
return _realNode->isDirectory();
}
-bool FilesystemNode::isReadable() const {
+bool FSNode::isReadable() const {
if (_realNode == 0)
return false;
return _realNode->isReadable();
}
-bool FilesystemNode::isWritable() const {
+bool FSNode::isWritable() const {
if (_realNode == 0)
return false;
return _realNode->isWritable();
}
-bool FilesystemNode::lookupFile(FSList &results, const Common::String &p, bool hidden, bool exhaustive, int depth) const {
+bool FSNode::lookupFile(FSList &results, const Common::String &p, bool hidden, bool exhaustive, int depth) const {
if (!isDirectory())
return false;
@@ -146,7 +146,7 @@ bool FilesystemNode::lookupFile(FSList &results, const Common::String &p, bool h
pattern.toUppercase();
// First match all files on this level
- getChildren(children, FilesystemNode::kListAll, hidden);
+ getChildren(children, FSNode::kListAll, hidden);
for (FSList::iterator entry = children.begin(); entry != children.end(); ++entry) {
if (entry->isDirectory()) {
if (depth != 0)
@@ -173,27 +173,27 @@ bool FilesystemNode::lookupFile(FSList &results, const Common::String &p, bool h
return !results.empty();
}
-Common::SeekableReadStream *FilesystemNode::openForReading() const {
+Common::SeekableReadStream *FSNode::openForReading() const {
if (_realNode == 0)
return 0;
if (!_realNode->exists()) {
- warning("FilesystemNode::openForReading: FilesystemNode does not exist");
+ warning("FSNode::openForReading: FSNode does not exist");
return false;
} else if (_realNode->isDirectory()) {
- warning("FilesystemNode::openForReading: FilesystemNode is a directory");
+ warning("FSNode::openForReading: FSNode is a directory");
return false;
}
return _realNode->openForReading();
}
-Common::WriteStream *FilesystemNode::openForWriting() const {
+Common::WriteStream *FSNode::openForWriting() const {
if (_realNode == 0)
return 0;
if (_realNode->isDirectory()) {
- warning("FilesystemNode::openForWriting: FilesystemNode is a directory");
+ warning("FSNode::openForWriting: FSNode is a directory");
return 0;
}
diff --git a/common/fs.h b/common/fs.h
index c5f7ca6b4c..e2db955c87 100644
--- a/common/fs.h
+++ b/common/fs.h
@@ -29,11 +29,11 @@
#include "common/ptr.h"
#include "common/str.h"
-class AbstractFilesystemNode;
+class AbstractFSNode;
namespace Common {
-class FilesystemNode;
+class FSNode;
class SeekableReadStream;
class WriteStream;
@@ -42,21 +42,22 @@ class WriteStream;
* This is subclass instead of just a typedef so that we can use forward
* declarations of it in other places.
*/
-class FSList : public Common::Array<FilesystemNode> {};
+class FSList : public Common::Array<FSNode> {};
/**
- * FilesystemNode provides an abstraction for file paths, allowing for portable
- * file system browsing. To this ends, multiple or single roots have to be supported
- * (compare Unix with a single root, Windows with multiple roots C:, D:, ...).
+ * FSNode, short for "File System Node", provides an abstraction for file
+ * paths, allowing for portable file system browsing. This means for example,
+ * that multiple or single roots have to be supported (compare Unix with a
+ * single root, Windows with multiple roots C:, D:, ...).
*
* To this end, we abstract away from paths; implementations can be based on
* paths (and it's left to them whether / or \ or : is the path separator :-);
* but it is also possible to use inodes or vrefs (MacOS 9) or anything else.
*/
-class FilesystemNode {
+class FSNode {
private:
- Common::SharedPtr<AbstractFilesystemNode> _realNode;
- FilesystemNode(AbstractFilesystemNode *realNode);
+ Common::SharedPtr<AbstractFSNode> _realNode;
+ FSNode(AbstractFSNode *realNode);
public:
/**
@@ -69,14 +70,14 @@ public:
};
/**
- * Create a new pathless FilesystemNode. Since there's no path associated
+ * Create a new pathless FSNode. Since there's no path associated
* with this node, path-related operations (i.e. exists(), isDirectory(),
* getPath()) will always return false or raise an assertion.
*/
- FilesystemNode();
+ FSNode();
/**
- * Create a new FilesystemNode referring to the specified path. This is
+ * Create a new FSNode referring to the specified path. This is
* the counterpart to the path() method.
*
* If path is empty or equals ".", then a node representing the "current
@@ -84,15 +85,15 @@ public:
* operating system doesn't support the concept), some other directory is
* used (usually the root directory).
*/
- explicit FilesystemNode(const Common::String &path);
+ explicit FSNode(const Common::String &path);
- virtual ~FilesystemNode() {}
+ virtual ~FSNode() {}
/**
* Compare the name of this node to the name of another. Directories
* go before normal files.
*/
- bool operator<(const FilesystemNode& node) const;
+ bool operator<(const FSNode& node) const;
/**
* Indicates whether the object referred by this node exists in the filesystem or not.
@@ -118,7 +119,7 @@ public:
* @param name the name of a child of this directory
* @return the node referring to the child with the given name
*/
- FilesystemNode getChild(const Common::String &name) const;
+ FSNode getChild(const Common::String &name) const;
/**
* Return a list of all child nodes of this directory node. If called on a node
@@ -165,7 +166,7 @@ public:
* Get the parent node of this node. If this node has no parent node,
* then it returns a duplicate of this node.
*/
- FilesystemNode getParent() const;
+ FSNode getParent() const;
/**
* Indicates whether the node refers to a directory or not.
diff --git a/common/md5.cpp b/common/md5.cpp
index 4eeb3d9a39..107990481f 100644
--- a/common/md5.cpp
+++ b/common/md5.cpp
@@ -246,15 +246,15 @@ void md5_finish(md5_context *ctx, uint8 digest[16]) {
PUT_UINT32(ctx->state[3], digest, 12);
}
-bool md5_file(const FilesystemNode &file, uint8 digest[16], uint32 length) {
+bool md5_file(const FSNode &file, uint8 digest[16], uint32 length) {
if (!file.exists()) {
- warning("md5_file: using an inexistent FilesystemNode");
+ warning("md5_file: using an inexistent FSNode");
return false;
} else if (!file.isReadable()) {
- warning("md5_file: using an unreadable FilesystemNode");
+ warning("md5_file: using an unreadable FSNode");
return false;
} else if (file.isDirectory()) {
- warning("md5_file: using a directory FilesystemNode");
+ warning("md5_file: using a directory FSNode");
return false;
}
@@ -316,7 +316,7 @@ bool md5_file(ReadStream &stream, uint8 digest[16], uint32 length) {
return true;
}
-bool md5_file_string(const FilesystemNode &file, char *md5str, uint32 length) {
+bool md5_file_string(const FSNode &file, char *md5str, uint32 length) {
uint8 digest[16];
if (!md5_file(file, digest, length))
return false;
diff --git a/common/md5.h b/common/md5.h
index a8642b1322..ffed7d7524 100644
--- a/common/md5.h
+++ b/common/md5.h
@@ -29,11 +29,11 @@
namespace Common {
-class FilesystemNode;
+class FSNode;
class ReadStream;
bool md5_file(const char *name, uint8 digest[16], uint32 length = 0);
-bool md5_file(const FilesystemNode &file, uint8 digest[16], uint32 length = 0);
+bool md5_file(const FSNode &file, uint8 digest[16], uint32 length = 0);
bool md5_file(ReadStream &stream, uint8 digest[16], uint32 length = 0);
// The following two methods work similar to the above two, but
@@ -41,7 +41,7 @@ bool md5_file(ReadStream &stream, uint8 digest[16], uint32 length = 0);
// a human readable lowercase hexstring representing the digest.
// The md5str parameter must point to a buffer of 32+1 chars.
bool md5_file_string(const char *name, char *md5str, uint32 length = 0);
-bool md5_file_string(const FilesystemNode &file, char *md5str, uint32 length = 0);
+bool md5_file_string(const FSNode &file, char *md5str, uint32 length = 0);
bool md5_file_string(ReadStream &stream, char *md5str, uint32 length = 0);
diff --git a/common/system.cpp b/common/system.cpp
index d9bc027e91..0e29dded38 100644
--- a/common/system.cpp
+++ b/common/system.cpp
@@ -163,7 +163,7 @@ static Common::String getDefaultConfigFileName() {
}
Common::SeekableReadStream *OSystem::openConfigFileForReading() {
- Common::FilesystemNode file(getDefaultConfigFileName());
+ Common::FSNode file(getDefaultConfigFileName());
return file.openForReading();
}
@@ -171,7 +171,7 @@ Common::WriteStream *OSystem::openConfigFileForWriting() {
#ifdef __DC__
return 0;
#else
- Common::FilesystemNode file(getDefaultConfigFileName());
+ Common::FSNode file(getDefaultConfigFileName());
return file.openForWriting();
#endif
}
diff --git a/common/unzip.cpp b/common/unzip.cpp
index 24744203da..894631b262 100644
--- a/common/unzip.cpp
+++ b/common/unzip.cpp
@@ -1363,7 +1363,7 @@ class ZipArchiveMember : public ArchiveMember {
unzFile _zipFile;
public:
- ZipArchiveMember(FilesystemNode &node) : _node(node) {
+ ZipArchiveMember(FSNode &node) : _node(node) {
}
String getName() const {