Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
cgicc
HTMLElement.h
Go to the documentation of this file.
1
/* -*-mode:c++; c-file-style: "gnu";-*- */
2
/*
3
* $Id: HTMLElement.h,v 1.8 2007/07/02 18:48:18 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 _HTMLELEMENT_H_
25
#define _HTMLELEMENT_H_ 1
26
27
#ifdef __GNUG__
28
# pragma interface
29
#endif
30
37
#include <string>
38
39
#include "
cgicc/CgiDefs.h
"
40
#include "
cgicc/MStreamable.h
"
41
#include "
cgicc/HTMLAttributeList.h
"
42
43
namespace
cgicc {
44
45
class
HTMLElementList;
46
47
// ============================================================
48
// Class HTMLElement
49
// ============================================================
50
60
class
CGICC_API
HTMLElement
:
public
MStreamable
61
{
62
public
:
63
71
enum
EElementType
{
73
eAtomic
,
75
eBoolean
76
};
77
78
// ============================================================
79
82
89
HTMLElement
(
const
HTMLElement
& element);
90
96
virtual
~
HTMLElement
();
98
99
// ============================================================
100
103
111
bool
112
operator== (
const
HTMLElement
& element)
const
;
113
121
inline
bool
122
operator!= (
const
HTMLElement
& element)
const
123
{
return
! operator==(element); }
124
125
#ifdef WIN32
126
/* Dummy operator for MSVC++ */
127
inline
bool
128
operator< (
const
HTMLElement
& element)
const
129
{
return
false
; }
130
#endif
131
139
HTMLElement&
140
operator= (
const
HTMLElement& element);
142
143
// ============================================================
144
149
156
virtual
const
char
*
157
getName()
const
= 0;
158
165
inline
std::string
166
getData()
const
167
{
return
fData; }
168
175
inline
EElementType
176
getType()
const
177
{
return
fType; }
179
180
// ============================================================
181
186
193
inline
void
194
setData(
const
std::string& data)
195
{ fData = data; }
197
198
// ============================================================
199
206
virtual
HTMLElement
*
207
clone()
const
= 0;
208
209
// ============================================================
210
215
222
inline
const
HTMLElementList
*
223
getEmbedded()
const
224
{
return
fEmbedded; }
225
233
void
234
setEmbedded(
const
HTMLElementList
& embedded);
235
243
HTMLElement
&
244
add(
const
HTMLElement
& element);
245
253
HTMLElement
&
254
add(
HTMLElement
*element);
256
257
// ============================================================
258
263
270
inline
const
HTMLAttributeList
*
271
getAttributes()
const
272
{
return
fAttributes; }
273
281
void
282
setAttributes(
const
HTMLAttributeList
& attributes);
283
291
HTMLElement
&
292
set
(
const
std::string& name);
293
302
HTMLElement
&
303
set
(
const
std::string& name,
304
const
std::string& value);
306
307
// ============================================================
308
313
319
virtual
void
320
swapState()
const
321
{}
322
329
virtual
bool
330
getState()
const
331
{
return
false
; }
333
340
virtual
void
341
render(std::ostream& out)
const
;
342
343
protected
:
344
355
HTMLElement
(
const
HTMLAttributeList
*attributes,
356
const
HTMLElement
*embedded,
357
const
std::string *data,
358
EElementType type);
359
366
inline
bool
367
dataSpecified()
const
368
{
return
fDataSpecified; }
369
370
private
:
371
HTMLElement
() {}
372
373
HTMLAttributeList *fAttributes;
374
HTMLElementList *fEmbedded;
375
std::string fData;
376
EElementType fType;
377
bool
fDataSpecified;
378
};
379
380
}
// namespace cgicc
381
382
#endif
/* ! _HTMLELEMENT_H_ */
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 Mon Jun 10 2013 05:50:40 for cgicc by
doxygen
1.8.3.1