34 #ifndef __EST_TITERATOR_H__
35 #define __EST_TITERATOR_H__
75 template <
class Container,
class IPo
inter,
class Entry>
77 template <
class Container,
class IPo
inter,
class Entry>
79 template <
class Container,
class IPo
inter,
class Entry>
82 template <
class Container,
class IPo
inter,
class Entry>
110 { cont=orig.
cont; pos=orig.
pos; pointer=orig.
pointer;
return *
this;}
114 {
begin(over);
return *
this;}
118 {cont=((Container *)(
void *)&over);
beginning();}
122 {
if (cont) cont->point_to_first(pointer); pos=0;}
129 {
return cont && cont->points_to_something(pointer);}
147 {cont->move_pointer_forwards(pointer); pos++;}
151 {
next();
return *
this;}
166 {
return cont->points_at(pointer);}
174 const Entry *operator ->()
const
181 const Entry &it = cont->points_at(pointer);
182 cont->move_pointer_forwards(pointer);
188 unsigned int n()
const {
return pos; }
200 template <
class Container,
class IPo
inter,
class Entry>
217 { this->
begin(over); }
219 const Entry *operator ->()
const
223 template <
class Container,
class IPo
inter,
class Entry>
265 Entry *operator ->()
const
280 template <
class Container,
class IPo
inter,
class Entry>
297 { this->
begin(over); }
299 Entry *operator ->()
const
Entry & next_element()
Return the current element and move the pointer forwards.
const Entry & operator*() const
The * operator returns the current element.
Iter & operator=(const Iter &orig)
Copy an iterator by assignment.
Container * cont
The container we are looking at.
void next()
Next moves to the next entry.
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.
unsigned int n() const
Return the current position.
Entry & current() const
Return the element currently pointed to.
Iter & operator=(const Iter &orig)
Copy an iterator by assignment.
bool at_end() const
True when there are no more.
EST_TRwStructIterator()
Create an iterator not associated with any specific container.
EST_TRwStructIterator(Container &over)
Create an iterator ready to run over the given container.
EST_TIterator(const Container &over)
Create an iterator ready to run over the given container.
const Entry & current() const
Return the element currently pointed to.
Entry & operator*() const
The * operator returns the current element.
void beginning()
Reset to the start of the container.
void begin(const Container &over)
Set the iterator ready to run over this container.
EST_TRwIterator(Container &over)
Create an iterator ready to run over the given container.
EST_TIterator()
Create an iterator not associated with any specific container.
EST_TRwIterator()
Create an iterator not associated with any specific container.
Iter & operator=(const Iter &orig)
Copy an iterator by assignment.
EST_TStructIterator(const Container &over)
Create an iterator ready to run over the given container.
Iter & operator++()
The increment operator does the same as next.
EST_TRwIterator< Container, IPointer, Entry > Iter
Can't access constant containers this way.
void begin(Container &over)
Set the iterator ready to run over this container.
EST_TStructIterator()
Create an iterator not associated with any specific container.
Iter & operator=(const Iter &orig)
Copy an iterator by assignment.
bool has_more_elements() const
True if there are more elements to look at.