00001 #ifndef _GHTMLSTATIC_H_ 00002 #define _GHTMLSTATIC_H_ 00003 00004 #include "GCss.h" 00005 #include "GHashTable.h" 00006 00007 extern char16 GHtmlListItem[]; 00009 class GHtmlStatic 00010 { 00011 friend class GHtmlStaticInst; 00012 00013 public: 00014 static GHtmlStatic *Inst; 00015 00016 int Refs; 00017 GHashTbl<char16*,int> VarMap; 00018 GHashTbl<char*,GCss::PropType> StyleMap; 00019 GHashTbl<char*,int> ColourMap; 00020 00021 GHtmlStatic(); 00022 ~GHtmlStatic(); 00023 }; 00024 00026 class GHtmlStaticInst 00027 { 00028 public: 00029 GHtmlStatic *Static; 00030 00031 GHtmlStaticInst() 00032 { 00033 if (!GHtmlStatic::Inst) 00034 { 00035 GHtmlStatic::Inst = new GHtmlStatic; 00036 } 00037 if (GHtmlStatic::Inst) 00038 { 00039 GHtmlStatic::Inst->Refs++; 00040 } 00041 Static = GHtmlStatic::Inst; 00042 } 00043 00044 ~GHtmlStaticInst() 00045 { 00046 if (GHtmlStatic::Inst) 00047 { 00048 GHtmlStatic::Inst->Refs--; 00049 if (GHtmlStatic::Inst->Refs == 0) 00050 { 00051 DeleteObj(GHtmlStatic::Inst); 00052 } 00053 } 00054 } 00055 }; 00056 00057 #endif