diff options
Diffstat (limited to 'backends/fs')
-rw-r--r-- | backends/fs/abstract-fs.h | 17 | ||||
-rw-r--r-- | backends/fs/amigaos4/amigaos4-fs.cpp | 32 | ||||
-rw-r--r-- | backends/fs/ds/ds-fs-factory.cpp | 2 | ||||
-rw-r--r-- | backends/fs/ds/ds-fs-factory.h | 4 | ||||
-rw-r--r-- | backends/fs/ds/ds-fs.cpp | 34 | ||||
-rw-r--r-- | backends/fs/ds/ds-fs.h | 8 | ||||
-rw-r--r-- | backends/fs/palmos/palmos-fs-factory.cpp | 2 | ||||
-rw-r--r-- | backends/fs/palmos/palmos-fs-factory.h | 4 | ||||
-rw-r--r-- | backends/fs/palmos/palmos-fs.cpp | 30 | ||||
-rw-r--r-- | backends/fs/posix/posix-fs.cpp | 4 | ||||
-rw-r--r-- | backends/fs/ps2/ps2-fs-factory.cpp | 2 | ||||
-rw-r--r-- | backends/fs/ps2/ps2-fs-factory.h | 4 | ||||
-rw-r--r-- | backends/fs/ps2/ps2-fs.cpp | 40 | ||||
-rw-r--r-- | backends/fs/psp/psp-fs-factory.cpp | 2 | ||||
-rw-r--r-- | backends/fs/psp/psp-fs-factory.h | 4 | ||||
-rw-r--r-- | backends/fs/psp/psp-fs.cpp | 24 | ||||
-rw-r--r-- | backends/fs/symbian/symbian-fs.cpp | 30 | ||||
-rw-r--r-- | backends/fs/wii/wii-fs-factory.cpp | 2 | ||||
-rw-r--r-- | backends/fs/wii/wii-fs-factory.h | 4 | ||||
-rw-r--r-- | backends/fs/wii/wii-fs.cpp | 30 | ||||
-rw-r--r-- | backends/fs/windows/windows-fs.cpp | 34 |
21 files changed, 149 insertions, 164 deletions
diff --git a/backends/fs/abstract-fs.h b/backends/fs/abstract-fs.h index 73fae24373..a2a1aa8ac3 100644 --- a/backends/fs/abstract-fs.h +++ b/backends/fs/abstract-fs.h @@ -43,22 +43,21 @@ typedef Common::Array<AbstractFilesystemNode *> AbstractFSList; */ class AbstractFilesystemNode { protected: - friend class FilesystemNode; - typedef Common::String String; - typedef FilesystemNode::ListMode ListMode; + friend class Common::FilesystemNode; + typedef Common::FilesystemNode::ListMode ListMode; /** - * Returns the child node with the given name. If no child with this name - * exists, returns 0. When called on a non-directory node, it should - * handle this gracefully by returning 0. + * Returns the child node with the given name. When called on a non-directory + * node, it should handle this gracefully by returning 0. + * When called with a name not matching any of the files/dirs contained in this + * directory, a valid node shold be returned, which returns 'false' upon calling + * the exists() method. The idea is that this node can then still can be used to + * create a new file via the openForWriting() method. * * Example: * Calling getChild() for a node with path "/foo/bar" using name="file.txt", * would produce a new node with "/foo/bar/file.txt" as path. * - * @note This function will append a separator char (\ or /) to the end of the - * path if needed. - * * @note Handling calls on non-dir nodes gracefully makes it possible to * switch to a lazy type detection scheme in the future. * diff --git a/backends/fs/amigaos4/amigaos4-fs.cpp b/backends/fs/amigaos4/amigaos4-fs.cpp index 5bf57ddf34..4f6bce39b3 100644 --- a/backends/fs/amigaos4/amigaos4-fs.cpp +++ b/backends/fs/amigaos4/amigaos4-fs.cpp @@ -52,8 +52,8 @@ const uint32 kExAllBufferSize = 40960; // TODO: is this okay for sure? class AmigaOSFilesystemNode : public AbstractFilesystemNode { protected: BPTR _pFileLock; - String _sDisplayName; - String _sPath; + Common::String _sDisplayName; + Common::String _sPath; bool _bIsDirectory; bool _bIsValid; @@ -74,9 +74,9 @@ public: /** * Creates a AmigaOSFilesystemNode for a given path. * - * @param path String with the path the new node should point to. + * @param path Common::String with the path the new node should point to. */ - AmigaOSFilesystemNode(const String &p); + AmigaOSFilesystemNode(const Common::String &p); /** * FIXME: document this constructor. @@ -96,14 +96,14 @@ public: virtual ~AmigaOSFilesystemNode(); virtual bool exists() const; - virtual String getDisplayName() const { return _sDisplayName; }; - virtual String getName() const { return _sDisplayName; }; - virtual String getPath() const { return _sPath; }; + virtual Common::String getDisplayName() const { return _sDisplayName; }; + virtual Common::String getName() const { return _sDisplayName; }; + virtual Common::String getPath() const { return _sPath; }; virtual bool isDirectory() const { return _bIsDirectory; }; virtual bool isReadable() const; virtual bool isWritable() const; - virtual AbstractFilesystemNode *getChild(const String &n) const; + virtual AbstractFilesystemNode *getChild(const Common::String &n) const; virtual bool getChildren(AbstractFSList &list, ListMode mode, bool hidden) const; virtual AbstractFilesystemNode *getParent() const; @@ -116,7 +116,7 @@ public: /** * Returns the last component of a given path. * - * @param str String containing the path. + * @param str Common::String containing the path. * @return Pointer to the first char of the last component inside str. */ const char *lastPathComponent(const Common::String &str) { @@ -148,7 +148,7 @@ AmigaOSFilesystemNode::AmigaOSFilesystemNode() { LEAVE(); } -AmigaOSFilesystemNode::AmigaOSFilesystemNode(const String &p) { +AmigaOSFilesystemNode::AmigaOSFilesystemNode(const Common::String &p) { ENTER(); int len = 0, offset = p.size(); @@ -299,14 +299,14 @@ bool AmigaOSFilesystemNode::exists() const { return nodeExists; } -AbstractFilesystemNode *AmigaOSFilesystemNode::getChild(const String &n) const { +AbstractFilesystemNode *AmigaOSFilesystemNode::getChild(const Common::String &n) const { ENTER(); if (!_bIsDirectory) { debug(6, "Not a directory"); return 0; } - String newPath(_sPath); + Common::String newPath(_sPath); if (_sPath.lastChar() != '/') newPath += '/'; @@ -368,10 +368,10 @@ bool AmigaOSFilesystemNode::getChildren(AbstractFSList &myList, ListMode mode, b struct ExAllData *ead = data; do { - if ((mode == FilesystemNode::kListAll) || - (EAD_IS_DRAWER(ead) && (mode == FilesystemNode::kListDirectoriesOnly)) || - (EAD_IS_FILE(ead) && (mode == FilesystemNode::kListFilesOnly))) { - String full_path = _sPath; + if ((mode == Common::FilesystemNode::kListAll) || + (EAD_IS_DRAWER(ead) && (mode == Common::FilesystemNode::kListDirectoriesOnly)) || + (EAD_IS_FILE(ead) && (mode == Common::FilesystemNode::kListFilesOnly))) { + Common::String full_path = _sPath; full_path += (char*)ead->ed_Name; BPTR lock = IDOS->Lock((STRPTR)full_path.c_str(), SHARED_LOCK); diff --git a/backends/fs/ds/ds-fs-factory.cpp b/backends/fs/ds/ds-fs-factory.cpp index 2eae2f2403..5c8c3f45f8 100644 --- a/backends/fs/ds/ds-fs-factory.cpp +++ b/backends/fs/ds/ds-fs-factory.cpp @@ -45,7 +45,7 @@ AbstractFilesystemNode *DSFilesystemFactory::makeCurrentDirectoryFileNode() cons } } -AbstractFilesystemNode *DSFilesystemFactory::makeFileNodePath(const String &path) const { +AbstractFilesystemNode *DSFilesystemFactory::makeFileNodePath(const Common::String &path) const { if (DS::isGBAMPAvailable()) { return new DS::GBAMPFileSystemNode(path); } else { diff --git a/backends/fs/ds/ds-fs-factory.h b/backends/fs/ds/ds-fs-factory.h index bff21a309d..67e0076b78 100644 --- a/backends/fs/ds/ds-fs-factory.h +++ b/backends/fs/ds/ds-fs-factory.h @@ -35,11 +35,9 @@ */ class DSFilesystemFactory : public FilesystemFactory, public Common::Singleton<DSFilesystemFactory> { public: - typedef Common::String String; - virtual AbstractFilesystemNode *makeRootFileNode() const; virtual AbstractFilesystemNode *makeCurrentDirectoryFileNode() const; - virtual AbstractFilesystemNode *makeFileNodePath(const String &path) const; + virtual AbstractFilesystemNode *makeFileNodePath(const Common::String &path) const; protected: DSFilesystemFactory() {}; diff --git a/backends/fs/ds/ds-fs.cpp b/backends/fs/ds/ds-fs.cpp index d206941ab9..db6a63cad7 100644 --- a/backends/fs/ds/ds-fs.cpp +++ b/backends/fs/ds/ds-fs.cpp @@ -55,7 +55,7 @@ DSFileSystemNode::DSFileSystemNode() { } } -DSFileSystemNode::DSFileSystemNode(const String& path) { +DSFileSystemNode::DSFileSystemNode(const Common::String& path) { // consolePrintf("--%s ",path.c_str()); char disp[128]; @@ -70,7 +70,7 @@ DSFileSystemNode::DSFileSystemNode(const String& path) { strcpy(disp, pathStr + lastSlash + 1); - _displayName = String(disp); + _displayName = Common::String(disp); _path = path; // _isValid = true; // _isDirectory = false; @@ -98,7 +98,7 @@ DSFileSystemNode::DSFileSystemNode(const String& path) { // consolePrintf("%s - Found: %d, Dir: %d\n", pathStr, _isValid, _isDirectory); } -DSFileSystemNode::DSFileSystemNode(const String& path, bool isDir) { +DSFileSystemNode::DSFileSystemNode(const Common::String& path, bool isDir) { // consolePrintf("--%s ",path.c_str()); char disp[128]; @@ -112,7 +112,7 @@ DSFileSystemNode::DSFileSystemNode(const String& path, bool isDir) { strcpy(disp, pathStr + lastSlash + 1); - _displayName = String(disp); + _displayName = Common::String(disp); _path = path; _isValid = true; _isDirectory = isDir; @@ -167,10 +167,10 @@ bool DSFileSystemNode::getChildren(AbstractFSList &dirList, ListMode mode, bool _zipFile->getFileName(n); // consolePrintf("file: %s\n", n); - if ( (_zipFile->isDirectory() && ((mode == FilesystemNode::kListDirectoriesOnly) || (mode == FilesystemNode::kListAll)) ) - || (!_zipFile->isDirectory() && ((mode == FilesystemNode::kListFilesOnly) || (mode == FilesystemNode::kListAll)) ) ) + if ( (_zipFile->isDirectory() && ((mode == Common::FilesystemNode::kListDirectoriesOnly) || (mode == Common::FilesystemNode::kListAll)) ) + || (!_zipFile->isDirectory() && ((mode == Common::FilesystemNode::kListFilesOnly) || (mode == Common::FilesystemNode::kListAll)) ) ) { - DSFileSystemNode* dsfsn = new DSFileSystemNode("ds:/" + String(n), _zipFile->isDirectory()); + DSFileSystemNode* dsfsn = new DSFileSystemNode("ds:/" + Common::String(n), _zipFile->isDirectory()); dsfsn->_isDirectory = _zipFile->isDirectory(); dirList.push_back((dsfsn)); } @@ -195,7 +195,7 @@ AbstractFilesystemNode* DSFileSystemNode::getParent() const { } } - p = new DSFileSystemNode(String(path, lastSlash)); + p = new DSFileSystemNode(Common::String(path, lastSlash)); ((DSFileSystemNode *) (p))->_isDirectory = true; } else { p = new DSFileSystemNode(); @@ -216,7 +216,7 @@ GBAMPFileSystemNode::GBAMPFileSystemNode() { _path = "mp:/"; } -GBAMPFileSystemNode::GBAMPFileSystemNode(const String& path) { +GBAMPFileSystemNode::GBAMPFileSystemNode(const Common::String& path) { // consolePrintf("'%s'",path.c_str()); char disp[128]; @@ -245,13 +245,13 @@ GBAMPFileSystemNode::GBAMPFileSystemNode(const String& path) { } // consolePrintf("Path: %s (%d)\n", check, success); - _displayName = String(disp); + _displayName = Common::String(disp); _path = path; _isValid = success == FT_FILE; _isDirectory = success == FT_DIR; } -GBAMPFileSystemNode::GBAMPFileSystemNode(const String& path, bool isDirectory) { +GBAMPFileSystemNode::GBAMPFileSystemNode(const Common::String& path, bool isDirectory) { // consolePrintf("'%s'",path.c_str()); char disp[128]; @@ -265,7 +265,7 @@ GBAMPFileSystemNode::GBAMPFileSystemNode(const String& path, bool isDirectory) { strcpy(disp, pathStr + lastSlash + 1); - _displayName = String(disp); + _displayName = Common::String(disp); _path = path; _isValid = true; _isDirectory = isDirectory; @@ -313,8 +313,8 @@ bool GBAMPFileSystemNode::getChildren(AbstractFSList& dirList, ListMode mode, bo while (entryType != TYPE_NO_MORE) { - if ( ((entryType == TYPE_DIR) && ((mode == FilesystemNode::kListDirectoriesOnly) || (mode == FilesystemNode::kListAll))) - || ((entryType == TYPE_FILE) && ((mode == FilesystemNode::kListFilesOnly) || (mode == FilesystemNode::kListAll))) ) { + if ( ((entryType == TYPE_DIR) && ((mode == Common::FilesystemNode::kListDirectoriesOnly) || (mode == Common::FilesystemNode::kListAll))) + || ((entryType == TYPE_FILE) && ((mode == Common::FilesystemNode::kListFilesOnly) || (mode == Common::FilesystemNode::kListAll))) ) { GBAMPFileSystemNode* dsfsn; consolePrintf("Fname: %s\n", fname); @@ -322,9 +322,9 @@ bool GBAMPFileSystemNode::getChildren(AbstractFSList& dirList, ListMode mode, bo if (strcmp(fname, ".") && strcmp(fname, "..")) { if (!strcmp(path, "/")) { - dsfsn = new GBAMPFileSystemNode("mp:" + String(path) + String(fname), entryType == TYPE_DIR); + dsfsn = new GBAMPFileSystemNode("mp:" + Common::String(path) + Common::String(fname), entryType == TYPE_DIR); } else { - dsfsn = new GBAMPFileSystemNode("mp:" + String(path) + String("/") + String(fname), entryType == TYPE_DIR); + dsfsn = new GBAMPFileSystemNode("mp:" + Common::String(path) + Common::String("/") + Common::String(fname), entryType == TYPE_DIR); } // dsfsn->_isDirectory = entryType == DIR; @@ -358,7 +358,7 @@ AbstractFilesystemNode* GBAMPFileSystemNode::getParent() const { } } - p = new GBAMPFileSystemNode(String(path, lastSlash)); + p = new GBAMPFileSystemNode(Common::String(path, lastSlash)); p->_isDirectory = true; } else { p = new GBAMPFileSystemNode(); diff --git a/backends/fs/ds/ds-fs.h b/backends/fs/ds/ds-fs.h index 9ac453aca9..2856ec4903 100644 --- a/backends/fs/ds/ds-fs.h +++ b/backends/fs/ds/ds-fs.h @@ -41,8 +41,6 @@ namespace DS { */ class DSFileSystemNode : public AbstractFilesystemNode { protected: - typedef class Common::String String; - static ZipFile* _zipFile; String _displayName; @@ -89,7 +87,7 @@ public: */ virtual AbstractFilesystemNode *clone() const { return new DSFileSystemNode(this); } virtual AbstractFilesystemNode *getChild(const Common::String& name) const; - virtual bool getChildren(AbstractFSList &list, ListMode mode = FilesystemNode::kListDirectoriesOnly, bool hidden = false) const; + virtual bool getChildren(AbstractFSList &list, ListMode mode, bool hidden) const; virtual AbstractFilesystemNode *getParent() const; /** @@ -107,8 +105,6 @@ public: */ class GBAMPFileSystemNode : public AbstractFilesystemNode { protected: - typedef class Common::String String; - String _displayName; String _path; bool _isDirectory; @@ -153,7 +149,7 @@ public: */ virtual AbstractFilesystemNode *clone() const { return new GBAMPFileSystemNode(this); } virtual AbstractFilesystemNode *getChild(const Common::String& name) const; - virtual bool getChildren(AbstractFSList &list, ListMode mode = FilesystemNode::kListDirectoriesOnly, bool hidden = false) const; + virtual bool getChildren(AbstractFSList &list, ListMode mode, bool hidden) const; virtual AbstractFilesystemNode *getParent() const; }; diff --git a/backends/fs/palmos/palmos-fs-factory.cpp b/backends/fs/palmos/palmos-fs-factory.cpp index 8699a9788b..bbc1639897 100644 --- a/backends/fs/palmos/palmos-fs-factory.cpp +++ b/backends/fs/palmos/palmos-fs-factory.cpp @@ -36,7 +36,7 @@ AbstractFilesystemNode *PalmOSFilesystemFactory::makeCurrentDirectoryFileNode() return new PalmOSFilesystemNode(); } -AbstractFilesystemNode *PalmOSFilesystemFactory::makeFileNodePath(const String &path) const { +AbstractFilesystemNode *PalmOSFilesystemFactory::makeFileNodePath(const Common::String &path) const { return new PalmOSFilesystemNode(path); } #endif diff --git a/backends/fs/palmos/palmos-fs-factory.h b/backends/fs/palmos/palmos-fs-factory.h index 3ea8b5fe47..f778aa89ef 100644 --- a/backends/fs/palmos/palmos-fs-factory.h +++ b/backends/fs/palmos/palmos-fs-factory.h @@ -35,11 +35,9 @@ */ class PalmOSFilesystemFactory : public FilesystemFactory, public Common::Singleton<PalmOSFilesystemFactory> { public: - typedef Common::String String; - virtual AbstractFilesystemNode *makeRootFileNode() const; virtual AbstractFilesystemNode *makeCurrentDirectoryFileNode() const; - virtual AbstractFilesystemNode *makeFileNodePath(const String &path) const; + virtual AbstractFilesystemNode *makeFileNodePath(const Common::String &path) const; protected: PalmOSFilesystemFactory() {}; diff --git a/backends/fs/palmos/palmos-fs.cpp b/backends/fs/palmos/palmos-fs.cpp index 69d9f350f5..522d7682cc 100644 --- a/backends/fs/palmos/palmos-fs.cpp +++ b/backends/fs/palmos/palmos-fs.cpp @@ -36,8 +36,8 @@ */ class PalmOSFilesystemNode : public AbstractFilesystemNode { protected: - String _displayName; - String _path; + Common::String _displayName; + Common::String _path; bool _isDirectory; bool _isValid; bool _isPseudoRoot; @@ -51,19 +51,19 @@ public: /** * Creates a POSIXFilesystemNode for a given path. * - * @param path String with the path the new node should point to. + * @param path Common::String with the path the new node should point to. */ - PalmOSFilesystemNode(const String &p); + PalmOSFilesystemNode(const Common::String &p); virtual bool exists() const { return _isValid; } - virtual String getDisplayName() const { return _displayName; } - virtual String getName() const { return _displayName; } - virtual String getPath() const { return _path; } + virtual Common::String getDisplayName() const { return _displayName; } + virtual Common::String getName() const { return _displayName; } + virtual Common::String getPath() const { return _path; } virtual bool isDirectory() const { return _isDirectory; } virtual bool isReadable() const { return true; } //FIXME: this is just a stub virtual bool isWritable() const { return true; } //FIXME: this is just a stub - virtual AbstractFilesystemNode *getChild(const String &n) const; + virtual AbstractFilesystemNode *getChild(const Common::String &n) const; virtual bool getChildren(AbstractFSList &list, ListMode mode, bool hidden) const; virtual AbstractFilesystemNode *getParent() const; @@ -74,7 +74,7 @@ private: * * @param list List to put the file entry node in. * @param mode Mode to use while adding the file entry to the list. - * @param base String with the directory being listed. + * @param base Common::String with the directory being listed. * @param find_data Describes a file that the FindFirstFile, FindFirstFileEx, or FindNextFile functions find. */ static void addFile(AbstractFSList &list, ListMode mode, const Char *base, FileInfoType* find_data); @@ -86,8 +86,8 @@ void PalmOSFilesystemNode::addFile(AbstractFSList &list, ListMode mode, const ch isDir = (find_data->attributes & vfsFileAttrDirectory); - if ((!isDir && mode == FilesystemNode::kListDirectoriesOnly) || - (isDir && mode == FilesystemNode::kListFilesOnly)) + if ((!isDir && mode == Common::FilesystemNode::kListDirectoriesOnly) || + (isDir && mode == Common::FilesystemNode::kListFilesOnly)) return; entry._isDirectory = isDir; @@ -112,7 +112,7 @@ PalmOSFilesystemNode::PalmOSFilesystemNode() { _isPseudoRoot = false; } -PalmOSFilesystemNode::PalmOSFilesystemNode(const String &p) { +PalmOSFilesystemNode::PalmOSFilesystemNode(const Common::String &p) { _path = p; _displayName = lastPathComponent(_path, '/'); @@ -135,10 +135,10 @@ PalmOSFilesystemNode::PalmOSFilesystemNode(const String &p) { _isPseudoRoot = false; } -AbstractFilesystemNode *PalmOSFilesystemNode::getChild(const String &n) const { +AbstractFilesystemNode *PalmOSFilesystemNode::getChild(const Common::String &n) const { assert(_isDirectory); - String newPath(_path); + Common::String newPath(_path); if (_path.lastChar() != '/') newPath += '/'; newPath += n; @@ -194,7 +194,7 @@ AbstractFilesystemNode *PalmOSFilesystemNode::getParent() const { const char *end = lastPathComponent(_path, '/'); p = new PalmOSFilesystemNode(); - p->_path = String(start, end - start); + p->_path = Common::String(start, end - start); p->_isValid = true; p->_isDirectory = true; p->_displayName = lastPathComponent(p->_path, '/'); diff --git a/backends/fs/posix/posix-fs.cpp b/backends/fs/posix/posix-fs.cpp index 44723c8e6e..992d54456b 100644 --- a/backends/fs/posix/posix-fs.cpp +++ b/backends/fs/posix/posix-fs.cpp @@ -202,8 +202,8 @@ bool POSIXFilesystemNode::getChildren(AbstractFSList &myList, ListMode mode, boo continue; // Honor the chosen mode - if ((mode == FilesystemNode::kListFilesOnly && entry._isDirectory) || - (mode == FilesystemNode::kListDirectoriesOnly && !entry._isDirectory)) + if ((mode == Common::FilesystemNode::kListFilesOnly && entry._isDirectory) || + (mode == Common::FilesystemNode::kListDirectoriesOnly && !entry._isDirectory)) continue; myList.push_back(new POSIXFilesystemNode(entry)); diff --git a/backends/fs/ps2/ps2-fs-factory.cpp b/backends/fs/ps2/ps2-fs-factory.cpp index ce3b4a5eaf..e96671ee0a 100644 --- a/backends/fs/ps2/ps2-fs-factory.cpp +++ b/backends/fs/ps2/ps2-fs-factory.cpp @@ -36,7 +36,7 @@ AbstractFilesystemNode *Ps2FilesystemFactory::makeCurrentDirectoryFileNode() con return new Ps2FilesystemNode(); } -AbstractFilesystemNode *Ps2FilesystemFactory::makeFileNodePath(const String &path) const { +AbstractFilesystemNode *Ps2FilesystemFactory::makeFileNodePath(const Common::String &path) const { // return new Ps2FilesystemNode(path); Ps2FilesystemNode *nf = new Ps2FilesystemNode(path, true); diff --git a/backends/fs/ps2/ps2-fs-factory.h b/backends/fs/ps2/ps2-fs-factory.h index 416024c905..432cf467c3 100644 --- a/backends/fs/ps2/ps2-fs-factory.h +++ b/backends/fs/ps2/ps2-fs-factory.h @@ -35,11 +35,9 @@ */ class Ps2FilesystemFactory : public FilesystemFactory, public Common::Singleton<Ps2FilesystemFactory> { public: - typedef Common::String String; - virtual AbstractFilesystemNode *makeRootFileNode() const; virtual AbstractFilesystemNode *makeCurrentDirectoryFileNode() const; - virtual AbstractFilesystemNode *makeFileNodePath(const String &path) const; + virtual AbstractFilesystemNode *makeFileNodePath(const Common::String &path) const; protected: Ps2FilesystemFactory() {}; diff --git a/backends/fs/ps2/ps2-fs.cpp b/backends/fs/ps2/ps2-fs.cpp index b0f1ddbafb..65ea86826c 100644 --- a/backends/fs/ps2/ps2-fs.cpp +++ b/backends/fs/ps2/ps2-fs.cpp @@ -47,8 +47,8 @@ class Ps2FilesystemNode : public AbstractFilesystemNode { friend class Ps2FilesystemFactory; protected: - String _displayName; - String _path; + Common::String _displayName; + Common::String _path; bool _isDirectory; bool _isRoot; @@ -65,10 +65,10 @@ public: /** * Creates a PS2FilesystemNode for a given path. * - * @param path String with the path the new node should point to. + * @param path Common::String with the path the new node should point to. */ - Ps2FilesystemNode(const String &path); - Ps2FilesystemNode(const String &path, bool verify); + Ps2FilesystemNode(const Common::String &path); + Ps2FilesystemNode(const Common::String &path, bool verify); /** * Copy constructor. @@ -77,9 +77,9 @@ public: virtual bool exists(void) const; - virtual String getDisplayName() const { return _displayName; } - virtual String getName() const { return _displayName; } - virtual String getPath() const { return _path; } + virtual Common::String getDisplayName() const { return _displayName; } + virtual Common::String getName() const { return _displayName; } + virtual Common::String getPath() const { return _path; } virtual bool isDirectory() const { return _isDirectory; @@ -95,7 +95,7 @@ public: } virtual AbstractFilesystemNode *clone() const { return new Ps2FilesystemNode(this); } - virtual AbstractFilesystemNode *getChild(const String &n) const; + virtual AbstractFilesystemNode *getChild(const Common::String &n) const; virtual bool getChildren(AbstractFSList &list, ListMode mode, bool hidden) const; virtual AbstractFilesystemNode *getParent() const; }; @@ -107,12 +107,12 @@ Ps2FilesystemNode::Ps2FilesystemNode() { _path = ""; } -Ps2FilesystemNode::Ps2FilesystemNode(const String &path) { +Ps2FilesystemNode::Ps2FilesystemNode(const Common::String &path) { _path = path; _isDirectory = true; if (strcmp(path.c_str(), "") == 0) { _isRoot = true; - _displayName = String("PlayStation 2"); + _displayName = Common::String("PlayStation 2"); } else { _isRoot = false; const char *dsplName = NULL, *pos = path.c_str(); @@ -120,18 +120,18 @@ Ps2FilesystemNode::Ps2FilesystemNode(const String &path) { if (*pos++ == '/') dsplName = pos; if (dsplName) - _displayName = String(dsplName); + _displayName = Common::String(dsplName); else _displayName = getDeviceDescription(path.c_str()); } } -Ps2FilesystemNode::Ps2FilesystemNode(const String &path, bool verify) { +Ps2FilesystemNode::Ps2FilesystemNode(const Common::String &path, bool verify) { _path = path; if (strcmp(path.c_str(), "") == 0) { _isRoot = true; /* root is always a dir*/ - _displayName = String("PlayStation 2"); + _displayName = Common::String("PlayStation 2"); _isDirectory = true; } else { _isRoot = false; @@ -141,7 +141,7 @@ Ps2FilesystemNode::Ps2FilesystemNode(const String &path, bool verify) { dsplName = pos; if (dsplName) { - _displayName = String(dsplName); + _displayName = Common::String(dsplName); if (verify) _isDirectory = getDirectoryFlag(path.c_str()); else @@ -206,7 +206,7 @@ bool Ps2FilesystemNode::getDirectoryFlag(const char *path) { return false; } -AbstractFilesystemNode *Ps2FilesystemNode::getChild(const String &n) const { +AbstractFilesystemNode *Ps2FilesystemNode::getChild(const Common::String &n) const { if (!_isDirectory) return NULL; @@ -284,9 +284,9 @@ bool Ps2FilesystemNode::getChildren(AbstractFSList &list, ListMode mode, bool hi while ((dreadRes = fio.dread(fd, &dirent)) > 0) { if (dirent.name[0] == '.') continue; // ignore '.' and '..' - if (((mode == FilesystemNode::kListDirectoriesOnly) && (dirent.stat.mode & FIO_S_IFDIR)) || - ((mode == FilesystemNode::kListFilesOnly) && !(dirent.stat.mode & FIO_S_IFDIR)) || - (mode == FilesystemNode::kListAll)) { + if (((mode == Common::FilesystemNode::kListDirectoriesOnly) && (dirent.stat.mode & FIO_S_IFDIR)) || + ((mode == Common::FilesystemNode::kListFilesOnly) && !(dirent.stat.mode & FIO_S_IFDIR)) || + (mode == Common::FilesystemNode::kListAll)) { dirEntry._isDirectory = (bool)(dirent.stat.mode & FIO_S_IFDIR); dirEntry._isRoot = false; @@ -322,7 +322,7 @@ AbstractFilesystemNode *Ps2FilesystemNode::getParent() const { } if (slash) - return new Ps2FilesystemNode(String(_path.c_str(), slash - _path.c_str())); + return new Ps2FilesystemNode(Common::String(_path.c_str(), slash - _path.c_str())); else return new Ps2FilesystemNode(); } diff --git a/backends/fs/psp/psp-fs-factory.cpp b/backends/fs/psp/psp-fs-factory.cpp index 87f0e0f587..a38462f02a 100644 --- a/backends/fs/psp/psp-fs-factory.cpp +++ b/backends/fs/psp/psp-fs-factory.cpp @@ -36,7 +36,7 @@ AbstractFilesystemNode *PSPFilesystemFactory::makeCurrentDirectoryFileNode() con return new PSPFilesystemNode(); } -AbstractFilesystemNode *PSPFilesystemFactory::makeFileNodePath(const String &path) const { +AbstractFilesystemNode *PSPFilesystemFactory::makeFileNodePath(const Common::String &path) const { return new PSPFilesystemNode(path, true); } #endif diff --git a/backends/fs/psp/psp-fs-factory.h b/backends/fs/psp/psp-fs-factory.h index ffa934755f..abf03d288e 100644 --- a/backends/fs/psp/psp-fs-factory.h +++ b/backends/fs/psp/psp-fs-factory.h @@ -35,11 +35,9 @@ */ class PSPFilesystemFactory : public FilesystemFactory, public Common::Singleton<PSPFilesystemFactory> { public: - typedef Common::String String; - virtual AbstractFilesystemNode *makeRootFileNode() const; virtual AbstractFilesystemNode *makeCurrentDirectoryFileNode() const; - virtual AbstractFilesystemNode *makeFileNodePath(const String &path) const; + virtual AbstractFilesystemNode *makeFileNodePath(const Common::String &path) const; protected: PSPFilesystemFactory() {}; diff --git a/backends/fs/psp/psp-fs.cpp b/backends/fs/psp/psp-fs.cpp index aa3e253782..e5d66d7350 100644 --- a/backends/fs/psp/psp-fs.cpp +++ b/backends/fs/psp/psp-fs.cpp @@ -39,8 +39,8 @@ */ class PSPFilesystemNode : public AbstractFilesystemNode { protected: - String _displayName; - String _path; + Common::String _displayName; + Common::String _path; bool _isDirectory; bool _isValid; @@ -53,20 +53,20 @@ public: /** * Creates a PSPFilesystemNode for a given path. * - * @param path String with the path the new node should point to. + * @param path Common::String with the path the new node should point to. * @param verify true if the isValid and isDirectory flags should be verified during the construction. */ PSPFilesystemNode(const Common::String &p, bool verify); virtual bool exists() const { return access(_path.c_str(), F_OK) == 0; } - virtual String getDisplayName() const { return _displayName; } - virtual String getName() const { return _displayName; } - virtual String getPath() const { return _path; } + virtual Common::String getDisplayName() const { return _displayName; } + virtual Common::String getName() const { return _displayName; } + virtual Common::String getPath() const { return _path; } virtual bool isDirectory() const { return _isDirectory; } virtual bool isReadable() const { return access(_path.c_str(), R_OK) == 0; } virtual bool isWritable() const { return access(_path.c_str(), W_OK) == 0; } - virtual AbstractFilesystemNode *getChild(const String &n) const; + virtual AbstractFilesystemNode *getChild(const Common::String &n) const; virtual bool getChildren(AbstractFSList &list, ListMode mode, bool hidden) const; virtual AbstractFilesystemNode *getParent() const; }; @@ -93,12 +93,12 @@ PSPFilesystemNode::PSPFilesystemNode(const Common::String &p, bool verify) { } } -AbstractFilesystemNode *PSPFilesystemNode::getChild(const String &n) const { +AbstractFilesystemNode *PSPFilesystemNode::getChild(const Common::String &n) const { // FIXME: Pretty lame implementation! We do no error checking to speak // of, do not check if this is a special node, etc. assert(_isDirectory); - String newPath(_path); + Common::String newPath(_path); if (_path.lastChar() != '/') newPath += '/'; newPath += n; @@ -133,8 +133,8 @@ bool PSPFilesystemNode::getChildren(AbstractFSList &myList, ListMode mode, bool entry._path += "/"; // Honor the chosen mode - if ((mode == FilesystemNode::kListFilesOnly && entry._isDirectory) || - (mode == FilesystemNode::kListDirectoriesOnly && !entry._isDirectory)) + if ((mode == Common::FilesystemNode::kListFilesOnly && entry._isDirectory) || + (mode == Common::FilesystemNode::kListDirectoriesOnly && !entry._isDirectory)) continue; myList.push_back(new PSPFilesystemNode(entry)); @@ -154,7 +154,7 @@ AbstractFilesystemNode *PSPFilesystemNode::getParent() const { const char *start = _path.c_str(); const char *end = lastPathComponent(_path, '/'); - return new PSPFilesystemNode(String(start, end - start), false); + return new PSPFilesystemNode(Common::String(start, end - start), false); } #endif //#ifdef __PSP__ diff --git a/backends/fs/symbian/symbian-fs.cpp b/backends/fs/symbian/symbian-fs.cpp index af963dda0c..a59f06b9eb 100644 --- a/backends/fs/symbian/symbian-fs.cpp +++ b/backends/fs/symbian/symbian-fs.cpp @@ -38,8 +38,8 @@ */ class SymbianFilesystemNode : public AbstractFilesystemNode { protected: - String _displayName; - String _path; + Common::String _displayName; + Common::String _path; bool _isDirectory; bool _isValid; bool _isPseudoRoot; @@ -55,9 +55,9 @@ public: /** * Creates a SymbianFilesystemNode for a given path. * - * @param path String with the path the new node should point to. + * @param path Common::String with the path the new node should point to. */ - SymbianFilesystemNode(const String &path); + SymbianFilesystemNode(const Common::String &path); virtual bool exists() const { TFileName fname; @@ -66,14 +66,14 @@ public: TBool fileExists = BaflUtils::FileExists(static_cast<OSystem_SDL_Symbian*>(g_system)->FsSession(), fname); return fileExists; } - virtual String getDisplayName() const { return _displayName; } - virtual String getName() const { return _displayName; } - virtual String getPath() const { return _path; } + virtual Common::String getDisplayName() const { return _displayName; } + virtual Common::String getName() const { return _displayName; } + virtual Common::String getPath() const { return _path; } virtual bool isDirectory() const { return _isDirectory; } virtual bool isReadable() const { return access(_path.c_str(), R_OK) == 0; } //FIXME: this is just a stub virtual bool isWritable() const { return access(_path.c_str(), W_OK) == 0; } //FIXME: this is just a stub - virtual AbstractFilesystemNode *getChild(const String &n) const; + virtual AbstractFilesystemNode *getChild(const Common::String &n) const; virtual bool getChildren(AbstractFSList &list, ListMode mode, bool hidden) const; virtual AbstractFilesystemNode *getParent() const; }; @@ -81,7 +81,7 @@ public: /** * Fixes the path by changing all slashes to backslashes. * - * @param path String with the path to be fixed. + * @param path Common::String with the path to be fixed. */ static void fixFilePath(Common::String& aPath){ TInt len = aPath.size(); @@ -102,7 +102,7 @@ SymbianFilesystemNode::SymbianFilesystemNode(bool aIsRoot) { } -SymbianFilesystemNode::SymbianFilesystemNode(const String &path) { +SymbianFilesystemNode::SymbianFilesystemNode(const Common::String &path) { if (path.size() == 0) _isPseudoRoot = true; else @@ -128,9 +128,9 @@ SymbianFilesystemNode::SymbianFilesystemNode(const String &path) { } } -AbstractFilesystemNode *SymbianFilesystemNode::getChild(const String &n) const { +AbstractFilesystemNode *SymbianFilesystemNode::getChild(const Common::String &n) const { assert(_isDirectory); - String newPath(_path); + Common::String newPath(_path); if (_path.lastChar() != '\\') newPath += '\\'; @@ -210,8 +210,8 @@ bool SymbianFilesystemNode::getChildren(AbstractFSList &myList, ListMode mode, b entry._isDirectory = fileentry.IsDir(); // Honor the chosen mode - if ((mode == FilesystemNode::kListFilesOnly && entry._isDirectory) || - (mode == FilesystemNode::kListDirectoriesOnly && !entry._isDirectory)) + if ((mode == Common::FilesystemNode::kListFilesOnly && entry._isDirectory) || + (mode == Common::FilesystemNode::kListDirectoriesOnly && !entry._isDirectory)) continue; if (entry._isDirectory) @@ -235,7 +235,7 @@ AbstractFilesystemNode *SymbianFilesystemNode::getParent() const { const char *start = _path.c_str(); const char *end = lastPathComponent(_path, '\\'); - p->_path = String(start, end - start); + p->_path = Common::String(start, end - start); p->_isValid = true; p->_isDirectory = true; p->_displayName = lastPathComponent(p->_path, '\\'); diff --git a/backends/fs/wii/wii-fs-factory.cpp b/backends/fs/wii/wii-fs-factory.cpp index 9839858dd5..69086a95f1 100644 --- a/backends/fs/wii/wii-fs-factory.cpp +++ b/backends/fs/wii/wii-fs-factory.cpp @@ -42,7 +42,7 @@ AbstractFilesystemNode *WiiFilesystemFactory::makeCurrentDirectoryFileNode() con return new WiiFilesystemNode(); } -AbstractFilesystemNode *WiiFilesystemFactory::makeFileNodePath(const String &path) const { +AbstractFilesystemNode *WiiFilesystemFactory::makeFileNodePath(const Common::String &path) const { return new WiiFilesystemNode(path, true); } #endif diff --git a/backends/fs/wii/wii-fs-factory.h b/backends/fs/wii/wii-fs-factory.h index 24badee330..36867a392c 100644 --- a/backends/fs/wii/wii-fs-factory.h +++ b/backends/fs/wii/wii-fs-factory.h @@ -33,11 +33,9 @@ */ class WiiFilesystemFactory : public FilesystemFactory, public Common::Singleton<WiiFilesystemFactory> { public: - typedef Common::String String; - virtual AbstractFilesystemNode *makeRootFileNode() const; virtual AbstractFilesystemNode *makeCurrentDirectoryFileNode() const; - virtual AbstractFilesystemNode *makeFileNodePath(const String &path) const; + virtual AbstractFilesystemNode *makeFileNodePath(const Common::String &path) const; protected: WiiFilesystemFactory() {}; diff --git a/backends/fs/wii/wii-fs.cpp b/backends/fs/wii/wii-fs.cpp index 4272ffb380..0d489d3a99 100644 --- a/backends/fs/wii/wii-fs.cpp +++ b/backends/fs/wii/wii-fs.cpp @@ -37,8 +37,8 @@ */ class WiiFilesystemNode : public AbstractFilesystemNode { protected: - String _displayName; - String _path; + Common::String _displayName; + Common::String _path; bool _isDirectory, _isReadable, _isWritable; public: @@ -50,20 +50,20 @@ public: /** * Creates a WiiFilesystemNode for a given path. * - * @param path String with the path the new node should point to. + * @param path Common::String with the path the new node should point to. * @param verify true if the isValid and isDirectory flags should be verified during the construction. */ - WiiFilesystemNode(const String &path, bool verify); + WiiFilesystemNode(const Common::String &path, bool verify); virtual bool exists() const; - virtual String getDisplayName() const { return _displayName; } - virtual String getName() const { return _displayName; } - virtual String getPath() const { return _path; } + virtual Common::String getDisplayName() const { return _displayName; } + virtual Common::String getName() const { return _displayName; } + virtual Common::String getPath() const { return _path; } virtual bool isDirectory() const { return _isDirectory; } virtual bool isReadable() const { return _isReadable; } virtual bool isWritable() const { return _isWritable; } - virtual AbstractFilesystemNode *getChild(const String &n) const; + virtual AbstractFilesystemNode *getChild(const Common::String &n) const; virtual bool getChildren(AbstractFSList &list, ListMode mode, bool hidden) const; virtual AbstractFilesystemNode *getParent() const; @@ -94,7 +94,7 @@ WiiFilesystemNode::WiiFilesystemNode() { setFlags(); } -WiiFilesystemNode::WiiFilesystemNode(const String &p, bool verify) { +WiiFilesystemNode::WiiFilesystemNode(const Common::String &p, bool verify) { assert(p.size() > 0); _path = p; @@ -110,10 +110,10 @@ bool WiiFilesystemNode::exists() const { return stat(_path.c_str (), &st) == 0; } -AbstractFilesystemNode *WiiFilesystemNode::getChild(const String &n) const { +AbstractFilesystemNode *WiiFilesystemNode::getChild(const Common::String &n) const { assert(_isDirectory); - String newPath(_path); + Common::String newPath(_path); if (newPath.lastChar() != '/') newPath += '/'; newPath += n; @@ -136,15 +136,15 @@ bool WiiFilesystemNode::getChildren(AbstractFSList &myList, ListMode mode, bool if (strcmp(filename, ".") == 0 || strcmp(filename, "..") == 0) continue; - String newPath(_path); + Common::String newPath(_path); if (newPath.lastChar() != '/') newPath += '/'; newPath += filename; bool isDir = S_ISDIR(st.st_mode); - if ((mode == FilesystemNode::kListFilesOnly && isDir) || - (mode == FilesystemNode::kListDirectoriesOnly && !isDir)) + if ((mode == Common::FilesystemNode::kListFilesOnly && isDir) || + (mode == Common::FilesystemNode::kListDirectoriesOnly && !isDir)) continue; if (isDir) @@ -165,7 +165,7 @@ AbstractFilesystemNode *WiiFilesystemNode::getParent() const { const char *start = _path.c_str(); const char *end = lastPathComponent(_path, '/'); - return new WiiFilesystemNode(String(start, end - start), true); + return new WiiFilesystemNode(Common::String(start, end - start), true); } #endif //#if defined(__WII__) diff --git a/backends/fs/windows/windows-fs.cpp b/backends/fs/windows/windows-fs.cpp index afcae0f294..5d8c2f009c 100644 --- a/backends/fs/windows/windows-fs.cpp +++ b/backends/fs/windows/windows-fs.cpp @@ -58,8 +58,8 @@ */ class WindowsFilesystemNode : public AbstractFilesystemNode { protected: - String _displayName; - String _path; + Common::String _displayName; + Common::String _path; bool _isDirectory; bool _isPseudoRoot; bool _isValid; @@ -81,20 +81,20 @@ public: * path=c:\foo\bar.txt, currentDir=true -> current directory * path=NULL, currentDir=true -> current directory * - * @param path String with the path the new node should point to. + * @param path Common::String with the path the new node should point to. * @param currentDir if true, the path parameter will be ignored and the resulting node will point to the current directory. */ - WindowsFilesystemNode(const String &path, const bool currentDir); + WindowsFilesystemNode(const Common::String &path, const bool currentDir); virtual bool exists() const { return _access(_path.c_str(), F_OK) == 0; } - virtual String getDisplayName() const { return _displayName; } - virtual String getName() const { return _displayName; } - virtual String getPath() const { return _path; } + virtual Common::String getDisplayName() const { return _displayName; } + virtual Common::String getName() const { return _displayName; } + virtual Common::String getPath() const { return _path; } virtual bool isDirectory() const { return _isDirectory; } virtual bool isReadable() const { return _access(_path.c_str(), R_OK) == 0; } virtual bool isWritable() const { return _access(_path.c_str(), W_OK) == 0; } - virtual AbstractFilesystemNode *getChild(const String &n) const; + virtual AbstractFilesystemNode *getChild(const Common::String &n) const; virtual bool getChildren(AbstractFSList &list, ListMode mode, bool hidden) const; virtual AbstractFilesystemNode *getParent() const; @@ -105,7 +105,7 @@ private: * * @param list List to put the file entry node in. * @param mode Mode to use while adding the file entry to the list. - * @param base String with the directory being listed. + * @param base Common::String with the directory being listed. * @param find_data Describes a file that the FindFirstFile, FindFirstFileEx, or FindNextFile functions find. */ static void addFile(AbstractFSList &list, ListMode mode, const char *base, WIN32_FIND_DATA* find_data); @@ -113,7 +113,7 @@ private: /** * Converts a Unicode string to Ascii format. * - * @param str String to convert from Unicode to Ascii. + * @param str Common::String to convert from Unicode to Ascii. * @return str in Ascii format. */ static char *toAscii(TCHAR *str); @@ -121,7 +121,7 @@ private: /** * Converts an Ascii string to Unicode format. * - * @param str String to convert from Ascii to Unicode. + * @param str Common::String to convert from Ascii to Unicode. * @return str in Unicode format. */ static const TCHAR* toUnicode(const char *str); @@ -138,8 +138,8 @@ void WindowsFilesystemNode::addFile(AbstractFSList &list, ListMode mode, const c isDirectory = (find_data->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY ? true : false); - if ((!isDirectory && mode == FilesystemNode::kListDirectoriesOnly) || - (isDirectory && mode == FilesystemNode::kListFilesOnly)) + if ((!isDirectory && mode == Common::FilesystemNode::kListDirectoriesOnly) || + (isDirectory && mode == Common::FilesystemNode::kListFilesOnly)) return; entry._isDirectory = isDirectory; @@ -190,7 +190,7 @@ WindowsFilesystemNode::WindowsFilesystemNode() { #endif } -WindowsFilesystemNode::WindowsFilesystemNode(const String &p, const bool currentDir) { +WindowsFilesystemNode::WindowsFilesystemNode(const Common::String &p, const bool currentDir) { if (currentDir) { char path[MAX_PATH]; GetCurrentDirectory(MAX_PATH, path); @@ -219,10 +219,10 @@ WindowsFilesystemNode::WindowsFilesystemNode(const String &p, const bool current _isPseudoRoot = false; } -AbstractFilesystemNode *WindowsFilesystemNode::getChild(const String &n) const { +AbstractFilesystemNode *WindowsFilesystemNode::getChild(const Common::String &n) const { assert(_isDirectory); - String newPath(_path); + Common::String newPath(_path); if (_path.lastChar() != '\\') newPath += '\\'; newPath += n; @@ -293,7 +293,7 @@ AbstractFilesystemNode *WindowsFilesystemNode::getParent() const { const char *end = lastPathComponent(_path, '\\'); p = new WindowsFilesystemNode(); - p->_path = String(start, end - start); + p->_path = Common::String(start, end - start); p->_isValid = true; p->_isDirectory = true; p->_displayName = lastPathComponent(p->_path, '\\'); |