diff options
author | Max Horn | 2006-05-03 10:19:05 +0000 |
---|---|---|
committer | Max Horn | 2006-05-03 10:19:05 +0000 |
commit | 8c452daac26b7e2bd38d7ed6e895376c8982ab95 (patch) | |
tree | cba1a2273b9118842200cef788ec05e041e63b20 /backends/fs | |
parent | d404b6150af5d7cf716b52dfe274acca81f6ffad (diff) | |
download | scummvm-rg350-8c452daac26b7e2bd38d7ed6e895376c8982ab95.tar.gz scummvm-rg350-8c452daac26b7e2bd38d7ed6e895376c8982ab95.tar.bz2 scummvm-rg350-8c452daac26b7e2bd38d7ed6e895376c8982ab95.zip |
Moved static methods getRoot / getNodeForPath from class FilesystemNode to class AbstractFilesystemNode
svn-id: r22298
Diffstat (limited to 'backends/fs')
-rw-r--r-- | backends/fs/abstract-fs.h | 23 | ||||
-rw-r--r-- | backends/fs/amigaos4/amigaos4-fs.cpp | 4 | ||||
-rw-r--r-- | backends/fs/fs.cpp | 4 | ||||
-rw-r--r-- | backends/fs/fs.h | 23 | ||||
-rw-r--r-- | backends/fs/morphos/abox-fs.cpp | 2 | ||||
-rw-r--r-- | backends/fs/palmos/palmos-fs.cpp | 4 | ||||
-rw-r--r-- | backends/fs/posix/posix-fs.cpp | 4 | ||||
-rw-r--r-- | backends/fs/ps2/ps2-fs.cpp | 4 | ||||
-rw-r--r-- | backends/fs/symbian/symbian-fs.cpp | 4 | ||||
-rw-r--r-- | backends/fs/windows/windows-fs.cpp | 4 |
10 files changed, 38 insertions, 38 deletions
diff --git a/backends/fs/abstract-fs.h b/backends/fs/abstract-fs.h index 3d17590782..0cfd89e875 100644 --- a/backends/fs/abstract-fs.h +++ b/backends/fs/abstract-fs.h @@ -59,6 +59,29 @@ protected: */ static FilesystemNode wrap(AbstractFilesystemNode *node); + /** + * Returns a special node representing the FS root. The starting point for + * any file system browsing. + * On Unix, this will be simply the node for / (the root directory). + * On Windows, it will be a special node which "contains" all drives (C:, D:, E:). + */ + static AbstractFilesystemNode *getRoot(); + + /** + * Construct a node based on a path; the path is in the same format as it + * would be for calls to fopen(). + * + * I.e. getNodeForPath(oldNode.path()) should create a new node identical to oldNode. + * + * @TODO: This is of course a place where non-portable code easily will sneak + * in, because the format of the path used here is not well-defined. + * So we really should reconsider this API and try to come up with + * something which is more portable but still flexible enough for our + * purposes. + */ + static AbstractFilesystemNode *getNodeForPath(const String &path); + + public: virtual ~AbstractFilesystemNode() {} diff --git a/backends/fs/amigaos4/amigaos4-fs.cpp b/backends/fs/amigaos4/amigaos4-fs.cpp index 77e96ea52b..4875b74e28 100644 --- a/backends/fs/amigaos4/amigaos4-fs.cpp +++ b/backends/fs/amigaos4/amigaos4-fs.cpp @@ -75,11 +75,11 @@ class AmigaOSFilesystemNode : public AbstractFilesystemNode { virtual AbstractFilesystemNode *child(const String &name) const; }; -AbstractFilesystemNode *FilesystemNode::getRoot() { +AbstractFilesystemNode *AbstractFilesystemNode::getRoot() { return new AmigaOSFilesystemNode(); } -AbstractFilesystemNode *FilesystemNode::getNodeForPath(const String &path) { +AbstractFilesystemNode *AbstractFilesystemNode::getNodeForPath(const String &path) { return new AmigaOSFilesystemNode(path); } diff --git a/backends/fs/fs.cpp b/backends/fs/fs.cpp index a8c38786fc..a081a0af4f 100644 --- a/backends/fs/fs.cpp +++ b/backends/fs/fs.cpp @@ -41,7 +41,7 @@ FilesystemNode::FilesystemNode(AbstractFilesystemNode *realNode) { FilesystemNode::FilesystemNode() { if (_rootNode == 0) { - _rootNode = getRoot(); + _rootNode = AbstractFilesystemNode::getRoot(); _rootRefCount = new int(1); } _realNode = _rootNode; @@ -56,7 +56,7 @@ FilesystemNode::FilesystemNode(const FilesystemNode &node) { } FilesystemNode::FilesystemNode(const Common::String &p) { - _realNode = getNodeForPath(p); + _realNode = AbstractFilesystemNode::getNodeForPath(p); _refCount = new int(1); } diff --git a/backends/fs/fs.h b/backends/fs/fs.h index a2156463d8..a9883accd3 100644 --- a/backends/fs/fs.h +++ b/backends/fs/fs.h @@ -77,29 +77,6 @@ private: FilesystemNode(AbstractFilesystemNode *realNode); - /** - * Returns a special node representing the FS root. The starting point for - * any file system browsing. - * On Unix, this will be simply the node for / (the root directory). - * On Windows, it will be a special node which "contains" all drives (C:, D:, E:). - */ - static AbstractFilesystemNode *getRoot(); - - /** - * Construct a node based on a path; the path is in the same format as it - * would be for calls to fopen(). - * - * I.e. getNodeForPath(oldNode.path()) should create a new node identical to oldNode. - * - * @TODO: This is of course a place where non-portable code easily will sneak - * in, because the format of the path used here is not well-defined. - * So we really should reconsider this API and try to come up with - * something which is more portable but still flexible enough for our - * purposes. - */ - static AbstractFilesystemNode *getNodeForPath(const String &path); - - public: /** * Flag to tell listDir() which kind of files to list. diff --git a/backends/fs/morphos/abox-fs.cpp b/backends/fs/morphos/abox-fs.cpp index d8eada1868..bf7deb826b 100644 --- a/backends/fs/morphos/abox-fs.cpp +++ b/backends/fs/morphos/abox-fs.cpp @@ -58,7 +58,7 @@ class ABoxFilesystemNode : public AbstractFilesystemNode { }; -AbstractFilesystemNode *FilesystemNode::getRoot() +AbstractFilesystemNode *AbstractFilesystemNode::getRoot() { return new ABoxFilesystemNode(); } diff --git a/backends/fs/palmos/palmos-fs.cpp b/backends/fs/palmos/palmos-fs.cpp index c9afbeeb21..bebf20ec59 100644 --- a/backends/fs/palmos/palmos-fs.cpp +++ b/backends/fs/palmos/palmos-fs.cpp @@ -78,11 +78,11 @@ void PalmOSFilesystemNode::addFile(FSList &list, ListMode mode, const char *base list.push_back(wrap(new PalmOSFilesystemNode(entry))); } -AbstractFilesystemNode *FilesystemNode::getRoot() { +AbstractFilesystemNode *AbstractFilesystemNode::getRoot() { return new PalmOSFilesystemNode(); } -AbstractFilesystemNode *FilesystemNode::getNodeForPath(const String &path) { +AbstractFilesystemNode *AbstractFilesystemNode::getNodeForPath(const String &path) { return new PalmOSFilesystemNode(path); } diff --git a/backends/fs/posix/posix-fs.cpp b/backends/fs/posix/posix-fs.cpp index 6681a7fdf4..43cf964d3d 100644 --- a/backends/fs/posix/posix-fs.cpp +++ b/backends/fs/posix/posix-fs.cpp @@ -74,11 +74,11 @@ static const char *lastPathComponent(const Common::String &str) { return cur + 1; } -AbstractFilesystemNode *FilesystemNode::getRoot() { +AbstractFilesystemNode *AbstractFilesystemNode::getRoot() { return new POSIXFilesystemNode(); } -AbstractFilesystemNode *FilesystemNode::getNodeForPath(const String &path) { +AbstractFilesystemNode *AbstractFilesystemNode::getNodeForPath(const String &path) { return new POSIXFilesystemNode(path, true); } diff --git a/backends/fs/ps2/ps2-fs.cpp b/backends/fs/ps2/ps2-fs.cpp index b749f59796..6a18a8ef02 100644 --- a/backends/fs/ps2/ps2-fs.cpp +++ b/backends/fs/ps2/ps2-fs.cpp @@ -52,11 +52,11 @@ public: virtual AbstractFilesystemNode *clone() const { return new Ps2FilesystemNode(this); } }; -AbstractFilesystemNode *FilesystemNode::getRoot(void) { +AbstractFilesystemNode *AbstractFilesystemNode::getRoot(void) { return new Ps2FilesystemNode(); } -AbstractFilesystemNode *FilesystemNode::getNodeForPath(const String &path) { +AbstractFilesystemNode *AbstractFilesystemNode::getNodeForPath(const String &path) { return new Ps2FilesystemNode(path); } diff --git a/backends/fs/symbian/symbian-fs.cpp b/backends/fs/symbian/symbian-fs.cpp index 78a2461a5b..0971b112dc 100644 --- a/backends/fs/symbian/symbian-fs.cpp +++ b/backends/fs/symbian/symbian-fs.cpp @@ -69,11 +69,11 @@ static const char *lastPathComponent(const Common::String &str) { return cur + 1; } -AbstractFilesystemNode *FilesystemNode::getRoot() { +AbstractFilesystemNode *AbstractFilesystemNode::getRoot() { return new SymbianFilesystemNode(true); } -AbstractFilesystemNode *FilesystemNode::getNodeForPath(const String &path) { +AbstractFilesystemNode *AbstractFilesystemNode::getNodeForPath(const String &path) { return new SymbianFilesystemNode(path); } diff --git a/backends/fs/windows/windows-fs.cpp b/backends/fs/windows/windows-fs.cpp index fb23c8e1f5..5172054c38 100644 --- a/backends/fs/windows/windows-fs.cpp +++ b/backends/fs/windows/windows-fs.cpp @@ -120,11 +120,11 @@ void WindowsFilesystemNode::addFile(FSList &list, ListMode mode, const char *bas list.push_back(wrap(new WindowsFilesystemNode(entry))); } -AbstractFilesystemNode *FilesystemNode::getRoot() { +AbstractFilesystemNode *AbstractFilesystemNode::getRoot() { return new WindowsFilesystemNode(); } -AbstractFilesystemNode *FilesystemNode::getNodeForPath(const String &path) { +AbstractFilesystemNode *AbstractFilesystemNode::getNodeForPath(const String &path) { return new WindowsFilesystemNode(path); } |