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 STILBLOCKCONSTITER_H 00014 #define STILBLOCKCONSTITER_H 00015 00016 #include "stilcom.h" 00017 #include <list> 00018 00019 class STILBlock; 00020 class STILEntity; 00021 00022 //--------------------------------------------------------------------------- 00029 //--------------------------------------------------------------------------- 00030 class STILBlockConstIterator { 00031 00032 // - Public members 00033 public: 00034 00035 // - Default Constructor 00036 STILBlockConstIterator(); 00037 00038 // - Copy Constructor 00039 STILBlockConstIterator(const STILBlockConstIterator &); 00040 00041 // - Construct given a STILBlock object to iterate over 00042 STILBlockConstIterator(const STILBlock &); 00043 00044 // - Destructor 00045 virtual ~STILBlockConstIterator(); 00046 00047 // - Iterate to the next entry. 00048 const STILBlockConstIterator & operator=(const STILBlockConstIterator &); 00049 00050 // - Iterate to the next entry. 00051 void operator++(int); 00052 void next(); 00053 00054 // - De-reference this iterator 00055 const STILEntity & operator*() const; 00056 const STILEntity & asEntity() const; 00057 00058 // - Initialize this STILBlockConstIterator object. 00059 void init(); 00060 00061 // - Is this iterator at a valid entry 00062 bool isValid() const; 00063 00064 // Private members 00065 private: 00066 00067 const STILBlock * m_pBlock; // ptr to block that owns list 00068 std::list<STILEntity *> const* m_pList; // ptr to list 00069 std::list<STILEntity *>::const_iterator m_listIterator;// list iterator 00070 bool m_isValid; // is iterator valid 00071 00072 }; // end STILBlockConstIterator class 00073 00074 00075 // Inline functions 00076 //-------------------------------------------------------------------------- 00084 //-------------------------------------------------------------------------- 00085 inline bool STILBlockConstIterator::isValid() const { return m_isValid; } 00086 00087 00088 #endif