filters

listelement.h
1
2/*
3** Header file for inclusion with kword_xml2latex.c
4**
5** Copyright (C) 2000 Robert JACOLIN
6**
7** This library is free software; you can redistribute it and/or
8** modify it under the terms of the GNU Library General Public
9** License as published by the Free Software Foundation; either
10** version 2 of the License, or (at your option) any later version.
11**
12** This library is distributed in the hope that it will be useful,
13** but WITHOUT ANY WARRANTY; without even the implied warranty of
14** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15** Library General Public License for more details.
16**
17** To receive a copy of the GNU Library General Public License, write to the
18** Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 * Boston, MA 02110-1301, USA.
20**
21*/
22
23#ifndef __KWORD_LISTELEMENT_H__
24#define __KWORD_LISTELEMENT_H__
25
26#include "element.h"
27
28class ListElement
29{
30 Element *_start, *_end;
31 int _size;
32
33 public:
34 ListElement();
35 virtual ~ListElement();
36
37 void initialiser(Element*);
38 void add(Element*);
39 Element* getFirst() const { return _start; }
40 Element* getLast() const { return _end; }
41 int getSize() const { return _size; }
42
43 private:
44};
45
46class ElementIter {
47 Element *_courant;
48
49 protected:
50
51 public:
56
57 ElementIter() { _courant = 0; }
59 ElementIter(ListElement &l) { _courant = l.getFirst(); }
61 ElementIter(ListElement *l) {
62 if(l != 0)
63 _courant = l->getFirst();
64 else
65 _courant = 0;
66 }
68
73
74 virtual ~ElementIter() { }
76
81
82 Element* getCourant() const { return _courant; }
83 bool isTerminate() const { return (_courant == 0); }
85
90 void next() { _courant = _courant->getNext(); }
91 void setList(ListElement *l) { _courant = l->getFirst(); }
92 void setList(ListElement l) { _courant = l.getFirst(); }
94
99
100
104
106
107};
108#endif /* __KWORD_LISTELEMENT_H__ */