filters
listelement.h
00001 00002 /* 00003 ** Header file for inclusion with kword_xml2latex.c 00004 ** 00005 ** Copyright (C) 2000 Robert JACOLIN 00006 ** 00007 ** This library is free software; you can redistribute it and/or 00008 ** modify it under the terms of the GNU Library General Public 00009 ** License as published by the Free Software Foundation; either 00010 ** version 2 of the License, or (at your option) any later version. 00011 ** 00012 ** This library is distributed in the hope that it will be useful, 00013 ** but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00015 ** Library General Public License for more details. 00016 ** 00017 ** To receive a copy of the GNU Library General Public License, write to the 00018 ** Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00019 * Boston, MA 02110-1301, USA. 00020 ** 00021 */ 00022 00023 #ifndef __KWORD_LISTELEMENT_H__ 00024 #define __KWORD_LISTELEMENT_H__ 00025 00026 #include "element.h" 00027 00028 class ListElement 00029 { 00030 Element *_start, *_end; 00031 int _size; 00032 00033 public: 00034 ListElement(); 00035 virtual ~ListElement(); 00036 00037 void initialiser(Element*); 00038 void add(Element*); 00039 Element* getFirst() const { return _start; } 00040 Element* getLast() const { return _end; } 00041 int getSize() const { return _size; } 00042 00043 private: 00044 }; 00045 00046 class ElementIter { 00047 Element *_courant; 00048 00049 protected: 00050 00051 public: 00056 00057 ElementIter() { _courant = 0; } 00059 ElementIter(ListElement &l) { _courant = l.getFirst(); } 00061 ElementIter(ListElement *l) { 00062 if(l != 0) 00063 _courant = l->getFirst(); 00064 else 00065 _courant = 0; 00066 } 00068 00073 00074 virtual ~ElementIter() { } 00076 00081 00082 Element* getCourant() const { return _courant; } 00083 bool isTerminate() const { return (_courant == 0); } 00085 00090 void next() { _courant = _courant->getNext(); } 00091 void setList(ListElement *l) { _courant = l->getFirst(); } 00092 void setList(ListElement l) { _courant = l.getFirst(); } 00094 00099 00100 00104 00106 00107 }; 00108 #endif /* __KWORD_LISTELEMENT_H__ */