00001 /******************************************************************************* 00002 * Copyright (c) 2006 International Business Machines Corporation 00003 * All rights reserved. This program and the accompanying materials 00004 * are made available under the terms of the Common Public License v1.0 00005 * which accompanies this distribution, and is available at 00006 * http://www.opensource.org/licenses/cpl1.0.php 00007 * 00008 * Contributors: 00009 * Douglas Sprague, Joel Wheeler - initial API and implementation 00010 * 00011 *****************************************************************************/ 00012 00013 #ifndef STILBLOCKITERATOR_H 00014 #define STILBLOCKITERATOR_H 00015 00016 #include "stilcom.h" 00017 #include <list> 00018 00019 class STILBlock; 00020 class STILEntity; 00021 00022 //--------------------------------------------------------------------------- 00030 //--------------------------------------------------------------------------- 00031 class STILBlockIterator { 00032 00033 // - Public members 00034 public: 00035 00036 // - Default Constructor 00037 STILBlockIterator(); 00038 00039 // - Copy Constructor 00040 STILBlockIterator(const STILBlockIterator &); 00041 00042 // - Construct given a STILBlock object to iterate over 00043 STILBlockIterator(STILBlock &); 00044 00045 // - Destructor 00046 virtual ~STILBlockIterator(); 00047 00048 // - Iterate to the next entry. 00049 STILBlockIterator & operator=(const STILBlockIterator &); 00050 00051 // - Iterate to the next entry. 00052 void operator++(int); 00053 void next(); 00054 00055 // - De-reference this iterator 00056 STILEntity & operator*() const; 00057 STILEntity & asEntity() const; 00058 00059 // - Initialize this STILBlockIterator object. 00060 void init(); 00061 00062 // - Is this iterator at a valid entry 00063 bool isValid() const; 00064 00065 // Private members 00066 private: 00067 00068 STILBlock * m_pBlock; // ptr to block that owns list 00069 std::list<STILEntity *> * m_pList; // ptr to list 00070 std::list<STILEntity *>::iterator m_listIterator; // list iterator 00071 bool m_isValid; // is iterator valid 00072 00073 }; // end STILBlockIterator class 00074 00075 00076 // Inline functions 00077 //-------------------------------------------------------------------------- 00085 //-------------------------------------------------------------------------- 00086 inline bool STILBlockIterator::isValid() const { return m_isValid; } 00087 00088 #endif