HTMLAttributeList.h
Go to the documentation of this file.
1/* -*-mode:c++; c-file-style: "gnu";-*- */
2/*
3 * $Id: HTMLAttributeList.h,v 1.8 2014/04/23 20:55:05 sebdiaz Exp $
4 *
5 * Copyright (C) 1996 - 2004 Stephen F. Booth <sbooth@gnu.org>
6 * 2007 Sebastien DIAZ <sebastien.diaz@gmail.com>
7 * Part of the GNU cgicc library, http://www.gnu.org/software/cgicc
8 *
9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public
11 * License as published by the Free Software Foundation; either
12 * version 3 of the License, or (at your option) any later version.
13 *
14 * This library is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
18 *
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with this library; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
22 */
23
24#ifndef _HTMLATTRIBUTELIST_H_
25#define _HTMLATTRIBUTELIST_H_ 1
26
27#ifdef __GNUG__
28# pragma interface
29#endif
30
37#include <string>
38#include <iostream>
39#include <vector>
40
41#include "CgiDefs.h"
42#include "MStreamable.h"
43#include "HTMLAttribute.h"
44
45 namespace cgicc {
46
47 // ============================================================
48 // Class HTMLAttributeList
49 // ============================================================
50
51#ifdef WIN32
52 template class CGICC_API std::vector<HTMLAttribute>;
53#endif
54
69 class CGICC_API HTMLAttributeList
70 {
71 public:
72
73 // ============================================================
74
77
83 HTMLAttributeList();
84
91 HTMLAttributeList(const HTMLAttribute& head);
92
99 HTMLAttributeList(const HTMLAttributeList& list);
100
106 ~HTMLAttributeList();
108
109
110 // ============================================================
111
114
121 HTMLAttributeList&
122 operator= (const HTMLAttributeList &list);
124
125
126 // ============================================================
127
132
140 HTMLAttributeList&
141 set(const std::string& name);
142
151 HTMLAttributeList&
152 set(const std::string& name,
153 const std::string& value);
155
158
165 void
166 render(std::ostream& out) const;
168
169 private:
170 std::vector<HTMLAttribute> fAttributes;
171 };
172
173 // ============================================================
174 // List manipulators
175 // ============================================================
176
188 inline HTMLAttributeList
189 set(const std::string& name)
190 { return HTMLAttributeList(HTMLAttribute(name)); }
191
204 inline HTMLAttributeList
205 set(const std::string& name,
206 const std::string& value)
207 { return HTMLAttributeList(HTMLAttribute(name, value)); }
208
209} // namespace cgicc
210
211#endif /* ! _HTMLATTRIBUTES_H_ */
CgiDefs.h
Platform and operating system specific macro definitions.
HTMLAttribute.h
Class dealing with HTML element attributes.
MStreamable.h
Abstract base class for all streamable objects.
cgicc::HTMLAttributeList
An expandable list of HTMLAttribute objects.
Definition: HTMLAttributeList.h:70
cgicc::HTMLAttributeList::HTMLAttributeList
HTMLAttributeList(const HTMLAttributeList &list)
Copy constructor.
cgicc::HTMLAttributeList::set
HTMLAttributeList & set(const std::string &name, const std::string &value)
Add a HTMLAttribute to this list.
cgicc::HTMLAttributeList::set
HTMLAttributeList & set(const std::string &name)
Add an atomic HTMLAttribute to this list.
cgicc::HTMLAttributeList::~HTMLAttributeList
~HTMLAttributeList()
Destructor.
cgicc::HTMLAttributeList::HTMLAttributeList
HTMLAttributeList()
Create an empty HTMLAttributeList.
cgicc::HTMLAttributeList::HTMLAttributeList
HTMLAttributeList(const HTMLAttribute &head)
Create a new HTMLAttributeList, specifying the first element.
cgicc::HTMLAttributeList::render
void render(std::ostream &out) const
Render this HTMLAttributeList to an ostream.
cgicc::HTMLAttribute
Class representing a name or a single name/value pair.
Definition: HTMLAttribute.h:72
cgicc
The namespace containing the cgicc library.
Definition: Cgicc.h:52
cgicc::set
HTMLAttributeList set(const std::string &name)
Create a new HTMLAttributeList, and set an HTMLAttribute.
Definition: HTMLAttributeList.h:189