listepara.cpp
1/*
2** A program to convert the XML rendered by KWord into LATEX.
3**
4** Copyright (C) 2000 Robert JACOLIN
5**
6** This library is free software; you can redistribute it and/or
7** modify it under the terms of the GNU Library General Public
8** License as published by the Free Software Foundation; either
9** version 2 of the License, or (at your option) any later version.
10**
11** This library is distributed in the hope that it will be useful,
12** but WITHOUT ANY WARRANTY; without even the implied warranty of
13** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14** Library General Public License for more details.
15**
16** To receive a copy of the GNU Library General Public License, write to the
17** Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 * Boston, MA 02110-1301, USA.
19**
20*/
21
22#include <stdlib.h> /* for atoi function */
23#include <kdebug.h> /* for kdDebug() stream */
24#include "listepara.h"
25
26ListPara::ListPara()
27{
28 kdDebug(30522) << "Create liste para empty" << endl;
29 _start = 0;
30 _end = 0;
31 _size = 0;
32}
33
34ListPara::~ListPara()
35{
36 kdDebug(30522) << "Destruction of a list of parag" << endl;
37 vider();
38 kdDebug(30522) << "ok" << endl;
39}
40
41void ListPara::initialiser(Para *elt)
42{
43 kdDebug(30522) << "initialise a list of parag at " << elt << endl;
44 _end = _start = elt;
45}
46
47void ListPara::add(Para *elt)
48{
49 if(_start == 0)
50 {
51 initialiser(elt);
52 _size = 1;
53 }
54 else
55 {
56 kdDebug(30522) << "add a parag." << endl;
57 _end->setNext(elt);
58 elt->setPrevious(_end);
59 _end = elt;
60 _size = _size + 1;
61 }
62}
63
64void ListPara::rem()
65{
66 Para *first_saved = 0;
67
68 first_saved = _start;
69 _start = _start->getNext();
70 delete first_saved;
71 _size = _size - 1;
72}
73
74void ListPara::vider()
75{
76 while(_start != 0)
77 {
78 rem();
79 }
80}
81
This class hold a real paragraph.
Definition para.h:59