diff options
-rw-r--r-- | backends/fs/fs.cpp | 29 | ||||
-rw-r--r-- | backends/fs/fs.h | 12 |
2 files changed, 33 insertions, 8 deletions
diff --git a/backends/fs/fs.cpp b/backends/fs/fs.cpp index a3746575e6..60766cb073 100644 --- a/backends/fs/fs.cpp +++ b/backends/fs/fs.cpp @@ -38,11 +38,14 @@ void FSList::sort() { FilesystemNode AbstractFilesystemNode::wrap(AbstractFilesystemNode *node) { - FilesystemNode wrapper; - wrapper._realNode = node; + FilesystemNode wrapper(node); return wrapper; } +FilesystemNode::FilesystemNode(AbstractFilesystemNode *realNode) { + _realNode = realNode; + _refCount = new int(1); +} FilesystemNode::FilesystemNode() { _realNode = getRoot(); @@ -56,7 +59,7 @@ FilesystemNode::FilesystemNode(const FilesystemNode &node) ++(*_refCount); } -FilesystemNode::FilesystemNode(const String &p) { +FilesystemNode::FilesystemNode(const Common::String &p) { _realNode = getNodeForPath(p); _refCount = new int(1); } @@ -92,3 +95,23 @@ FilesystemNode FilesystemNode::getParent() const { return AbstractFilesystemNode::wrap(node); } } + +Common::String FilesystemNode::displayName() const { + return _realNode->displayName(); +} + +bool FilesystemNode::isValid() const { + return _realNode->isValid(); +} + +bool FilesystemNode::isDirectory() const { + return _realNode->isDirectory(); +} + +Common::String FilesystemNode::path() const { + return _realNode->path(); +} + +FSList FilesystemNode::listDir(ListMode mode) const { + return _realNode->listDir(mode); +} diff --git a/backends/fs/fs.h b/backends/fs/fs.h index 6ad51762ca..7005707b16 100644 --- a/backends/fs/fs.h +++ b/backends/fs/fs.h @@ -165,6 +165,8 @@ private: AbstractFilesystemNode *_realNode; int *_refCount; + FilesystemNode(AbstractFilesystemNode *realNode); + /** * Returns a special node representing the FS root. The starting point for * any file system browsing. @@ -199,12 +201,12 @@ public: FilesystemNode getParent() const; - virtual String displayName() const { return _realNode->displayName(); } - virtual bool isValid() const { return _realNode->isValid(); } - virtual bool isDirectory() const { return _realNode->isDirectory(); } - virtual String path() const { return _realNode->path(); } + virtual String displayName() const; + virtual bool isValid() const; + virtual bool isDirectory() const; + virtual String path() const; - virtual FSList listDir(ListMode mode = kListDirectoriesOnly) const { return _realNode->listDir(mode); } + virtual FSList listDir(ListMode mode = kListDirectoriesOnly) const; protected: void decRefCount(); |