31 for (
int CC=0; CC<Str.
Len(); CC++){BoolV[Str.
GetCh(CC)]=
true;}}
34 for (
int BoolN=0; BoolN<BoolV.
Len(); BoolN++){
35 BoolV[BoolN]=BoolV[BoolN]||OrBoolV[BoolN];}}
38 IsLoAlphaV(
TCh::Vals), IsHiAlphaV(
TCh::Vals), IsAlphaV(
TCh::Vals),
39 IsDigitV(
TCh::Vals), IsSafeV(
TCh::Vals), IsExtraV(
TCh::Vals),
40 IsNationalV(
TCh::Vals), IsPunctuationV(
TCh::Vals),
41 IsReservedV(
TCh::Vals), IsHexV(
TCh::Vals),
42 IsUnreservedV(
TCh::Vals), IsUCharV(
TCh::Vals), IsXCharV(
TCh::Vals),
43 IsSchemeV(
TCh::Vals), IsHostV(
TCh::Vals), IsHSegmentV(
TCh::Vals){
89 for (
int ChN=0; ChN<Str.
Len(); ChN++){
GetCh(Str[ChN]);}
return Str;}
91 int Len = (int) strlen(Str);
92 for (
int ChN=0; ChN<Len; ChN++){
GetCh(Str[ChN]);}
107 Str.
ToLc();
return Str;}
143 Str+=HSegStr; PathSegV.
Add(HSegStr);
160 const char *DbSlashStr=
"//";
161 Str+=Lx.
GetStr(DbSlashStr);
190 if (NrRelUrlStr.
Len()>0){
191 if (NrRelUrlStr[0]==
'/'){
192 TStr SlashStr;
int SlashChN=0;
193 while ((SlashChN<NrRelUrlStr.
Len())&&(NrRelUrlStr[SlashChN]==
'/')){
194 SlashChN++; SlashStr+=
"/";}
195 int ChN=0;
bool Found=
false;
196 while ((!Found)&&((ChN=AbsUrlStr.
SearchStr(SlashStr, ChN))!=-1)){
198 Found=((ChN==0)||(Str[0]!=
'/'))&&
199 ((ChN+SlashStr.
Len()-1==AbsUrlStr.
Len()-1)||(Str[Str.
Len()-1]!=
'/'));
204 AbsUrlStr+=NrRelUrlStr;
207 int ChN=AbsUrlStr.
Len()-1;
208 while ((ChN>=0)&&(AbsUrlStr[ChN]!=
'/')){ChN--;}
210 AbsUrlStr+=NrRelUrlStr;
214 const char *PrevDirStr=
"/../";
216 while ((ChN=AbsUrlStr.
SearchStr(PrevDirStr))!=-1){
217 int BChN=ChN;
int EChN=ChN+(int) strlen(PrevDirStr)-1;
218 while ((BChN-1>=0)&&(AbsUrlStr[BChN-1]!=
'/')){BChN--;}
222 const char *CurDirStr=
"/.";
223 while (AbsUrlStr.
DelStr(CurDirStr)){}
230 UrlStr(), RelUrlStr(_RelUrlStr), BaseUrlStr(_BaseUrlStr),
231 SchemeNm(), HostNm(),
232 PortStr(), PathStr(), SearchStr(), FragIdStr(),
233 PortN(-1), PathSegV(),
235 FinalUrlStr(), FinalHostNm(),
271 TChA DmChA;
int DmSegs=0;
272 for (
int ChN=
HostNm.
Len()-1; ChN>=0; ChN--){
275 if (DmSegs==MxDmSegs){
break;}
else {DmChA+=
'.';}
292 FinalUrlChA+=
SchemeNm; FinalUrlChA+=
"://";
295 FinalUrlChA+=
":"; FinalUrlChA+=
PortStr;}
307 for (
int PathSegN=0; PathSegN<
PathSegV.
Len(); PathSegN++){
329 return (ColonChN!=-1)&&((SlashChN==-1)||((SlashChN!=-1)&&(ColonChN<SlashChN)));
334 return UrlStr.
IsChIn(
'?');
344 const TStr& DfHostNmPrefix,
const TStr& DfHostNmSufix){
348 if (Url->
IsOk()){
return Url;}
350 if (ShortcutUrlStr.
IsChIn(
'.')){
351 UrlStr=TUrl::UrlHttpAbsPrefixStr+ShortcutUrlStr;
353 if (Url->
IsOk()){
return Url;}
356 if (ShortcutUrlStr.
IsChIn(
'.')){
357 UrlStr=TUrl::UrlHttpAbsPrefixStr+ShortcutUrlStr+
"/";
359 if (Url->
IsOk()){
return Url;}
363 DfHostNmPrefix+
"."+ShortcutUrlStr+
"."+DfHostNmSufix+
"/";
370 for (
int ChN=0; ChN<InChA.
Len(); ChN++){
375 if ((
' '<Ch)&&(Ch<=
'~')&&(Ch!=
'+')&&(Ch!=
'&')&&(Ch!=
'%')){
388 for (
int ChN=0; ChN<InChA.
Len(); ChN++){
392 }
else if (Ch==
'%') {
393 ChN++;
if (ChN==InChA.
Len()) {
break; }
394 char FirstCh = InChA[ChN];
396 ChN++;
if (ChN==InChA.
Len()) {
break; }
397 char SecondCh = InChA[ChN];
410 for (
int StrN=0; StrN<StrV.
Len(); StrN++){
411 TStr UcStr=StrV[StrN].GetUc();
412 if ((UcStr.
Len()>3)&&(UcStr!=
"HTTP")&&(UcStr!=
"HTML")&&(UcStr!=
"INDEX")&&(UcStr!=
"DEFAULT")){
413 for (
int CopyN=0; CopyN<Copies; CopyN++){
414 if (!DocChA.
Empty()){DocChA+=
' ';} DocChA+=StrV[StrN];
422 const TStr& UrlStr,
const int& MxLen,
const bool& HostOnlyP){
428 for (
int HostNmSegN=0; HostNmSegN<HostNmSegV.
Len(); HostNmSegN++){
429 if (HostNmSegN>0){DocNm+=
'.';}
430 DocNm+=HostNmSegV[HostNmSegV.
Len()-HostNmSegN-1];
436 DocNm=UrlStr.
GetLc();
451 for (
int KeyN=0; KeyN<
GetKeys(); KeyN++){
454 for (
int ValStrN=0; ValStrN<ValStrV.
Len(); ValStrN++){
455 if (KeyVals>0){SearchChA+=
"&";}
static bool IsHex(const char &Ch)
int SearchCh(const char &Ch, const int &BChN=0) const
static TStr GetHexStr(const int &Val)
void GetAbs(const TStr &AbsUrlStr)
TStr GetDmNm(const int &MxDmSegs=-1) const
static bool IsSite(const TStr &UrlStr)
bool IsHostCh(const char &Ch) const
bool IsPrefix(const char *Str) const
TStr GetHPath(TStrV &PathSegV)
void InclBoolV(TBoolV &BoolV, const TBoolV &OrBoolV)
void DefFinalUrl(const TStr &_FinalHostNm)
static TStr GetTopDownDocNm(const TStr &UrlStr, const int &MxLen=-1, const bool &HostOnlyP=false)
TSizeTy Len() const
Returns the number of elements in the vector.
const char * GetStr(const char *Str)
void InclStr(TBoolV &BoolV, const TStr &Str)
static int GetHex(const char &Ch)
static PUrl New(const TStr &RelUrlStr, const TStr &BaseUrlStr=TStr())
TStr GetSubStr(const int &BChN, const int &EChN) const
bool IsOk(const TUrlScheme _Scheme=usUndef) const
bool DelStr(const TStr &Str)
static PUrl GetUrlFromShortcut(const TStr &ShortcutUrlStr, const TStr &DfHostNmPrefix, const TStr &DfHostNmSufix)
TUrl(const TStr &_RelUrlStr, const TStr &_BaseUrlStr=TStr())
const TDat & GetDat(const TKey &Key) const
static bool IsAbs(const TStr &UrlStr)
bool IsSchemeCh(const char &Ch) const
bool IsHSegmentCh() const
TStr GetHostPort(TStr &HostNm, TStr &PortStr, int &PortN)
int ChangeStrAll(const TStr &SrcStr, const TStr &DstStr, const bool &FromStartP=false)
static const TStr UrlHttpPrefixStr
static TStr DecodeUrlStr(const TStr &UrlStr)
int SearchStr(const TStr &Str, const int &BChN=0) const
static PUrlEnv MkClone(const PUrlEnv &UrlEnv)
TStr GetToCh(const char &Ch=TUrlLxChDef::EofCh)
void InclCh(TBoolV &BoolV, const char &Ch)
TStr GetFragIdStr() const
char GetCh(const int &ChN) const
TStr GetKeyNm(const int &KeyN) const
void DelSubStr(const int &BChN, const int &EChN)
bool IsHSegmentCh(const char &Ch) const
static const TUrlLxChDef ChDef
bool IsDigitCh(const char &Ch) const
char GetCh(const char &Ch)
TStr GetSearchStr() const
void SplitOnNonAlNum(TStrV &StrV) const
bool IsChIn(const char &Ch) const
void SplitOnAllCh(const char &SplitCh, TStrV &StrV, const bool &SkipEmpty=true) const
bool IsDefFinalUrl() const
static TStr GetUrlSearchStr(const TStr &Str)
#define EAssertR(Cond, MsgStr)
void GetAbsFromBase(const TStr &RelUrlStr, const TStr &BaseUrlStr)
TStr GetStr(const TStr &Str)
static bool IsScript(const TStr &UrlStr)
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
static const TStr UrlHttpAbsPrefixStr
TStr GetFullUrlStr() const
static TStr GetDocStrFromUrlStr(const TStr &UrlStr, const int &Copies=1)