00001 /* -*-mode:c++; c-file-style: "gnu";-*- */ 00002 /* 00003 * $Id: HTMLAttributeList_8h-source.html,v 1.3 2008/01/19 21:53:40 sebdiaz Exp $ 00004 * 00005 * Copyright (C) 1996 - 2004 Stephen F. Booth <sbooth@gnu.org> 00006 * 2007 Sebastien DIAZ <sebastien.diaz@gmail.com> 00007 * Part of the GNU cgicc library, http://www.gnu.org/software/cgicc 00008 * 00009 * This library is free software; you can redistribute it and/or 00010 * modify it under the terms of the GNU Lesser General Public 00011 * License as published by the Free Software Foundation; either 00012 * version 3 of the License, or (at your option) any later version. 00013 * 00014 * This library is distributed in the hope that it will be useful, 00015 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00016 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00017 * Lesser General Public License for more details. 00018 * 00019 * You should have received a copy of the GNU Lesser General Public 00020 * License along with this library; if not, write to the Free Software 00021 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA 00022 */ 00023 00024 #ifndef _HTMLATTRIBUTELIST_H_ 00025 #define _HTMLATTRIBUTELIST_H_ 1 00026 00027 #ifdef __GNUG__ 00028 # pragma interface 00029 #endif 00030 00037 #include <string> 00038 #include <iostream> 00039 #include <vector> 00040 00041 #include "cgicc/CgiDefs.h" 00042 #include "cgicc/MStreamable.h" 00043 #include "cgicc/HTMLAttribute.h" 00044 00045 namespace cgicc { 00046 00047 // ============================================================ 00048 // Class HTMLAttributeList 00049 // ============================================================ 00050 00051 #ifdef WIN32 00052 template class CGICC_API std::vector<HTMLAttribute>; 00053 #endif 00054 00069 class CGICC_API HTMLAttributeList 00070 { 00071 public: 00072 00073 // ============================================================ 00074 00077 00083 HTMLAttributeList(); 00084 00091 HTMLAttributeList(const HTMLAttribute& head); 00092 00099 HTMLAttributeList(const HTMLAttributeList& list); 00100 00106 ~HTMLAttributeList(); 00108 00109 00110 // ============================================================ 00111 00114 00121 HTMLAttributeList& 00122 operator= (const HTMLAttributeList &list); 00124 00125 00126 // ============================================================ 00127 00132 00140 HTMLAttributeList& 00141 set(const std::string& name); 00142 00151 HTMLAttributeList& 00152 set(const std::string& name, 00153 const std::string& value); 00155 00158 00165 void 00166 render(std::ostream& out) const; 00168 00169 private: 00170 std::vector<HTMLAttribute> fAttributes; 00171 }; 00172 00173 // ============================================================ 00174 // List manipulators 00175 // ============================================================ 00176 00188 inline HTMLAttributeList 00189 set(const std::string& name) 00190 { return HTMLAttributeList(HTMLAttribute(name)); } 00191 00204 inline HTMLAttributeList 00205 set(const std::string& name, 00206 const std::string& value) 00207 { return HTMLAttributeList(HTMLAttribute(name, value)); } 00208 00209 } // namespace cgicc 00210 00211 #endif /* ! _HTMLATTRIBUTES_H_ */