![]() |
Dragonfly 2.2
A text-based game engine
|
00001 /// 00002 /// An iterator for ObjectLists 00003 /// 00004 00005 #ifndef __OBJECT_LIST_ITERATOR_H__ 00006 #define __OBJECT_LIST_ITERATOR_H__ 00007 00008 #include "ObjectList.h" 00009 00010 class ObjectList; 00011 00012 class ObjectListIterator { 00013 00014 private: 00015 ObjectListIterator(); ///< Iterator must be given list when created. 00016 00017 protected: 00018 int index; ///< Index into list. 00019 const ObjectList *p_list; ///< List iterating over. 00020 00021 public: 00022 ~ObjectListIterator(); 00023 00024 /// Create iterator, over indicated list. 00025 ObjectListIterator(const ObjectList *p_l); 00026 00027 void first(); ///< Set iterator to first item in list. 00028 void next(); ///< Set iterator to next item in list. 00029 bool isDone(); ///< Return true if at end of list. 00030 00031 /// Return pointer to current item in list, NULL if done/empty. 00032 Object *currentObject(); 00033 }; 00034 00035 #endif // __OBJECT_LIST_ITERATOR_H__