htmlattrib.h
Go to the documentation of this file.
1 /******************************************************************************
2  *
3  *
4  *
5  * Copyright (C) 1997-2015 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 #include <qcstring.h>
19 #include <qlist.h>
20 
21 /*! A Html option. A name, value pair */
22 struct HtmlAttrib
23 {
26 };
27 
28 /*! @brief A list of Html attributes.
29  *
30  * The Html attributes are deeply copied into the list.
31  */
32 class HtmlAttribList : public QList<HtmlAttrib>
33 {
34  public:
35  HtmlAttribList() : QList<HtmlAttrib>() { setAutoDelete(TRUE); }
38  { operator=(l); }
40  { clear(); QList<HtmlAttrib>::operator=(l); return *this; }
41  QCString find(const QCString name) const
42  {
43  QListIterator<HtmlAttrib> it(*this);
45  HtmlAttrib *attr;
46  for (;(attr=it.current());++it)
47  {
48  if (attr->name==name) return attr->value;
49  }
50  return result;
51  }
53  {
54  QListIterator<HtmlAttrib> it(*this);
56  HtmlAttrib *attr;
57  for (;(attr=it.current());++it)
58  {
59  result+=" "+attr->name+"=\""+attr->value+"\"";
60  }
61  return result;
62  }
63  private:
65  { return new HtmlAttrib(*v); }
66  void deleteValue(HtmlAttrib *v) const
67  { delete v; }
68 };
69 
70 /*! @brief Html attribute list iterator */
71 class HtmlAttribListIterator : public QListIterator<HtmlAttrib>
72 {
73  public:
75 };
76 
77 #endif
78 
HtmlAttribListIterator(const HtmlAttribList &l)
Definition: htmlattrib.h:74
static QCString result
QCString toString() const
Definition: htmlattrib.h:52
HtmlAttribList(const HtmlAttribList &l)
Definition: htmlattrib.h:37
static QStrList * l
Definition: config.cpp:1044
HtmlAttrib * newValue(HtmlAttrib *v) const
Definition: htmlattrib.h:64
QCString value
Definition: htmlattrib.h:25
Html attribute list iterator.
Definition: htmlattrib.h:71
type * current() const
Definition: qlist.h:146
QList< type > & operator=(const QList< type > &l)
Definition: qlist.h:60
void deleteValue(HtmlAttrib *v) const
Definition: htmlattrib.h:66
HtmlAttribList & operator=(const HtmlAttribList &l)
Definition: htmlattrib.h:39
QCString find(const QCString name) const
Definition: htmlattrib.h:41
vector< vector< double > > clear
QCString name
Definition: htmlattrib.h:24
A list of Html attributes.
Definition: htmlattrib.h:32
const bool TRUE
Definition: qglobal.h:371
Definition: qlist.h:54