Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

HTMLElement.h

Go to the documentation of this file.
00001 /* -*-c++-*- */
00002 /*
00003  *  $Id: HTMLElement.h,v 1.2 2002/03/06 02:49:55 sbooth Exp $
00004  *
00005  *  Copyright (C) 1996 - 2002 Stephen F. Booth
00006  *
00007  *  This library is free software; you can redistribute it and/or
00008  *  modify it under the terms of the GNU Lesser General Public
00009  *  License as published by the Free Software Foundation; either
00010  *  version 2.1 of the License, or (at your option) any later version.
00011  *
00012  *  This library is distributed in the hope that it will be useful,
00013  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015  *  Lesser General Public License for more details.
00016  *
00017  *  You should have received a copy of the GNU Lesser General Public
00018  *  License along with this library; if not, write to the Free Software
00019  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00020  */
00021 
00022 #ifndef _HTMLELEMENT_H_
00023 #define _HTMLELEMENT_H_ 1
00024 
00025 #ifdef __GNUG__
00026 #  pragma interface
00027 #endif
00028 
00035 #include <string>
00036 
00037 #include "cgicc/CgiDefs.h"
00038 #include "cgicc/MStreamable.h"
00039 #include "cgicc/HTMLAttributeList.h"
00040 
00041 CGICC_BEGIN_NAMESPACE
00042 
00043 class HTMLElementList;
00044 
00045 // ============================================================
00046 // Class HTMLElement
00047 // ============================================================
00048 
00058 class CGICC_API HTMLElement : public MStreamable 
00059 {
00060 public:
00061 
00069   enum EElementType {
00071     eAtomic,
00073     eBoolean
00074   };
00075   
00076   // ============================================================
00077 
00080 
00087   HTMLElement(const HTMLElement& element);
00088 
00094   virtual ~HTMLElement();
00096 
00097   // ============================================================
00098 
00101 
00109   bool 
00110   operator== (const HTMLElement& element)               const;
00111 
00119   inline bool 
00120   operator!= (const HTMLElement& element)               const
00121     { return ! operator==(element); }
00122 
00123 #ifdef WIN32
00124   /* Dummy operator for MSVC++ */
00125   inline bool
00126   operator< (const HTMLElement& element)                const
00127   { return false; }
00128 #endif
00129 
00137   HTMLElement&
00138   operator= (const HTMLElement& element);
00140 
00141   // ============================================================
00142   
00147 
00154   virtual const char*
00155   getName()                                     const = 0;
00156 
00163   inline STDNS string
00164   getData()                                     const
00165   { return fData; }
00166 
00173   inline EElementType
00174   getType()                                     const
00175   { return fType; }
00177 
00178   // ============================================================
00179 
00184 
00191   inline void
00192   setData(const STDNS string& data)
00193   { fData = data; }
00195 
00196   // ============================================================
00197 
00204   virtual HTMLElement*
00205   clone()                                       const = 0;
00206 
00207   // ============================================================
00208 
00213 
00220   inline const HTMLElementList*
00221   getEmbedded()                                 const
00222   { return fEmbedded; }
00223 
00231   void 
00232   setEmbedded(const HTMLElementList& embedded);
00233 
00241   HTMLElement&
00242   add(const HTMLElement& element);
00243 
00251   HTMLElement&
00252   add(HTMLElement *element);
00254   
00255   // ============================================================
00256 
00261 
00268   inline const HTMLAttributeList*
00269   getAttributes()                               const
00270   { return fAttributes; }
00271 
00279   void 
00280   setAttributes(const HTMLAttributeList& attributes);
00281 
00289   HTMLElement&
00290   set(const STDNS string& name);
00291 
00300   HTMLElement&
00301   set(const STDNS string& name,
00302       const STDNS string& value);
00304   
00305   // ============================================================
00306 
00311 
00317   virtual void 
00318   swapState()                                   const
00319   {}
00320   
00327   virtual bool 
00328   getState()                                    const
00329   { return false; }
00331 
00338   virtual void 
00339   render(STDNS ostream& out)                    const;
00340   
00341 protected:
00342 
00353   HTMLElement(const HTMLAttributeList *attributes,
00354               const HTMLElement *embedded,
00355               const STDNS string *data,
00356               EElementType type);
00357 
00364   inline bool
00365   dataSpecified()                               const
00366   { return fDataSpecified; }
00367 
00368 private:
00369   HTMLElement() {}
00370 
00371   HTMLAttributeList *fAttributes;
00372   HTMLElementList   *fEmbedded;
00373   STDNS string      fData;
00374   EElementType      fType;
00375   bool              fDataSpecified;
00376 };
00377 
00378 CGICC_END_NAMESPACE
00379 
00380 #endif /* ! _HTMLELEMENT_H_ */

GNU cgicc - A C++ class library for writing CGI applications
Copyright © 1996 - 2002 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 Sun Mar 17 16:40:57 2002 for cgicc by doxygen 1.2.13.1