HTMLDoctype.cpp

00001 /* -*-mode:c++; c-file-style: "gnu";-*- */
00002 /*
00003  *  $Id: HTMLDoctype_8cpp-source.html,v 1.1 2007/07/03 18:58:10 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 #ifdef __GNUG__
00025 #  pragma implementation
00026 #endif
00027 
00028 #include "cgicc/HTMLDoctype.h"
00029 
00030 // ============================================================
00031 // Class HTMLDoctype
00032 // ============================================================
00033 
00034 cgicc::HTMLDoctype::HTMLDoctype(EDocumentType type)
00035   : fType(type)
00036 {}
00037 
00038 cgicc::HTMLDoctype::~HTMLDoctype()
00039 {}
00040 
00041 void
00042 cgicc::HTMLDoctype::render(std::ostream &out)   const
00043 {
00044   out << "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0";
00045   
00046   switch(fType) {
00047   case eStrict:
00048     break;
00049 
00050   case eTransitional:
00051     out << " Transitional";
00052     break;
00053     
00054   case eFrames:
00055     out << " Frameset";
00056     break;
00057   }
00058   
00059   out << "//EN\" \"http://www.w3.org/TR/REC-html40/";
00060   
00061   switch(fType) {
00062   case eStrict:
00063     out << "strict.dtd\"";
00064     break;
00065     
00066   case eTransitional:
00067     out << "transitional.dtd\"";
00068     break;
00069     
00070   case eFrames:
00071     out << "frameset.dtd\"";
00072     break;
00073   }
00074   out << '>';
00075 }

Generated on Tue Jul 3 15:44:29 2007 for GNUCgicc by  doxygen 1.5.1