1 /* 2 colortail -- output last part of file(s) in color. 3 Copyright (C) 2009 Joakim Andersson <ja@joakimandersson.se> 4 5 This program is free software; you can redistribute it and/or modify 6 it under the terms of the GNU General Public License as published by 7 the Free Software Foundation; either version 2 of the License, or 8 (at your option) any later version. 9 10 This program is distributed in the hope that it will be useful, 11 but WITHOUT ANY WARRANTY; without even the implied warranty of 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 GNU General Public License for more details. 14 15 You should have received a copy of the GNU General Public License 16 along with this program; if not, write to the Free Software 17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 */ 19 20 #ifndef _Iterator_h_ 21 #define _Iterator_h_ 22 23 // Based on iterator.h by Timothy A. Budd 24 25 // class Iterator 26 // defines the protocol to be used by all iterators 27 // subclasses must implement each of the five iterator methods 28 29 template <class T> class Iterator 30 { 31 public: 32 // initialization 33 virtual int init() = 0; 34 35 // test if there is a current element 36 virtual int operator !() = 0; 37 38 // current element 39 virtual T operator ()() = 0; 40 41 // find next element 42 virtual int operator ++() = 0; 43 44 // change current element 45 virtual void operator =(T newValue) = 0; 46 }; 47 48 #endif 49