diff options
author | Max Horn | 2003-10-17 12:04:44 +0000 |
---|---|---|
committer | Max Horn | 2003-10-17 12:04:44 +0000 |
commit | 79e681282e7c5e84d8d6bbd595bce455ebf4e8f1 (patch) | |
tree | fcc6e42353176d05961fec68d2ae50c9fa83f32a | |
parent | 250f2ea52b1b46cb79c7d9d0b86538eaef6f93e0 (diff) | |
download | scummvm-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
-rw-r--r-- | backends/fs/fs.h | 22 |
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 |