20 void SetUcCh(const
char& UcCh, const
char& LcCh);
21 void SetUcCh(const
TStr& Str);
23 void SetEscStr(const
TStr& SrcStr, const
TStr& DstStr);
26 THtmlLxChDef(
TSIn& SIn): ChTyV(SIn), UcChV(SIn), LcChV(SIn), EscStrH(SIn){}
29 ChTyV.Save(SOut); UcChV.Save(SOut); LcChV.Save(SOut); EscStrH.Save(SOut);}
36 bool IsWs(
const char& Ch)
const {
44 bool IsUrl(
const char& Ch)
const {
47 (Ch==
'.')||(Ch==
'-')||(Ch==
':')||(Ch==
'/')||(Ch==
'~');}
50 bool IsUc(
const char& Ch)
const {
return Ch==UcChV[Ch-
TCh::Mn];}
51 bool IsLc(
const char& Ch)
const {
return Ch==LcChV[Ch-
TCh::Mn];}
55 for (
int ChN=0; ChN<ChA.
Len(); ChN++){ChA.
PutCh(ChN, GetUc(ChA[ChN]));}}
57 for (
int ChN=0; ChN<ChA.
Len(); ChN++){ChA.
PutCh(ChN, GetLc(ChA[ChN]));}}
59 TChA ChA(Str); GetUcChA(ChA);
return ChA;}
61 TChA ChA(Str); GetLcChA(ChA);
return ChA;}
62 TStr GetEscStr(
const TStr& Str)
const;
70 static TStr GetCSZFromYuascii(
const TChA& ChA);
71 static TStr GetCSZFromWin1250(
const TChA& ChA);
72 static TStr GetWin1250FromYuascii(
const TChA& ChA);
73 static TStr GetIsoCeFromYuascii(
const TChA& ChA);
99 Ch=ChStack.
Pop(); ChX++;
118 SIn(_SIn), RSIn(*SIn), DoParseArg(_DoParseArg),
119 ChStack(), Ch(
' '), ChX(0), EscCh(false),
120 EscChA(), ArgNm(), ArgVal(),
121 Sym(
hsyUndef), SymBChX(0), SymEChX(0), ChA(), UcChA(),
122 PreSpaces(0), PreSpaceChA(), ArgNmValV(){}
127 ChStack.
Push(Ch);
if (!SymChA.
Empty()){SymChA.
Pop();} Ch=_Ch; ChX--;}
129 for (
int ChN=Str.
Len()-1; ChN>=0; ChN--){
PutCh(Str[ChN]);}}
141 if (ArgN==-1){
return DfArgVal;}
else {
return ArgNmValV[ArgN].Dat;}}
144 if (ArgN==-1){ArgNmValV.
Add(
TStrKd(ArgNm, ArgVal));}
145 else {ArgNmValV[ArgN]=
TStrKd(ArgNm, ArgVal);}}
154 const TStr& TagNm,
const TStr& ArgNm,
const TStr& ArgVal);
156 const TStr& ArgNm1,
const TStr& ArgVal1,
157 const TStr& ArgNm2,
const TStr& ArgVal2,
const bool& AndOpP=
true);
159 const TStr& TagNm1,
const TStr& ArgNm1,
const TStr& ArgVal1,
160 const TStr& TagNm2,
const TStr& ArgNm2,
const TStr& ArgVal2);
165 const TStr& ArgVal,
const bool& TxtOnlyP=
false);
190 Sym(_Sym), Str(), ArgNmValV(){}
192 Sym(_Sym), Str(_Str), ArgNmValV(){}
195 Sym(_Sym), Str(_Str), ArgNmValV(_ArgNmValV){}
204 TStr GetFullStr()
const;
211 if (ArgN==-1){
return DfArgVal;}
else {
return ArgNmValV[ArgN].Dat;}}
212 bool IsUrlTok(
TStr& RelUrlStr)
const;
213 bool IsRedirUrlTok()
const;
215 void SaveTxt(
const PSOut& SOut,
const bool& TxtMode=
true);
243 static bool IsBreakTag(
const TStr& TagNm);
244 static bool IsBreakTok(
const PHtmlTok& Tok);
245 static bool IsHTag(
const TStr& TagNm,
int& HTagN);
246 static PHtmlTok GetHTok(
const bool& IsBTag,
const int& HTagN);
273 Sym=TokV[TokN]->GetSym(); Str=TokV[TokN]->
GetStr();
return TokV[TokN];}
276 static TStr GetTxtLnDoc(
const TStr& HtmlStr);
277 static TStr GetTxtLnDoc(
const TStr& HtmlStr,
const TStr& BaseUrlStr,
278 const bool& OutUrlP,
const bool& OutTagsP);
283 void SaveTxt(
const PSOut& SOut,
const bool& TxtMode=
true)
const;
285 static void SaveHtmlToTxt(
286 const TStr& HtmlStr,
const PSOut& TxtSOut,
const TStr& BaseUrlStr,
287 const bool& OutUrlP,
const bool& OutToksP);
288 static void SaveHtmlToTxt(
289 const TStr& HtmlStr,
const TStr& TxtFNm,
const TStr& BaseUrlStr,
290 const bool& OutUrlP,
const bool& OutToksP);
291 static void SaveHtmlToXml(
292 const TStr& HtmlStr,
const PSOut& XmlSOut,
const TStr& BaseUrlStr,
293 const bool& OutTextP,
const bool& OutUrlP,
const bool& OutToksP,
294 const bool& OutTagsP,
const bool& OutArgsP);
295 static void SaveHtmlToXml(
296 const TStr& HtmlStr,
const TStr& XmlFNm,
const TStr& BaseUrlStr,
297 const bool& OutTextP,
const bool& OutUrlP,
const bool& OutToksP,
298 const bool& OutTagsP,
const bool& OutArgsP);
302 static bool _IsTagRedir(
304 const TStr& BaseUrlStr,
const TStr& RedirUrlStr);
305 static TStr GetRedirHtmlDocStr(
const TStr& HtmlStr,
306 const TStr& BaseUrlStr,
const TStr& RedirUrlStr);
337 TWebPg(): UrlStrV(), IpNumV(), HttpResp(){}
339 UrlStrV(_UrlStrV), IpNumV(_IpNumV), HttpResp(_HttpResp){}
341 return new TWebPg(UrlStrV, IpNumV, HttpResp);}
356 if (UrlN==-1){
return UrlStrV.Last();}
else {
return UrlStrV[UrlN];}}
359 if (UrlN==-1){UrlStr=UrlStrV.Last();}
else {UrlStr=UrlStrV[UrlN];}
362 int GetIps()
const {
return IpNumV.Len();}
364 if (IpN==-1){
return IpNumV.Last();}
else {
return IpNumV[IpN];}}
370 void GetOutUrlV(
TUrlV& OutUrlV,
TUrlV& OutRedirUrlV)
const;
372 TUrlV OutRedirUrlV; GetOutUrlV(OutUrlV, OutRedirUrlV);}
373 void GetOutDescUrlStrKdV(
TStrKdV& OutDescUrlStrKdV)
const;
379 void SaveAsHttpBody(
const TStr& FNm)
const;
380 void SaveAsHttp(
const TStr& FNm)
const;
static PWebPg Load(TSIn &)
static const TStr H5TagNm
bool IsGetETag(const TStr &TagNm)
static const TStr H4TagNm
TStr GetHRefBeforeStr(const TStr &Str)
static TStr GetSpaceStr(const int &Spaces)
TStr GetHttpHdStr() const
static const TStr FrameTagNm
static THtmlLxChDef ChDef
static const TStr H3TagNm
bool IsWs(const char &Ch) const
static const TStr H1TagNm
#define ClassHdTP(TNm, PNm)
static const TStr TitleArgNm
void GetLcChA(TChA &ChA) const
PUrl GetUrl(const int &UrlN=-1) const
static const TStr LiTagNm
THtmlTok(const THtmlLxSym &_Sym, const TStr &_Str)
void MoveToETagOrEof(const TStr &TagNm)
static const TStr HRefArgNm
TStr GetFullBTagStr() const
TStr GetUrlStr(const int &UrlN=-1) const
void PutStr(const TStr &Str)
bool IsIn(const TVal &Val) const
Checks whether element Val is a member of the vector.
bool IsNum(const char &Ch) const
void MoveToBTagArgOrEof(const TStr &TagNm, const TStr &ArgNm, const TStr &ArgVal)
bool IsSym(const char &Ch) const
static void GetTokStrV(const TStr &Str, TStrV &TokStrV)
void PutCh(const int &ChN, const char &Ch)
TStr GetArg(const TStr &ArgNm, const TStr &DfArgVal) const
void GetUcChA(TChA &ChA) const
bool IsEoln(const char &Ch) const
TSizeTy Len() const
Returns the number of elements in the vector.
void PutCh(const char &_Ch)
static THtmlLxChDef & GetChDefRef()
THtmlLx & operator=(const THtmlLx &)
TStr GetArg(const TStr &ArgNm) const
PHtmlTok GetTok(const int &TokN, THtmlLxSym &Sym, TStr &Str) const
static const TStr MetaTagNm
static PUrl New(const TStr &RelUrlStr, const TStr &BaseUrlStr=TStr())
void MoveToBTagArg2OrEof(const TStr &TagNm, const TStr &ArgNm1, const TStr &ArgVal1, const TStr &ArgNm2, const TStr &ArgVal2, const bool &AndOpP=true)
static TStr GetEscapedStr(const TChA &ChA)
bool IsUrl(const char &Ch) const
static PHtmlLxChDef ChDef
static const TStr TitleTagNm
static PWebPg New(const TStrV &UrlStrV, const PHttpResp &HttpResp)
THtmlTok(const THtmlLxSym &_Sym, const TStr &_Str, const THtmlLx::TArgNmValV &_ArgNmValV)
bool IsArg(const TStr &ArgNm) const
bool IsGetBTag(const TStr &TagNm)
static const TStr AreaTagNm
THtmlLxSym GetSym() const
static PWebPg New(const TStrV &UrlStrV, const TStrV &IpNumV, const PHttpResp &HttpResp)
static const TStr HttpEquivArgNm
TStr GetLcStr(const TStr &Str) const
TStr GetArgVal(const int &ArgN) const
#define ClassTP(TNm, PNm)
static const TStr H2TagNm
THtmlDoc & operator=(const THtmlDoc &)
static PSIn New(const TStr &FNm)
#define ClassTPV(TNm, PNm, TNmV)
static const TStr CenterTagNm
THtmlTok & operator=(const THtmlTok &)
static PHtmlHldV Load(TSIn &)
bool IsArg(const TStr &ArgNm) const
static const TStr UlTagNm
static TStr GetNoTag(const TStr &Str)
THtmlLx(const PSIn &_SIn, const bool &_DoParseArg=true)
static const TStr CardTagNm
unsigned long long uint64
TStr GetArgNm(const int &ArgN) const
void GetOutUrlV(TUrlV &OutUrlV) const
TStr GetStrToETag(const TStr &TagNm, const bool &TxtOnlyP=false)
bool IsUc(const char &Ch) const
void PutArg(const TStr &ArgNm, const TStr &ArgVal)
static PHtmlDoc LoadTxt(const TStr &FNm, const THtmlDocType &Type=hdtAll, const bool &DoUc=true)
PHtmlTok GetTok(const bool &DoUc=true)
TStr GetArg(const TStr &ArgNm, const TStr &DfArgVal=TStr()) const
TWebPg & operator=(const TWebPg &)
PHttpResp GetHttpResp() const
bool IsAlNum(const char &Ch) const
TStr GetStrInTag(const TStr &TagNm, const bool &TxtOnlyP=false)
static PHtmlDoc Load(TSIn &)
static const TStr H6TagNm
void MoveToBTagOrETagOrEof(const TStr &BTagNm, const TStr &ETagNm)
TStr GetIpNum(const int &IpN=-1) const
void MoveToBTag3OrEof(const TStr &TagNm1, const TStr &TagNm2, const TStr &TagNm3)
int GetChTy(const char &Ch) const
bool IsSpace(const char &Ch) const
void AddTokV(const THtmlTokV &_TokV)
TStr GetTextOnlyStrToEof()
TStr GetUcStr(const TStr &Str) const
TWebPg(const TStrV &_UrlStrV, const TStrV &_IpNumV, const PHttpResp &_HttpResp)
uint64 GetFetchMSecs() const
static const TStr ImgTagNm
TStr GetPreSpaceStr() const
TStr GetStrToETag2(const TStr &TagNm1, const TStr &TagNm2, const bool &TxtOnlyP=false)
void MoveToStrOrEof(const TStr &Str)
bool IsAlpha(const char &Ch) const
static TStr GetAsciiStr(const TChA &ChA, const char &GenericCh='_')
static const TStr AltArgNm
static PHtmlLxChDef GetChDef()
char GetUc(const char &Ch) const
static PHtmlLxChDef Load(TSIn &SIn)
void MoveToBTag2OrEof(const TStr &TagNm1, const TStr &TagNm2)
TSizeTy SearchForw(const TVal &Val, const TSizeTy &BValN=0) const
Returns the position of an element with value Val.
void Push(const char &Ch)
THtmlHldV & operator=(const THtmlHldV &)
char GetLc(const char &Ch) const
static const TStr BrTagNm
THtmlTok(const THtmlLxSym &_Sym)
void PutFetchMSecs(const uint64 &_FetchMSecs)
PHtmlDoc GetHld(const int &HldN)
THtmlLxChDef & operator=(const THtmlLxChDef &)
void MoveToBTagOrEof(const TStr &TagNm)
static PHtmlDoc New(const PSIn &SIn, const THtmlDocType &Type=hdtAll, const bool &DoUc=true)
static PWebPg New(const TStr &UrlStr, const PHttpResp &HttpResp)
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
static const TStr TitleETagNm
PHtmlTok GetTok(const int &TokN) const
static const TStr SrcArgNm
static PHtmlTok Load(TSIn &)
TKeyDat< TStr, TStr > TStrKd
static TStr GetSymStr(const THtmlLxSym &Sym)
bool IsLc(const char &Ch) const
TStr GetStrToBTag(const TStr &TagNm, const bool &TxtOnlyP=false)
TStr GetHttpBodyAsStr() const