[Scummvm-cvs-logs] CVS: scummvm/backends/fs fs.h,1.9,1.10
Max Horn
fingolfin at users.sourceforge.net
Fri Oct 17 05:07:01 CEST 2003
Update of /cvsroot/scummvm/scummvm/backends/fs
In directory sc8-pr-cvs1:/tmp/cvs-serv14394/backends/fs
Modified Files:
fs.h
Log Message:
needed some more work to get Iterators to work in FSList
Index: fs.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/backends/fs/fs.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- fs.h 17 Oct 2003 10:22:40 -0000 1.9
+++ fs.h 17 Oct 2003 12:04:44 -0000 1.10
@@ -146,8 +146,19 @@
/*
* 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 @@
}
int size() const { return _size; }
+
+ ConstIterator begin() const {
+ return ConstIterator(_data);
+ }
+
+ ConstIterator end() const {
+ return ConstIterator(_data + _size);
+ }
+
};
#endif
More information about the Scummvm-git-logs
mailing list