My Project
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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 
22 struct HtmlAttrib
23 {
24  QCString name;
25  QCString value;
26 };
27 
32 class HtmlAttribList : public QList<HtmlAttrib>
33 {
34  public:
35  HtmlAttribList() : QList<HtmlAttrib>() { setAutoDelete(TRUE); }
36  ~HtmlAttribList() { clear(); }
38  { operator=(l); }
40  { clear(); QList<HtmlAttrib>::operator=(l); return *this; }
41  QCString find(const QCString name) const
42  {
43  QListIterator<HtmlAttrib> it(*this);
44  QCString result;
45  HtmlAttrib *attr;
46  for (;(attr=it.current());++it)
47  {
48  if (attr->name==name) return attr->value;
49  }
50  return result;
51  }
52  QCString toString() const
53  {
54  QListIterator<HtmlAttrib> it(*this);
55  QCString result;
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 
71 class HtmlAttribListIterator : public QListIterator<HtmlAttrib>
72 {
73  public:
74  HtmlAttribListIterator(const HtmlAttribList &l) : QListIterator<HtmlAttrib>(l) {}
75 };
76 
77 #endif
78