htmlattrib.h

Go to the documentation of this file.
00001 /******************************************************************************
00002  *
00003  * $Id: htmlattrib.h,v 1.2 2001/01/01 10:15:18 root Exp $
00004  *
00005  * Copyright (C) 1997-2008 by Dimitri van Heesch.
00006  *
00007  * Permission to use, copy, modify, and distribute this software and its
00008  * documentation under the terms of the GNU General Public License is hereby 
00009  * granted. No representations are made about the suitability of this software 
00010  * for any purpose. It is provided "as is" without express or implied warranty.
00011  * See the GNU General Public License for more details.
00012  *
00013  */
00014 
00015 #ifndef _HTMLATTRIB_H
00016 #define _HTMLATTRIB_H
00017 
00019 struct HtmlAttrib
00020 {
00021   QString name;
00022   QString value;
00023 };
00024 
00029 class HtmlAttribList : public QList<HtmlAttrib>
00030 {
00031   public:
00032     HtmlAttribList() : QList<HtmlAttrib>() { setAutoDelete(TRUE); }
00033    ~HtmlAttribList() { clear(); }
00034     HtmlAttribList(const HtmlAttribList &l) : QList<HtmlAttrib>() 
00035     { operator=(l); }
00036     HtmlAttribList &operator=(const HtmlAttribList &l)
00037     { clear(); QList<HtmlAttrib>::operator=(l); return *this; }
00038     QString toString() const
00039     {
00040       HtmlAttribList *that = (HtmlAttribList *)this;
00041       QString result;
00042       HtmlAttrib *attr=that->first();
00043       while (attr)
00044       {
00045         result+=" "+attr->name+"=\""+attr->value+"\"";
00046         attr=that->next();
00047       }
00048       return result;
00049     }
00050   private:
00051     QCollection::Item newItem( QCollection::Item d ) 
00052     { return (QCollection::Item)new HtmlAttrib(*(HtmlAttrib *)d); }
00053     void deleteItem(QCollection::Item d) 
00054     { delete (HtmlAttrib *)d; }
00055 };
00056 
00058 class HtmlAttribListIterator : public QListIterator<HtmlAttrib>
00059 {
00060   public:
00061     HtmlAttribListIterator(const HtmlAttribList &l) : QListIterator<HtmlAttrib>(l) {}
00062 };
00063 
00064 #endif
00065 



Generated on Mon Mar 31 10:58:38 2008 by  doxygen 1.5.1