Google

Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

html.h

Go to the documentation of this file.
00001 // Copyright (C) 1999-2000 Open Source Telecom Corporation.
00002 //  
00003 // This program is free software; you can redistribute it and/or modify
00004 // it under the terms of the GNU General Public License as published by
00005 // the Free Software Foundation; either version 2 of the License, or
00006 // (at your option) any later version.
00007 // 
00008 // This program is distributed in the hope that it will be useful,
00009 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00010 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00011 // GNU General Public License for more details.
00012 // 
00013 // You should have received a copy of the GNU General Public License
00014 // along with this program; if not, write to the Free Software 
00015 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
00016 // 
00017 // As a special exception to the GNU General Public License, permission is 
00018 // granted for additional uses of the text contained in its release 
00019 // of Common C++.
00020 // 
00021 // The exception is that, if you link the Common C++ library with other
00022 // files to produce an executable, this does not by itself cause the
00023 // resulting executable to be covered by the GNU General Public License.
00024 // Your use of that executable is in no way restricted on account of
00025 // linking the Common C++ library code into it.
00026 // 
00027 // This exception does not however invalidate any other reasons why
00028 // the executable file might be covered by the GNU General Public License.
00029 // 
00030 // This exception applies only to the code released under the 
00031 // name Common C++.  If you copy code from other releases into a copy of
00032 // Common C++, as the General Public License permits, the exception does
00033 // not apply to the code that you add in this way.  To avoid misleading
00034 // anyone as to the status of such modified files, you must delete
00035 // this exception notice from them.
00036 // 
00037 // If you write modifications of your own for Common C++, it is your choice
00038 // whether to permit this exception to apply to your modifications.
00039 // If you do not wish that, delete this exception notice.  
00040 
00041 #ifndef __CCXX_HTML_H__
00042 #define __CCXX_MTML_H__
00043 
00044 #ifndef __CCXX_PERSIST_H__
00045 #include <cc++/persist.h>
00046 #endif
00047 
00048 #include <vector>
00049 #include <map>
00050 #include <string>
00051 
00061   class Writer
00062   {
00063   public:
00064         virtual void WriteSomeOutput(const string& stuff, bool newLine);
00065   };
00066 
00079   class Entity : public BaseObject
00080   {
00081         DECLARE_PERSISTENCE(Entity)
00082   public:
00083         Entity();
00089         Entity(const string& name);
00090         virtual ~Entity();
00091 
00096         virtual bool Write(Engine& archive) const;
00097         virtual bool Read(Engine& archive);
00098         
00104         virtual void OutputHTML(Writer& wr) const;
00105 
00106   protected:
00107         // Typedefs
00108         typedef vector<string> Strings;
00109         typedef map<string,string> StringMap;
00110         typedef vector<Entity*> Entities;
00111 
00116         Strings & GetAttributes() { return myAttributes; }
00117 
00122         StringMap & GetSettings() { return mySettings; }
00123 
00127         string & GetContent() { return myContent; }
00128 
00132         void SetWhetherTerminated(bool yesno) { myTerminated = yesno; }
00133         bool GetWhetherTerminated() const { return myTerminated; }
00134 
00139         Entities & GetEntities() { return myEntities; }
00140 
00145         void SetNewlineAfterTag(bool yesno) { myNewLine = yesno; }
00146         bool GetNewlineAfterTag() const { return myNewLine; }
00147 
00148   private:
00149         string myName;
00150         string myContent;
00151         Strings myAttributes;
00152         StringMap mySettings;
00153         bool myTerminated;
00154         bool myNewLine;
00155         Entities myEntities;
00156   };
00157 
00158   // Forward declarations...
00159 
00160   class Head;
00161   class Body;
00162 
00174   class HTMLDocument : public Entity
00175   {
00176         DECLARE_PERSISTENCE(HTMLDocument)
00177   public:
00178         HTMLDocument();
00179         virtual ~HTMLDocument();
00180 
00181         HTMLDocument(bool frameset);
00187         Head& GetHeadEntity();
00193         Body& GetBodyEntity();
00194 
00198         virtual void OutputHTML(Writer& wr) const;
00199   };
00200 
00209   class Head : public Entity
00210   {
00211         DECLARE_PERSISTENCE(Head)
00212   public:
00213         Head();
00214         ~Head();
00215   };
00216 
00223   class Body : public Entity
00224   {
00225         DECLARE_PERSISTENCE(Body)
00226   public:
00227         Body();
00228         ~Body();
00229   };
00230 
00241   class Frameset : public Body
00242   {
00243         DECLARE_PERSISTENCE(Frameset)
00244   public:
00245         Frameset();
00246         ~Frameset();
00247   };
00248 
00249 #endif
00250 

Generated at Fri Mar 23 10:47:54 2001 for CommonC++ by doxygen1.2.1 written by Dimitri van Heesch, © 1997-2000