34 #ifndef __EST_TITERATOR_H__ 35 #define __EST_TITERATOR_H__ 73 template <
class Container,
class IPo
inter,
class Entry>
75 template <
class Container,
class IPo
inter,
class Entry>
77 template <
class Container,
class IPo
inter,
class Entry>
80 template <
class Container,
class IPo
inter,
class Entry>
108 { cont=orig.
cont; pos=orig.
pos; pointer=orig.
pointer;
return *
this;}
112 {
begin(over);
return *
this;}
116 {cont=((Container *)(
void *)&over);
beginning();}
120 {
if (cont) cont->point_to_first(pointer); pos=0;}
127 {
return cont && cont->points_to_something(pointer);}
145 {cont->move_pointer_forwards(pointer); pos++;}
149 {
next();
return *
this;}
164 {
return cont->points_at(pointer);}
172 const Entry *operator ->()
const 179 const Entry &it = cont->points_at(pointer);
180 cont->move_pointer_forwards(pointer);
186 unsigned int n()
const {
return pos; }
195 template <
class Container,
class IPo
inter,
class Entry>
212 { this->
begin(over); }
214 const Entry *operator ->()
const 218 template <
class Container,
class IPo
inter,
class Entry>
260 Entry *operator ->()
const 275 template <
class Container,
class IPo
inter,
class Entry>
292 { this->
begin(over); }
294 Entry *operator ->()
const
EST_TStructIterator()
Create an iterator not associated with any specific container.
Container * cont
The container we are looking at.
unsigned int n() const
Return the current position.
void next()
Next moves to the next entry.
EST_TRwIterator< Container, IPointer, Entry > Iter
Can't access constant containers this way.
unsigned int pos
Position in the structure. May or may not be useful.
const Entry & next_element()
Return the current element and move the pointer forwards.
EST_TIterator< Container, IPointer, Entry > Iter
Name for an iterator like this.
EST_TRwIterator(Container &over)
Create an iterator ready to run over the given container.
EST_TRwStructIterator(Container &over)
Create an iterator ready to run over the given container.
EST_TStructIterator(const Container &over)
Create an iterator ready to run over the given container.
void begin(Container &over)
Set the iterator ready to run over this container.
Entry & next_element()
Return the current element and move the pointer forwards.
EST_TRwIterator()
Create an iterator not associated with any specific container.
EST_TRwStructIterator()
Create an iterator not associated with any specific container.
const Entry & current() const
Return the element currently pointed to.
const Entry & operator*() const
The * operator returns the current element.
Entry & current() const
Return the element currently pointed to.
bool at_end() const
True when there are no more.
EST_TIterator(const Container &over)
Create an iterator ready to run over the given container.
void beginning()
Reset to the start of the container.
void begin(const Container &over)
Set the iterator ready to run over this container.
EST_TIterator()
Create an iterator not associated with any specific container.
bool has_more_elements() const
True if there are more elements to look at.
Iter & operator=(const Iter &orig)
Copy an iterator by assignment.
Iter & operator++()
The increment operator does the same as next.