Experimental Code
Code Written To Experiment With Various Techniques And Otherwise Not Very Useful...
|
Iterator class that works genericly on a List containing Node elements with data of type T. More...
#include <Iterator.h>
Public Member Functions | |
~Iterator () | |
Destroy iterator. More... | |
Iterator (List *theList, Node *at) | |
Create Iterator for theList at the value of at. More... | |
Iterator (const Iterator &rhs) | |
Create Iterator at the same position of the same list as rhs. More... | |
Iterator & | operator= (const Iterator &rhs) |
Update Iterator to be at the same position of the same list as rhs. More... | |
bool | operator== (const Iterator &rhs) const |
bool | operator!= (const Iterator &rhs) const |
Iterator & | operator++ () |
Advance this iterator one position and return this iterator. More... | |
Iterator | operator++ (int) |
Advance this iterator one position and return a temporary iterator at the original position. More... | |
Iterator & | operator+= (int positions) |
Advance this iterator positions, if possible, and return this iterator. More... | |
Iterator | operator+ (int positions) |
Iterator & | operator-- () |
Decrement this iterator one position and return this iterator. More... | |
Iterator | operator-- (int) |
Decrement this iterator one position and return a temporary iterator at the original position. More... | |
Iterator & | operator-= (int positions) |
Decrement this iterator positions, if possible, and return this iterator. More... | |
Iterator | operator- (int positions) |
void | swapWith (Iterator &other) |
Swap the values at this and other iterators. More... | |
void | moveBefore (Iterator &other) |
Move the value at this itherator before the value at other. More... | |
T & | operator* () |
T * | operator-> () |
void | swapOccurred (Node *a, Node *b) |
Update this iterator, if appropriate, that the values at a and b swapped positions. More... | |
void | insertedBefore (Node *after, int count) |
Update this iterator, if appropriate, that count positions were added before after. More... | |
void | removedBefore (Node *after, int count) |
Update this iterator, if appropriate, that count positions were removed before after. More... | |
Iterator class that works genericly on a List containing Node elements with data of type T.
These are created by the lists themselves.
T | the type of data held by the Nodes |
List | the type of list this iterates |
Node | the type of Node in the list |
Definition at line 33 of file Iterator.h.
Experiment::Iterator< T, List, Node >::~Iterator |
Destroy iterator.
Definition at line 25 of file Iterator.cpp.
Experiment::Iterator< T, List, Node >::Iterator | ( | List * | theList, |
Node * | at | ||
) |
Create Iterator for theList at the value of at.
theList | to iterate |
at | start iterating from at |
Definition at line 36 of file Iterator.cpp.
Experiment::Iterator< T, List, Node >::Iterator | ( | const Iterator< T, List, Node > & | rhs | ) |
Create Iterator at the same position of the same list as rhs.
rhs | to create at the same position of the same list as |
Definition at line 47 of file Iterator.cpp.
void Experiment::Iterator< T, List, Node >::insertedBefore | ( | Node * | after, |
int | count | ||
) |
Update this iterator, if appropriate, that count positions were added before after.
count | of items inserted before after |
after | node that has had count items added before it |
Definition at line 270 of file Iterator.cpp.
void Experiment::Iterator< T, List, Node >::moveBefore | ( | Iterator< T, List, Node > & | other | ) |
Move the value at this itherator before the value at other.
other | iterator to move the value of this iterator before |
Definition at line 208 of file Iterator.cpp.
bool Experiment::Iterator< T, List, Node >::operator!= | ( | const Iterator< T, List, Node > & | rhs | ) | const |
rhs | to compare position against |
Definition at line 86 of file Iterator.cpp.
T & Experiment::Iterator< T, List, Node >::operator* |
std::out_of_range | if this is not at a valid position |
Definition at line 227 of file Iterator.cpp.
Iterator< T, List, Node > Experiment::Iterator< T, List, Node >::operator+ | ( | int | positions | ) |
positions | to advance the returned iterator |
Definition at line 138 of file Iterator.cpp.
Iterator< T, List, Node > & Experiment::Iterator< T, List, Node >::operator++ |
Advance this iterator one position and return this iterator.
Definition at line 95 of file Iterator.cpp.
Iterator< T, List, Node > Experiment::Iterator< T, List, Node >::operator++ | ( | int | ) |
Advance this iterator one position and return a temporary iterator at the original position.
Definition at line 106 of file Iterator.cpp.
Iterator< T, List, Node > & Experiment::Iterator< T, List, Node >::operator+= | ( | int | positions | ) |
Advance this iterator positions, if possible, and return this iterator.
positions | to advance |
Definition at line 119 of file Iterator.cpp.
Iterator< T, List, Node > Experiment::Iterator< T, List, Node >::operator- | ( | int | positions | ) |
positions | to decrement the returned iterator |
Definition at line 183 of file Iterator.cpp.
Iterator< T, List, Node > & Experiment::Iterator< T, List, Node >::operator-- |
Decrement this iterator one position and return this iterator.
Definition at line 149 of file Iterator.cpp.
Iterator< T, List, Node > Experiment::Iterator< T, List, Node >::operator-- | ( | int | ) |
Decrement this iterator one position and return a temporary iterator at the original position.
Definition at line 160 of file Iterator.cpp.
Iterator< T, List, Node > & Experiment::Iterator< T, List, Node >::operator-= | ( | int | positions | ) |
Decrement this iterator positions, if possible, and return this iterator.
positions | to advance |
Definition at line 173 of file Iterator.cpp.
T * Experiment::Iterator< T, List, Node >::operator-> |
std::out_of_range | if this is not at a valid position |
Definition at line 240 of file Iterator.cpp.
Iterator< T, List, Node > & Experiment::Iterator< T, List, Node >::operator= | ( | const Iterator< T, List, Node > & | rhs | ) |
Update Iterator to be at the same position of the same list as rhs.
rhs | to update to the the same position of the same list as |
Definition at line 58 of file Iterator.cpp.
bool Experiment::Iterator< T, List, Node >::operator== | ( | const Iterator< T, List, Node > & | rhs | ) | const |
rhs | to compare position against |
Definition at line 76 of file Iterator.cpp.
void Experiment::Iterator< T, List, Node >::removedBefore | ( | Node * | after, |
int | count | ||
) |
Update this iterator, if appropriate, that count positions were removed before after.
count | of items removed before after |
after | node that has had count items removed before it |
Definition at line 285 of file Iterator.cpp.
void Experiment::Iterator< T, List, Node >::swapOccurred | ( | Node * | a, |
Node * | b | ||
) |
Update this iterator, if appropriate, that the values at a and b swapped positions.
a | Node that swapped with b |
b | Node that swapped with a |
Definition at line 253 of file Iterator.cpp.
void Experiment::Iterator< T, List, Node >::swapWith | ( | Iterator< T, List, Node > & | other | ) |
Swap the values at this and other iterators.
other | iterator to swap values with |
Definition at line 194 of file Iterator.cpp.