00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 
00022 #ifndef _HTMLBOOLEANELEMENT_H_
00023 #define _HTMLBOOLEANELEMENT_H_ 1
00024 
00030 #include <new>
00031 
00032 #include "cgicc/HTMLElement.h"
00033 
00034 CGICC_BEGIN_NAMESPACE
00035 
00036 
00037 
00038 
00039 
00059 template<class Tag>
00060 class HTMLBooleanElement : public HTMLElement 
00061 {
00062 public:
00063 
00064   
00065   
00068 
00073   HTMLBooleanElement()
00074     : HTMLElement(0, 0, 0, eBoolean)
00075   {}
00076 
00081   HTMLBooleanElement(const STDNS string& text)
00082     : HTMLElement(0, 0, &text, eBoolean)
00083   {}
00084   
00089   HTMLBooleanElement(const HTMLAttributeList& attributes)
00090     : HTMLElement(&attributes, 0, 0, eBoolean)
00091   {}
00092   
00097   HTMLBooleanElement(const HTMLElement& embedded)
00098     : HTMLElement(0, &embedded, 0, eBoolean)
00099   {}
00100   
00107   HTMLBooleanElement(const STDNS string& text, 
00108                         const HTMLAttributeList& attributes)
00109     : HTMLElement(&attributes, 0, &text, eBoolean)
00110   {}
00111 
00118   HTMLBooleanElement(const HTMLAttributeList& attributes, 
00119                         const HTMLElement& embed)
00120     : HTMLElement(&attributes, &embed, 0, eBoolean)
00121   {}
00122 
00127   virtual ~HTMLBooleanElement()
00128   {}
00130 
00131   
00132 
00137   virtual inline HTMLElement* 
00138   clone()                                       const
00139   { return new HTMLBooleanElement<Tag>(*this); }
00140 
00141   
00142 
00147   virtual inline const char*
00148   getName()                                     const
00149   { return Tag::getName(); }
00150 
00151   
00152 
00155 
00161   virtual inline void 
00162   swapState()                                   const
00163   { sState = ! sState; }
00164   
00169   virtual inline bool 
00170   getState()                                    const 
00171   { return sState; }
00172   
00177   static inline void 
00178   reset()
00179   { sState = false; }
00181 
00182 private:
00183   static bool sState;
00184 };
00185 
00186 template<class Tag>
00187 bool CGICCNS HTMLBooleanElement<Tag>::sState = false;
00188 
00189 CGICC_END_NAMESPACE
00190 
00191 #endif