9 static const
TStr UrlHttpPrefixStr;
10 static const
TStr UrlHttpAbsPrefixStr;
12 TStr UrlStr, RelUrlStr, BaseUrlStr;
14 TStr PortStr, PathStr, SearchStr, FragIdStr;
18 TStr FinalUrlStr, FinalHostNm;
20 void GetAbs(const
TStr& AbsUrlStr);
21 void GetAbsFromBase(const
TStr& RelUrlStr, const
TStr& BaseUrlStr);
24 TUrl(const
TStr& _RelUrlStr, const
TStr& _BaseUrlStr=
TStr());
25 static
PUrl New(const TStr& RelUrlStr, const TStr& BaseUrlStr=TStr()){
26 return PUrl(
new TUrl(RelUrlStr, BaseUrlStr));}
34 else {
return Scheme==_Scheme;}}
42 TStr GetDmNm(
const int& MxDmSegs=-1)
const;
52 bool IsIpNum()
const {
return !IpNum.Empty();}
60 EAssert(IsDefFinalUrl());
return FinalUrlStr;}
62 if (IsDefFinalUrl()){
return FinalUrlStr;}
else {
return UrlStr;}}
64 EAssert(IsDefFinalUrl());
return FinalHostNm;}
66 if (IsDefFinalUrl()){
return FinalHostNm;}
else {
return HostNm;}}
69 FinalUrlStr=UrlStr; FinalHostNm=HostNm;}
70 void DefFinalUrl(
const TStr& _FinalHostNm);
76 HttpRqStr.ChangeStr(SrcStr, DstStr);}
79 EAssert(IsOk());
return HostNm.GetUc().IsSuffix(_HostNm.
GetUc());}
81 EAssert(IsOk());
return PathStr.GetUc().IsPrefix(_PathStr.
GetUc());}
84 static bool IsAbs(
const TStr& UrlStr);
85 static bool IsScript(
const TStr& UrlStr);
86 static bool IsSite(
const TStr& UrlStr);
88 static PUrl GetUrlFromShortcut(
const TStr& ShortcutUrlStr,
89 const TStr& DfHostNmPrefix,
const TStr& DfHostNmSufix);
90 static TStr GetUrlSearchStr(
const TStr& Str);
92 static TStr DecodeUrlStr(
const TStr& UrlStr);
93 static TStr GetDocStrFromUrlStr(
const TStr& UrlStr,
const int& Copies=1);
94 static TStr GetTopDownDocNm(
95 const TStr& UrlStr,
const int& MxLen=-1,
const bool& HostOnlyP=
false);
110 KeyNmV(), KeyNmToValH(10){}
112 KeyNmV(UrlEnv.KeyNmV), KeyNmToValH(UrlEnv.KeyNmToValH){}
121 if (!KeyNm1.Empty()){UrlEnv->
AddKeyVal(KeyNm1, ValStr1);}
122 if (!KeyNm2.Empty()){UrlEnv->
AddKeyVal(KeyNm2, ValStr2);}
123 if (!KeyNm3.Empty()){UrlEnv->
AddKeyVal(KeyNm3, ValStr3);}
124 if (!KeyNm4.Empty()){UrlEnv->
AddKeyVal(KeyNm4, ValStr4);}
129 void Save(
TSOut& SOut){KeyNmV.Save(SOut); KeyNmToValH.Save(SOut);}
141 if (!IsKey(KeyNm)){KeyNmV.Add(KeyNm); KeyNmToValH.AddKey(KeyNm);}
142 KeyNmToValH.GetDat(KeyNm).Clr();
143 KeyNmToValH.GetDat(KeyNm).Add(ValStr);}
145 if (!IsKey(KeyNm)){KeyNmV.Add(KeyNm); KeyNmToValH.AddKey(KeyNm);}
146 KeyNmToValH.GetDat(KeyNm).Add(ValStr);}
149 bool Empty()
const {
return KeyNmV.Empty();}
151 bool IsKey(
const TStr& KeyNm)
const {
return KeyNmV.SearchForw(KeyNm)!=-1;}
152 int GetKeyN(
const TStr& KeyNm)
const {
return KeyNmV.SearchForw(KeyNm);}
157 return KeyNmToValH.GetDat(KeyNmV[KeyN]).Len();}
159 return KeyNmToValH.GetDat(KeyNm).Len();}
161 return KeyNmToValH.GetDat(KeyNmV[KeyN])[ValN];}
163 if (KeyNmToValH.IsKey(KeyNm)){
164 return KeyNmToValH.GetDat(KeyNm)[ValN];}
165 else {
return DfVal;}}
168 TStr GetFullUrlStr()
const;
TStr GetRelUrlStr() const
#define UndefDefaultCopyAssign(TNm)
static TStr EncodeUrlStr(const TStr &Str)
TStr GetVal(const TStr &KeyNm, const int &ValN=0, const TStr &DfVal="") const
TStr GetBaseUrlStr() const
static PUrlEnv New(const TStr &BaseUrlStr, const TStr &KeyNm1=TStr(), const TStr &ValStr1=TStr(), const TStr &KeyNm2=TStr(), const TStr &ValStr2=TStr(), const TStr &KeyNm3=TStr(), const TStr &ValStr3=TStr(), const TStr &KeyNm4=TStr(), const TStr &ValStr4=TStr())
TStr GetFinalHostNm() const
void AddKeyVal(const TStr &KeyNm, const TStr &ValStr)
TUrlEnv(const TUrlEnv &UrlEnv)
void AddToKeyVal(const TStr &KeyNm, const TStr &ValStr)
bool IsInPath(const TStr &_PathStr) const
bool IsOk(const TUrlScheme _Scheme=usUndef) const
THash< TInt, PUrl > TIdToUrlH
TStr GetAsFinalUrlStr() const
void PutHttpRqStr(const TStr &_HttpRqStr)
static PUrlEnv Load(TSIn &SIn)
#define ClassTP(TNm, PNm)
#define ClassTPV(TNm, PNm, TNmV)
TStr GetIpNumOrHostNm() const
void ChangeHttpRqStr(const TStr &SrcStr, const TStr &DstStr)
bool IsInHost(const TStr &_HostNm) const
TStr GetVal(const int &KeyN, const int &ValN=0) const
int GetVals(const int &KeyN) const
TStr GetPathSeg(const int &PathSegN) const
TQQueue< TIdUrlPr > TIdUrlPrQ
TStr GetFragIdStr() const
TStr GetKeyNm(const int &KeyN) const
bool IsKey(const TStr &KeyNm) const
TStr GetSearchStr() const
void PutBaseUrlStr(const TStr &_BaseUrlStr)
TStr GetAsFinalHostNm() const
bool IsDefFinalUrl() const
int GetKeyN(const TStr &KeyNm) const
void PutIpNum(const TStr &_IpNum)
TStr GetFinalUrlStr() const
TStr GetHttpRqStr() const
TPair< TInt, PUrl > TIdUrlPr
int GetVals(const TStr &KeyNm) const
TStr GetBaseUrlStr() const
TUrlEnv & operator=(const TUrlEnv &Env)
Vector is a sequence TVal objects representing an array that can change in size.