HTMLBooleanElement.h Source File

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

# HTMLBooleanElement.h

Go to the documentation of this file.

    00001 /* -*-c++-*- */
    00002 /*
    00003  *  $Id: HTMLBooleanElement.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 _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 // Template for concrete boolean HTML element classes
    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 /* ! _HTMLBOOLEANELEMENT_H_ */