#include "munga.h" #pragma hdrstop #include "iterator.h" // //############################################################################# //############################################################################# // Iterator::Iterator() { } // //############################################################################# //############################################################################# // Iterator::~Iterator() { } // //############################################################################# //############################################################################# // Logical Iterator::TestInstance() const { return True; } // //########################################################################### // First //########################################################################### // void Iterator::First() { Fail("Iterator::First - Should never reach here"); } // //########################################################################### // Last //########################################################################### // void Iterator::Last() { Fail("Iterator::Last - Should never reach here"); } // //########################################################################### // Next //########################################################################### // void Iterator::Next() { Fail("Iterator::Next - Should never reach here"); } // //########################################################################### // Previous //########################################################################### // void Iterator::Previous() { Fail("Iterator::Previous - Should never reach here"); } // //########################################################################### // GetSize //########################################################################### // CollectionSize Iterator::GetSize() { Fail("Iterator::GetSize - Should never reach here"); return 0; } // //########################################################################### // ReadAndNextImplementation //########################################################################### // void *Iterator::ReadAndNextImplementation() { void *item; if ((item = GetCurrentImplementation()) != NULL) { Next(); } return item; } // //########################################################################### // ReadAndPreviousImplementation //########################################################################### // void *Iterator::ReadAndPreviousImplementation() { void *item; if ((item = GetCurrentImplementation()) != NULL) { Previous(); } return item; } // //########################################################################### // GetCurrentImplementation //########################################################################### // void* Iterator::GetCurrentImplementation() { Fail("Iterator::GetCurrentImplementation - Should never reach here"); return NULL; } // //########################################################################### // GetNthImplementation //########################################################################### // void *Iterator::GetNthImplementation(CollectionSize index) { CollectionSize i = 0; void *item; First(); while ((item = GetCurrentImplementation()) != NULL) { if (i == index) return item; Next(); i++; } return NULL; }