00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
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
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
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