aboutsummaryrefslogtreecommitdiff
path: root/backends
diff options
context:
space:
mode:
authorMax Horn2003-10-17 12:04:44 +0000
committerMax Horn2003-10-17 12:04:44 +0000
commit79e681282e7c5e84d8d6bbd595bce455ebf4e8f1 (patch)
treefcc6e42353176d05961fec68d2ae50c9fa83f32a /backends
parent250f2ea52b1b46cb79c7d9d0b86538eaef6f93e0 (diff)
downloadscummvm-rg350-79e681282e7c5e84d8d6bbd595bce455ebf4e8f1.tar.gz
scummvm-rg350-79e681282e7c5e84d8d6bbd595bce455ebf4e8f1.tar.bz2
scummvm-rg350-79e681282e7c5e84d8d6bbd595bce455ebf4e8f1.zip
needed some more work to get Iterators to work in FSList
svn-id: r10857
Diffstat (limited to 'backends')
-rw-r--r--backends/fs/fs.h22
1 files changed, 21 insertions, 1 deletions
diff --git a/backends/fs/fs.h b/backends/fs/fs.h
index e849a57f10..e3f0c809de 100644
--- a/backends/fs/fs.h
+++ b/backends/fs/fs.h
@@ -146,8 +146,19 @@ public:
/*
* A sorted list of multiple file system nodes. E.g. the contents of a given directory.
*/
-class FSList : public Common::List<FilesystemNode *> {
+class FSList : Common::List<FilesystemNode *> {
public:
+ class ConstIterator {
+ friend class FSList;
+ FilesystemNode **_data;
+ ConstIterator(FilesystemNode **data) : _data(data) { }
+ public:
+ const FilesystemNode &operator *() const { return **_data; }
+ const FilesystemNode *operator->() const { return *_data; }
+ bool operator !=(const ConstIterator &iter) const { return _data != iter._data; }
+ void operator ++() { ++_data; }
+ };
+
~FSList() {
for (int i = 0; i < _size; i++)
delete _data[i];
@@ -172,6 +183,15 @@ public:
}
int size() const { return _size; }
+
+ ConstIterator begin() const {
+ return ConstIterator(_data);
+ }
+
+ ConstIterator end() const {
+ return ConstIterator(_data + _size);
+ }
+
};
#endif