00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef __HTMLENTITY_H__
00021 #define __HTMLENTITY_H__
00022
00023 #include "weiParser.h"
00024 #include "weHTTP.h"
00025
00026 using namespace std;
00027
00028 class WeHtmlDocument;
00029 class WeHtmlEntity;
00030
00035
00045 class WeHtmlEntity: virtual public iweEntity
00046 {
00047 public:
00048 WeHtmlEntity(iweEntity* prnt = NULL);
00049 WeHtmlEntity(WeHtmlEntity& entity);
00050 ~WeHtmlEntity();
00051
00052 virtual const string &InnerText(void);
00053 virtual const string &OuterText(void);
00054
00055 virtual WeCmpResults* Diff(iweEntity& cmp, weCmpMode mode);
00056 virtual weCmpState Compare(iweEntity& cmp, weCmpMode mode);
00057
00058 virtual WeScannerToken Parse(string tagName, WeTagScanner& scanner, iweTransport* processor = NULL);
00059 };
00060
00073 class WeInnerText : public WeHtmlEntity {
00074 public:
00075 WeInnerText(iweEntity* prnt = NULL);
00076 WeInnerText(WeInnerText& entity);
00077 ~WeInnerText();
00078
00079 virtual const string Attr(string);
00080 virtual void Attr(string, string);
00081
00082 virtual const string &InnerText(void);
00083 virtual const string &OuterText(void);
00084
00085 virtual WeCmpResults* Diff(iweEntity& cmp, weCmpMode mode);
00086 virtual weCmpState Compare(iweEntity& cmp, weCmpMode mode);
00087
00088 virtual WeHtmlEntity* Child(int idx) {return (NULL);}
00089 virtual WeHtmlEntity* Child(string type) {return (NULL);}
00090
00091
00092 virtual WeEntityList& Children() {
00093 throw runtime_error("WeInnerText: Children property is not accessible");
00094 return *((WeEntityList*)NULL);
00095 }
00096 };
00097
00106 class WeHtmlComment : public WeInnerText {
00107 public:
00108 WeHtmlComment(iweEntity* prnt = NULL) : WeInnerText(prnt) { entityName = "#comment"; };
00109 };
00110
00119 class WeCData : public WeInnerText {
00120 public:
00121 WeCData(iweEntity* prnt = NULL) : WeInnerText(prnt) { entityName = "#cdata"; };
00122 };
00123
00132 class WePhpInclude : public WeInnerText {
00133 public:
00134 WePhpInclude(iweEntity* prnt = NULL) : WeInnerText(prnt) { entityName = "#php"; };
00135 };
00136
00148 #pragma warning (disable: 4250)
00149 class WeHtmlDocument : public iweDocument, public WeHtmlEntity
00150 {
00151 public:
00152 WeHtmlDocument(iweEntity* prnt = NULL);
00153 WeHtmlDocument(WeHtmlDocument& entity);
00154 ~WeHtmlDocument();
00155
00156 virtual const string &InnerText(void);
00157 virtual const string &OuterText(void);
00158
00159 virtual WeCmpResults* Diff(iweEntity& cmp, weCmpMode mode);
00160 virtual weCmpState Compare(iweEntity& cmp, weCmpMode mode);
00161
00166 virtual WeBlob& Data(void);
00167
00168 virtual bool ParseData(iweResponse* resp, iweTransport* processor = NULL);
00169
00170 #ifndef __DOXYGEN__
00171 protected:
00172 WeHttpResponse* response;
00173 #endif //__DOXYGEN__
00174 };
00175
00187 class WeRefrenceObject : public WeHtmlDocument
00188 {
00189 public:
00190 WeRefrenceObject(iweEntity* prnt = NULL);
00191 WeRefrenceObject(WeRefrenceObject& entity);
00192 ~WeRefrenceObject();
00193
00195
00196
00197
00198
00199
00200
00201
00202
00203 string LocalLink(void) const { return(m_localLink); };
00204 void LocalLink(string local) { m_localLink = local; };
00206
00213 bool const IsLocal(void) const { return m_localLink.empty(); };
00214
00215 protected:
00216 #ifndef __DOXYGEN__
00217 string m_localLink;
00218 #endif //__DOXYGEN__
00219 };
00220
00231 class WeScript : public WeRefrenceObject
00232 {
00233 public:
00234 WeScript(iweEntity* prnt = NULL);
00235 WeScript(WeScript& entity);
00236 ~WeScript();
00237
00238 virtual WeScannerToken Parse(string tagName, WeTagScanner& scanner, WeHTTP* processor = NULL);
00239
00240 bool SetEngine(void *engine = NULL);
00241 void* Execute();
00242
00243 protected:
00244 #ifndef __DOXYGEN__
00245 void* scriptEngine;
00246 #endif //__DOXYGEN__
00247 };
00248
00249 #endif //__HTMLENTITY_H__