Orb/Doxygen/src/htmlattrib.h
changeset 0 42188c7ea2d9
child 4 468f4c8d3d5b
equal deleted inserted replaced
-1:000000000000 0:42188c7ea2d9
       
     1 /******************************************************************************
       
     2  *
       
     3  * 
       
     4  *
       
     5  * Copyright (C) 1997-2008 by Dimitri van Heesch.
       
     6  *
       
     7  * Permission to use, copy, modify, and distribute this software and its
       
     8  * documentation under the terms of the GNU General Public License is hereby 
       
     9  * granted. No representations are made about the suitability of this software 
       
    10  * for any purpose. It is provided "as is" without express or implied warranty.
       
    11  * See the GNU General Public License for more details.
       
    12  *
       
    13  */
       
    14 
       
    15 #ifndef _HTMLATTRIB_H
       
    16 #define _HTMLATTRIB_H
       
    17 
       
    18 /*! A Html option. A name, value pair */
       
    19 struct HtmlAttrib
       
    20 {
       
    21   QString name;
       
    22   QString value;
       
    23 };
       
    24 
       
    25 /*! @brief A list of Html attributes. 
       
    26  *
       
    27  * The Html attributes are deeply copied into the list.
       
    28  */
       
    29 class HtmlAttribList : public QList<HtmlAttrib>
       
    30 {
       
    31   public:
       
    32     HtmlAttribList() : QList<HtmlAttrib>() { setAutoDelete(TRUE); }
       
    33    ~HtmlAttribList() { clear(); }
       
    34     HtmlAttribList(const HtmlAttribList &l) : QList<HtmlAttrib>() 
       
    35     { operator=(l); }
       
    36     HtmlAttribList &operator=(const HtmlAttribList &l)
       
    37     { clear(); QList<HtmlAttrib>::operator=(l); return *this; }
       
    38     QString toString() const
       
    39     {
       
    40       HtmlAttribList *that = (HtmlAttribList *)this;
       
    41       QString result;
       
    42       HtmlAttrib *attr=that->first();
       
    43       while (attr)
       
    44       {
       
    45         result+=" "+attr->name+"=\""+attr->value+"\"";
       
    46         attr=that->next();
       
    47       }
       
    48       return result;
       
    49     }
       
    50   private:
       
    51     QCollection::Item newItem( QCollection::Item d ) 
       
    52     { return (QCollection::Item)new HtmlAttrib(*(HtmlAttrib *)d); }
       
    53     void deleteItem(QCollection::Item d) 
       
    54     { delete (HtmlAttrib *)d; }
       
    55 };
       
    56 
       
    57 /*! @brief Html attribute list iterator */
       
    58 class HtmlAttribListIterator : public QListIterator<HtmlAttrib>
       
    59 {
       
    60   public:
       
    61     HtmlAttribListIterator(const HtmlAttribList &l) : QListIterator<HtmlAttrib>(l) {}
       
    62 };
       
    63 
       
    64 #endif
       
    65