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
45namespace 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
84
92
100
108
109
110 // ============================================================
111
114
122 operator= (const HTMLAttributeList &list);
124
125
126 // ============================================================
127
132
141 set(const std::string& name);
142
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_ */
Platform and operating system specific macro definitions.
Class dealing with HTML element attributes.
Abstract base class for all streamable objects.
An expandable list of HTMLAttribute objects.
HTMLAttributeList(const HTMLAttributeList &list)
Copy constructor.
HTMLAttributeList & set(const std::string &name, const std::string &value)
Add a HTMLAttribute to this list.
HTMLAttributeList & set(const std::string &name)
Add an atomic HTMLAttribute to this list.
~HTMLAttributeList()
Destructor.
HTMLAttributeList()
Create an empty HTMLAttributeList.
HTMLAttributeList(const HTMLAttribute &head)
Create a new HTMLAttributeList, specifying the first element.
void render(std::ostream &out) const
Render this HTMLAttributeList to an ostream.
Class representing a name or a single name/value pair.
Definition: HTMLAttribute.h:72
The namespace containing the cgicc library.
Definition: Cgicc.h:52
HTMLAttributeList set(const std::string &name)
Create a new HTMLAttributeList, and set an HTMLAttribute.

GNU cgicc - A C++ class library for writing CGI applications
Copyright © 1996 - 2004 Stephen F. Booth
Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.1 or any later version published by the Free Software Foundation; with no Invariant Sections, with no Front Cover Texts, and with no Back-Cover Texts.
Documentation generated Fri Mar 1 2024 08:39:41 for cgicc by doxygen 1.9.6