Dragonfly 4.20
A text-based game engine
ObjectListIterator.h
1///
2/// An iterator for ObjectLists
3///
4
5#ifndef __OBJECT_LIST_ITERATOR_H__
6#define __OBJECT_LIST_ITERATOR_H__
7
8#include "Object.h"
9#include "ObjectList.h"
10
11namespace df {
12
13class ObjectList;
14
16
17 private:
18 ObjectListIterator(); ///< Iterator must be given list when created.
19 int m_index; ///< Index into list.
20 const ObjectList *m_p_list; ///< List iterating over.
21
22 public:
23 /// Create iterator, over indicated list.
25
26 /// Set iterator to first item in list.
27 void first();
28
29 /// Reset to last object in list.
30 void last();
31
32 /// Set iterator to next item in list.
33 void next();
34
35 /// Return true if at end of list.
36 bool isDone() const;
37
38 /// Return pointer to current item in list, NULL if done/empty.
40
41 /// Assignment operator.
43
44 /// Set to new List.
45 void setList(const ObjectList *p_list);
46};
47
48} // end of namespace df
49#endif // __OBJECT_LIST_ITERATOR_H__
Definition: ObjectListIterator.h:15
bool isDone() const
Return true if at end of list.
void first()
Set iterator to first item in list.
void next()
Set iterator to next item in list.
ObjectListIterator()
Iterator must be given list when created.
Object * currentObject() const
Return pointer to current item in list, NULL if done/empty.
int m_index
Index into list.
Definition: ObjectListIterator.h:19
ObjectListIterator(const ObjectList *p_list)
Create iterator, over indicated list.
ObjectListIterator & operator=(const ObjectListIterator &rhs)
Assignment operator.
void setList(const ObjectList *p_list)
Set to new List.
const ObjectList * m_p_list
List iterating over.
Definition: ObjectListIterator.h:20
void last()
Reset to last object in list.
Definition: ObjectList.h:15
Definition: Object.h:57
An animation for a sprite.
Definition: Animation.h:15