filters

listeformat.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 
00024 #ifndef __KWORD_LISTEFORMAT_H__
00025 #define __KWORD_LISTEFORMAT_H__
00026 
00027 #include "format.h"
00028 
00029 class FormatElt
00030 {
00031     Format*    _format;
00032     FormatElt* _next;
00033 
00034     private:
00035 
00036     protected:
00037         
00038     public:
00043 
00044     FormatElt() { 
00045         _format = 0;
00046         _next   = 0;
00047     }
00048 
00050     FormatElt(FormatElt * eltt) {
00051         _format = eltt->getFormat();
00052         _next   = eltt->getNext();
00053     }
00055 
00060 
00061     virtual ~FormatElt();
00063 
00068     Format*    getFormat () const { return _format;  }
00069     FormatElt* getNext () const { return _next;    }
00071 
00076     void setFormat (Format*);
00077     void remFormat ();
00078     void setNext (FormatElt*);
00079     void remNext ();
00081 
00086 
00087     FormatElt& operator = (const FormatElt &);
00089 
00093 
00095 };
00096 
00097 class ListeFormat
00098 {
00099     //QString _texte;
00100 
00101     private:
00102         FormatElt* _first;
00103         FormatElt* _end;
00104         int        _size;
00105 
00106     protected:
00107         
00108     public:
00113 
00114     ListeFormat();
00116 
00121     virtual ~ListeFormat();
00123 
00128     Format*    getFirst   () const { return _first->getFormat(); }
00129     FormatElt* getFirstElt() const { return _first;              }
00130     Format*    getLast    () const { return _end->getFormat();   }
00131     bool       isVide     () const { return (_size == 0);        }
00132     int        getSize    () const { return _size;               }
00134 
00139     void addLast (Format*);
00140     void addFirst(Format*);
00141     void remLast ();
00142     void remFirst();
00143     
00145 
00150 
00151 
00155     void vider();         /* Empty the list */
00156 
00158 };
00159 
00160 class FormatIter {
00161     FormatElt *_courant;
00162     
00163     protected:
00164     
00165     public:
00170 
00171     FormatIter()                 { _courant = 0;                }
00173     FormatIter(ListeFormat& l) { _courant = l.getFirstElt();  }
00175     FormatIter(ListeFormat*);
00177 
00182 
00183     virtual ~FormatIter() { }
00185 
00190 
00191     Format* getCourant()  const { return _courant->getFormat(); }
00192     bool    isTerminate() const { return (_courant == 0);     }
00194 
00199     void next   ()               { _courant = _courant->getNext(); }
00200     void setList(ListeFormat* l) { _courant = l->getFirstElt();     }
00202 
00207 
00208 
00212 
00214 
00215 };
00216 
00217 #endif /* __KWORD_LISTEFORMAT_H__ */
00218 
KDE Home | KDE Accessibility Home | Description of Access Keys