HTMLAttribute.h
Go to the documentation of this file.
1 /* -*-mode:c++; c-file-style: "gnu";-*- */
2 /*
3  * $Id: HTMLAttribute.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 _HTMLATTRIBUTE_H_
25 #define _HTMLATTRIBUTE_H_ 1
26 
27 #ifdef __GNUG__
28 # pragma interface
29 #endif
30 
41 #include <string>
42 #include <iostream>
43 
44 #include "cgicc/CgiDefs.h"
45 #include "cgicc/MStreamable.h"
46 
47 namespace cgicc {
48 
49  // ============================================================
50  // Class HTMLAttribute
51  // ============================================================
52 
71  class CGICC_API HTMLAttribute : public MStreamable
72  {
73  public:
74 
75  // ============================================================
76 
79 
85  HTMLAttribute();
86 
93  HTMLAttribute(const std::string& name);
94 
102  HTMLAttribute(const std::string& name,
103  const std::string& value);
104 
111  HTMLAttribute(const HTMLAttribute& attribute);
112 
118  virtual ~HTMLAttribute();
120 
121  // ============================================================
122 
125 
133  bool
134  operator== (const HTMLAttribute& att) const;
135 
143  inline bool
144  operator!= (const HTMLAttribute& att) const
145  { return ! operator==(att); }
146 
147 #ifdef WIN32
148  /* Dummy operator for MSVC++ */
149  inline bool
150  operator< (const HTMLAttribute& att) const
151  { return false; }
152 #endif
153 
161  HTMLAttribute&
162  operator= (const HTMLAttribute& att);
164 
165  // ============================================================
166 
171 
178  inline std::string
179  getName() const
180  { return fName; }
181 
188  inline std::string
189  getValue() const
190  { return fValue; }
192 
193  // ============================================================
194 
199 
206  inline void
207  setName(const std::string& name)
208  { fName = name; }
209 
216  inline void
217  setValue(const std::string& value)
218  { fValue = value; }
220 
227  virtual void
228  render(std::ostream& out) const;
229 
230  private:
231  std::string fName;
232  std::string fValue;
233  };
234 
235 } // namespace cgicc
236 
237 #endif /* ! _HTMLATTRIBUTE_H_ */
Class representing a name or a single name/value pair.
Definition: HTMLAttribute.h:71
Platform and operating system specific macro definitions.
void setValue(const std::string &value)
Set the value of this HTMLAttribute.
std::string getName() const
Get the name of this HTMLAttribute.
std::string getValue() const
Get the value of this HTMLAttribute.
Mix-in streamable interface.
Definition: MStreamable.h:66
Abstract base class for all streamable objects.
void setName(const std::string &name)
Set the name of this 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 Thu Apr 3 2014 18:19:37 for cgicc by doxygen 1.8.6