//===========================================================================// // File: iterator.cc // // Project: MUNGA Brick: Connection Library // // Contents: Implementation details of base iterator // //---------------------------------------------------------------------------// // Date Who Modification // // -------- --- ---------------------------------------------------------- // // 10/08/94 ECH Initial coding. // // 10/20/94 JMA Fixed style stuff. // // 10/23/94 ECH Added Begin, End, Forward, Backward style iteration // // methods // // 10/23/94 ECH Added higher level of deletion safety // // 10/28/94 JMA Made compatible with SGI CC // // 11/03/94 ECH Made compatible with BC4.0 // // 11/05/94 JMA Made compatible with GNU C++ // // 01/04/95 ECH Added base methods for some iterator methods // //---------------------------------------------------------------------------// // Copyright (C) 1994-1995, Virtual World Entertainment, Inc. // // All Rights reserved worldwide // // This unpublished sourcecode is PROPRIETARY and CONFIDENTIAL // //===========================================================================// #include #pragma hdrstop #if !defined(ITERATOR_HPP) #include #endif // //############################################################################# //############################################################################# // 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; }