SNAP Library , Developer Reference  2013-01-07 14:03:36
SNAP, a general purpose, high performance system for analysis and manipulation of large networks
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
TUrl Class Reference

#include <url.h>

Collaboration diagram for TUrl:

List of all members.

Public Member Functions

 TUrl (const TStr &_RelUrlStr, const TStr &_BaseUrlStr=TStr())
 ~TUrl ()
 TUrl (TSIn &)
void Save (TSOut &)
bool IsOk (const TUrlScheme _Scheme=usUndef) const
TUrlScheme GetScheme ()
TStr GetUrlStr () const
TStr GetRelUrlStr () const
bool IsBaseUrl ()
TStr GetBaseUrlStr () const
TStr GetSchemeNm () const
TStr GetHostNm () const
TStr GetDmNm (const int &MxDmSegs=-1) const
bool IsPortOk () const
TStr GetPortStr () const
int GetPortN () const
TStr GetPathStr () const
int GetPathSegs () const
TStr GetPathSeg (const int &PathSegN) const
TStr GetSearchStr () const
TStr GetFragIdStr () const
bool IsIpNum () const
void PutIpNum (const TStr &_IpNum)
TStr GetIpNum () const
TStr GetIpNumOrHostNm () const
bool IsDefFinalUrl () const
TStr GetFinalUrlStr () const
TStr GetAsFinalUrlStr () const
TStr GetFinalHostNm () const
TStr GetAsFinalHostNm () const
void DefUrlAsFinal ()
void DefFinalUrl (const TStr &_FinalHostNm)
void PutHttpRqStr (const TStr &_HttpRqStr)
TStr GetHttpRqStr () const
bool IsHttpRqStr () const
void ChangeHttpRqStr (const TStr &SrcStr, const TStr &DstStr)
bool IsInHost (const TStr &_HostNm) const
bool IsInPath (const TStr &_PathStr) const
void ToLcPath ()

Static Public Member Functions

static PUrl New (const TStr &RelUrlStr, const TStr &BaseUrlStr=TStr())
static PUrl Load (TSIn &)
static bool IsAbs (const TStr &UrlStr)
static bool IsScript (const TStr &UrlStr)
static bool IsSite (const TStr &UrlStr)
static PUrl GetUrlFromShortcut (const TStr &ShortcutUrlStr, const TStr &DfHostNmPrefix, const TStr &DfHostNmSufix)
static TStr GetUrlSearchStr (const TStr &Str)
static TStr DecodeUrlStr (const TStr &UrlStr)
static TStr GetDocStrFromUrlStr (const TStr &UrlStr, const int &Copies=1)
static TStr GetTopDownDocNm (const TStr &UrlStr, const int &MxLen=-1, const bool &HostOnlyP=false)

Private Member Functions

void GetAbs (const TStr &AbsUrlStr)
void GetAbsFromBase (const TStr &RelUrlStr, const TStr &BaseUrlStr)
 UndefDefaultCopyAssign (TUrl)

Private Attributes

TCRef CRef
TUrlScheme Scheme
TStr UrlStr
TStr RelUrlStr
TStr BaseUrlStr
TStr SchemeNm
TStr HostNm
TStr PortStr
TStr PathStr
TStr SearchStr
TStr FragIdStr
int PortN
TStrV PathSegV
TStr IpNum
TStr FinalUrlStr
TStr FinalHostNm
TStr HttpRqStr

Static Private Attributes

static const TStr UrlHttpPrefixStr = "http:"
static const TStr UrlHttpAbsPrefixStr = "http://"

Friends

class TPt< TUrl >

Detailed Description

Definition at line 7 of file url.h.


Constructor & Destructor Documentation

TUrl::TUrl ( const TStr _RelUrlStr,
const TStr _BaseUrlStr = TStr() 
)

Definition at line 228 of file url.cpp.

References BaseUrlStr, TStr::ChangeStrAll(), GetAbs(), GetAbsFromBase(), IsAbs(), RelUrlStr, Scheme, TStr::ToTrunc(), and usUndef.

                                                         :
  Scheme(usUndef),
  UrlStr(), RelUrlStr(_RelUrlStr), BaseUrlStr(_BaseUrlStr),
  SchemeNm(), HostNm(),
  PortStr(), PathStr(), SearchStr(), FragIdStr(),
  PortN(-1), PathSegV(),
  IpNum(),
  FinalUrlStr(), FinalHostNm(),
  HttpRqStr(){
  RelUrlStr.ToTrunc();
  RelUrlStr.ChangeStrAll(" ", "%20");
  try {
    if (IsAbs(RelUrlStr)){
      GetAbs(RelUrlStr);
    } else
    if (IsAbs(BaseUrlStr)){
      GetAbsFromBase(RelUrlStr, BaseUrlStr);
    } else {
      Scheme=usUndef;
    }
  }
  catch (PExcept&){Scheme=usUndef;}

  //** old version
  /*
  PUrl BaseUrl;
  if (!BaseUrlStr.Empty()){ // must be outside try-block (CBuilder3.0 bug)
    BaseUrl=TUrl::New(BaseUrlStr);}
  try {
    if (!BaseUrlStr.Empty()){
      EAssertR(BaseUrl->IsOk(), "");}
    if (IsAbs(RelUrlStr)){
      GetAbs(RelUrlStr);
    } else {
      GetAbsFromBase(RelUrlStr, BaseUrlStr);
    }
  }
  catch (PExcept&){Scheme=usUndef;}
  */
}

Here is the call graph for this function:

TUrl::~TUrl ( ) [inline]

Definition at line 27 of file url.h.

{}
TUrl::TUrl ( TSIn ) [inline]

Definition at line 28 of file url.h.

References Fail.

{Fail;}

Member Function Documentation

void TUrl::ChangeHttpRqStr ( const TStr SrcStr,
const TStr DstStr 
) [inline]

Definition at line 75 of file url.h.

                                                              {
    HttpRqStr.ChangeStr(SrcStr, DstStr);}
TStr TUrl::DecodeUrlStr ( const TStr UrlStr) [static]

Definition at line 386 of file url.cpp.

References TCh::GetHex(), TCh::IsHex(), TChA::Len(), and UrlStr.

                                          {
  TChA InChA=UrlStr; TChA OutChA;
  for (int ChN=0; ChN<InChA.Len(); ChN++){
    char Ch=InChA[ChN];
    if (Ch=='+'){
      OutChA+=' ';
    } else if (Ch=='%') {
      ChN++; if (ChN==InChA.Len()) { break; }
      char FirstCh = InChA[ChN];
      if (!TCh::IsHex(FirstCh)) { break; }
      ChN++; if (ChN==InChA.Len()) { break; }
      char SecondCh = InChA[ChN];
      if (!TCh::IsHex(SecondCh)) { break; }
      OutChA+=char(TCh::GetHex(FirstCh)*16 + TCh::GetHex(SecondCh));
    } else {
      OutChA+=Ch;
    }
  }
  return OutChA;
}

Here is the call graph for this function:

void TUrl::DefFinalUrl ( const TStr _FinalHostNm)

Definition at line 284 of file url.cpp.

References EAssert, TStr::Empty(), FinalHostNm, FinalUrlStr, TStr::GetLc(), HostNm, IsDefFinalUrl(), IsOk(), PathStr, PortStr, SchemeNm, SearchStr, UrlStr, and usHttp.

Referenced by ToLcPath().

                                              {
  EAssert(IsOk(usHttp));
  EAssert(!IsDefFinalUrl());
  FinalHostNm=_FinalHostNm.GetLc();
  if (HostNm==FinalHostNm){
    FinalUrlStr=UrlStr;
  } else {
    TChA FinalUrlChA;
    FinalUrlChA+=SchemeNm; FinalUrlChA+="://";
    FinalUrlChA+=FinalHostNm;
    if (!PortStr.Empty()){
      FinalUrlChA+=":"; FinalUrlChA+=PortStr;}
    FinalUrlChA+=PathStr;
    FinalUrlChA+=SearchStr;
    FinalUrlStr=FinalUrlChA;
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void TUrl::DefUrlAsFinal ( ) [inline]

Definition at line 67 of file url.h.

References EAssert, and usHttp.

void TUrl::GetAbs ( const TStr AbsUrlStr) [private]

Definition at line 154 of file url.cpp.

References TStr::Clr(), THttp::DfPortN, EAssertR, TStr::Empty(), TUrlLx::Eof(), FragIdStr, TUrlLx::GetCh(), TUrlLx::GetHostPort(), TUrlLx::GetHPath(), TUrlLx::GetScheme(), TUrlLx::GetSearch(), TUrlLx::GetStr(), TUrlLx::GetToCh(), HostNm, IsAbs(), PathSegV, PathStr, TUrlLx::PeekCh(), PortN, PortStr, Scheme, SchemeNm, SearchStr, UrlStr, usHttp, and usOther.

Referenced by GetAbsFromBase(), and TUrl().

                                      {
  EAssertR(IsAbs(AbsUrlStr), AbsUrlStr);
  TUrlLx Lx(AbsUrlStr); TChA Str;
  Str+=SchemeNm=Lx.GetScheme(); Str+=Lx.GetCh(':');
  if (SchemeNm=="http"){
    Scheme=usHttp;
    const char *DbSlashStr="//";
    Str+=Lx.GetStr(DbSlashStr);
    Str+=Lx.GetHostPort(HostNm, PortStr, PortN);
    if (PortN==-1){PortN=THttp::DfPortN; PortStr.Clr();}
    else if (PortN==THttp::DfPortN){PortStr.Clr();}
    //**if (!PortStr.Empty()){Str+=':'; Str+=PortStr;}
    if (Lx.PeekCh()=='/'){
      PathStr=Lx.GetCh('/'); PathStr+=Lx.GetHPath(PathSegV); Str+=PathStr;}
    if (PathStr.Empty()){PathStr="/"; Str+=PathStr;}
    if (Lx.PeekCh()=='?'){
      SearchStr=Lx.GetCh('?'); SearchStr+=Lx.GetSearch(); Str+=SearchStr;}
  } else {
    Scheme=usOther; Str+=Lx.GetToCh();
  }
  while (Lx.PeekCh()==' '){Lx.GetCh();}
  if (Lx.PeekCh()=='#'){
    FragIdStr=Lx.GetCh('#'); FragIdStr+=Lx.GetToCh();
  }
  EAssertR(Lx.Eof(), "");
  UrlStr=Str;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void TUrl::GetAbsFromBase ( const TStr RelUrlStr,
const TStr BaseUrlStr 
) [private]

Definition at line 182 of file url.cpp.

References BaseUrlStr, TStr::DelStr(), TStr::DelSubStr(), EAssertR, TStr::Empty(), GetAbs(), TStr::GetLc(), TStr::GetSubStr(), IsAbs(), TStr::IsPrefix(), TStr::Len(), New(), RelUrlStr, TStr::SearchStr(), and UrlHttpPrefixStr.

Referenced by TUrl().

                                                                      {
  EAssertR(!BaseUrlStr.Empty(), "");
  PUrl Url=TUrl::New(BaseUrlStr); EAssertR(Url->IsOk(), "");
  EAssertR(IsAbs(BaseUrlStr), "");
  TStr AbsUrlStr=BaseUrlStr;
  TStr NrRelUrlStr=RelUrlStr;
  if (NrRelUrlStr.GetLc().IsPrefix(UrlHttpPrefixStr)){
    NrRelUrlStr.DelSubStr(0, UrlHttpPrefixStr.Len()-1);}
  if (NrRelUrlStr.Len()>0){
    if (NrRelUrlStr[0]=='/'){
      TStr SlashStr; int SlashChN=0;
      while ((SlashChN<NrRelUrlStr.Len())&&(NrRelUrlStr[SlashChN]=='/')){
        SlashChN++; SlashStr+="/";}
      int ChN=0; bool Found=false;
      while ((!Found)&&((ChN=AbsUrlStr.SearchStr(SlashStr, ChN))!=-1)){
        TStr Str=AbsUrlStr.GetSubStr(ChN-1, ChN+SlashStr.Len()-1+1);
        Found=((ChN==0)||(Str[0]!='/'))&&
         ((ChN+SlashStr.Len()-1==AbsUrlStr.Len()-1)||(Str[Str.Len()-1]!='/'));
        if (!Found){ChN++;}
      }
      if (Found){
        AbsUrlStr.DelSubStr(ChN, AbsUrlStr.Len()-1);
        AbsUrlStr+=NrRelUrlStr;
      }
    } else {
      int ChN=AbsUrlStr.Len()-1;
      while ((ChN>=0)&&(AbsUrlStr[ChN]!='/')){ChN--;}
      AbsUrlStr.DelSubStr(ChN+1, AbsUrlStr.Len()-1);
      AbsUrlStr+=NrRelUrlStr;
    }
  }

  const char *PrevDirStr="/../";
  {int ChN;
  while ((ChN=AbsUrlStr.SearchStr(PrevDirStr))!=-1){
    int BChN=ChN; int EChN=ChN+(int) strlen(PrevDirStr)-1;
    while ((BChN-1>=0)&&(AbsUrlStr[BChN-1]!='/')){BChN--;}
    AbsUrlStr.DelSubStr(BChN, EChN);
  }}

  const char *CurDirStr="/.";
  while (AbsUrlStr.DelStr(CurDirStr)){}

  GetAbs(AbsUrlStr);
}

Here is the call graph for this function:

Here is the caller graph for this function:

TStr TUrl::GetAsFinalHostNm ( ) const [inline]

Definition at line 65 of file url.h.

                                {
    if (IsDefFinalUrl()){return FinalHostNm;} else {return HostNm;}}
TStr TUrl::GetAsFinalUrlStr ( ) const [inline]

Definition at line 61 of file url.h.

                                {
    if (IsDefFinalUrl()){return FinalUrlStr;} else {return UrlStr;}}
TStr TUrl::GetBaseUrlStr ( ) const [inline]

Definition at line 39 of file url.h.

{return BaseUrlStr;}
TStr TUrl::GetDmNm ( const int &  MxDmSegs = -1) const

Definition at line 269 of file url.cpp.

References EAssert, HostNm, IsOk(), TStr::Len(), and TChA::Reverse().

                                            {
  EAssert(IsOk());
  TChA DmChA; int DmSegs=0;
  for (int ChN=HostNm.Len()-1; ChN>=0; ChN--){
    if (HostNm[ChN]=='.'){
      DmSegs++;
      if (DmSegs==MxDmSegs){break;} else {DmChA+='.';}
    } else {
      DmChA+=HostNm[ChN];
    }
  }
  DmChA.Reverse();
  return DmChA;
}

Here is the call graph for this function:

TStr TUrl::GetDocStrFromUrlStr ( const TStr UrlStr,
const int &  Copies = 1 
) [static]

Definition at line 407 of file url.cpp.

References TChA::Empty(), TVec< TVal >::Len(), TStr::Len(), and TStr::SplitOnNonAlNum().

                                                                   {
  TStrV StrV; UrlStr.SplitOnNonAlNum(StrV);
  TChA DocChA;
  for (int StrN=0; StrN<StrV.Len(); StrN++){
    TStr UcStr=StrV[StrN].GetUc();
    if ((UcStr.Len()>3)&&(UcStr!="HTTP")&&(UcStr!="HTML")&&(UcStr!="INDEX")&&(UcStr!="DEFAULT")){
      for (int CopyN=0; CopyN<Copies; CopyN++){
        if (!DocChA.Empty()){DocChA+=' ';} DocChA+=StrV[StrN];
      }
    }
  }
  return DocChA;
}

Here is the call graph for this function:

TStr TUrl::GetFinalHostNm ( ) const [inline]

Definition at line 63 of file url.h.

References EAssert.

TStr TUrl::GetFinalUrlStr ( ) const [inline]

Definition at line 59 of file url.h.

References EAssert.

TStr TUrl::GetFragIdStr ( ) const [inline]

Definition at line 50 of file url.h.

References EAssert.

Referenced by IsSite().

{EAssert(IsOk()); return FragIdStr;}

Here is the caller graph for this function:

TStr TUrl::GetHostNm ( ) const [inline]

Definition at line 41 of file url.h.

References EAssert.

Referenced by GetTopDownDocNm(), and THttpRq::THttpRq().

{EAssert(IsOk()); return HostNm;}

Here is the caller graph for this function:

TStr TUrl::GetHttpRqStr ( ) const [inline]

Definition at line 73 of file url.h.

{return HttpRqStr;}
TStr TUrl::GetIpNum ( ) const [inline]

Definition at line 54 of file url.h.

References EAssert.

{EAssert(IsIpNum()); return IpNum;}
TStr TUrl::GetIpNumOrHostNm ( ) const [inline]

Definition at line 55 of file url.h.

{return IsIpNum() ? GetIpNum() : GetHostNm();}
TStr TUrl::GetPathSeg ( const int &  PathSegN) const [inline]

Definition at line 48 of file url.h.

{return PathSegV[PathSegN];}
int TUrl::GetPathSegs ( ) const [inline]

Definition at line 47 of file url.h.

{return PathSegV.Len();}
TStr TUrl::GetPathStr ( ) const [inline]

Definition at line 46 of file url.h.

References EAssert.

Referenced by GetTopDownDocNm(), IsSite(), and THttpRq::THttpRq().

{EAssert(IsOk()); return PathStr;}

Here is the caller graph for this function:

int TUrl::GetPortN ( ) const [inline]

Definition at line 45 of file url.h.

References EAssert.

{EAssert(IsOk()&&(PortN!=-1)); return PortN;}
TStr TUrl::GetPortStr ( ) const [inline]

Definition at line 44 of file url.h.

References EAssert.

{EAssert(IsOk()); return PortStr;}
TStr TUrl::GetRelUrlStr ( ) const [inline]

Definition at line 37 of file url.h.

{return RelUrlStr;}

Definition at line 35 of file url.h.

{return Scheme;}
TStr TUrl::GetSchemeNm ( ) const [inline]

Definition at line 40 of file url.h.

References EAssert.

{EAssert(IsOk()); return SchemeNm;}
TStr TUrl::GetSearchStr ( ) const [inline]

Definition at line 49 of file url.h.

References EAssert.

Referenced by IsSite(), THttpRq::ParseHttpRq(), and THttpRq::THttpRq().

{EAssert(IsOk()); return SearchStr;}

Here is the caller graph for this function:

TStr TUrl::GetTopDownDocNm ( const TStr UrlStr,
const int &  MxLen = -1,
const bool &  HostOnlyP = false 
) [static]

Definition at line 421 of file url.cpp.

References GetHostNm(), TStr::GetLc(), GetPathStr(), HostNm, IsOk(), TVec< TVal >::Len(), New(), TStr::SplitOnAllCh(), and TChA::Trunc().

                                                             {
  PUrl Url=TUrl::New(UrlStr);
  TChA DocNm;
  if (Url->IsOk()){
    TStr HostNm=Url->GetHostNm().GetLc();
    TStrV HostNmSegV; HostNm.SplitOnAllCh('.', HostNmSegV, false);
    for (int HostNmSegN=0; HostNmSegN<HostNmSegV.Len(); HostNmSegN++){
      if (HostNmSegN>0){DocNm+='.';}
      DocNm+=HostNmSegV[HostNmSegV.Len()-HostNmSegN-1];
    }
    if (!HostOnlyP){
      DocNm+=Url->GetPathStr().GetLc();
    }
  } else {
    DocNm=UrlStr.GetLc();
  }
  if (MxLen!=-1){
    DocNm.Trunc(MxLen);}
  return DocNm;
}

Here is the call graph for this function:

PUrl TUrl::GetUrlFromShortcut ( const TStr ShortcutUrlStr,
const TStr DfHostNmPrefix,
const TStr DfHostNmSufix 
) [static]

Definition at line 343 of file url.cpp.

References TStr::IsChIn(), IsOk(), New(), UrlHttpAbsPrefixStr, and UrlStr.

                                                       {
  // shortcut is already correct url
  TStr UrlStr=ShortcutUrlStr;
  PUrl Url=TUrl::New(UrlStr);
  if (Url->IsOk()){return Url;}
  // add 'http://' to shortcut (if shortcut is from more segments)
  if (ShortcutUrlStr.IsChIn('.')){
    UrlStr=TUrl::UrlHttpAbsPrefixStr+ShortcutUrlStr;
    Url=TUrl::New(UrlStr);
    if (Url->IsOk()){return Url;}
  }
  // add 'http://' and '/' to shortcut (if shortcut is from more segments)
  if (ShortcutUrlStr.IsChIn('.')){
    UrlStr=TUrl::UrlHttpAbsPrefixStr+ShortcutUrlStr+"/";
    Url=TUrl::New(UrlStr);
    if (Url->IsOk()){return Url;}
  }
  // add 'http://', prefix, postfix and '/' to shortcut
  UrlStr=UrlHttpAbsPrefixStr+
   DfHostNmPrefix+"."+ShortcutUrlStr+"."+DfHostNmSufix+"/";
  Url=TUrl::New(UrlStr);
  return Url;
}

Here is the call graph for this function:

TStr TUrl::GetUrlSearchStr ( const TStr Str) [static]

Definition at line 368 of file url.cpp.

References TInt::GetHexStr(), and TChA::Len().

Referenced by TUrlEnv::GetFullUrlStr().

                                         {
  TChA InChA=Str; TChA OutChA;
  for (int ChN=0; ChN<InChA.Len(); ChN++){
    char Ch=InChA[ChN];
    if (Ch==' '){
      OutChA+='+';
    } else
    if ((' '<Ch)&&(Ch<='~')&&(Ch!='+')&&(Ch!='&')&&(Ch!='%')){
      OutChA+=Ch;
    } else {
      OutChA+='%';
      OutChA+=TInt::GetHexStr(uchar(Ch)/16);
      OutChA+=TInt::GetHexStr(uchar(Ch)%16);
    }
  }
  return OutChA;
}

Here is the call graph for this function:

Here is the caller graph for this function:

TStr TUrl::GetUrlStr ( ) const [inline]

Definition at line 36 of file url.h.

Referenced by THtmlDoc::_IsTagRedir(), TWebPg::GetOutDescUrlStrKdV(), THttpRq::GetStr(), THtmlDoc::GetTxtLnDoc(), and THtmlDoc::SaveHtmlToXml().

{return UrlStr;}

Here is the caller graph for this function:

bool TUrl::IsAbs ( const TStr UrlStr) [static]

Definition at line 324 of file url.cpp.

References TStr::GetLc(), TStr::IsPrefix(), TStr::SearchCh(), UrlHttpAbsPrefixStr, and UrlHttpPrefixStr.

Referenced by GetAbs(), GetAbsFromBase(), and TUrl().

                                  {
  if (UrlStr.GetLc().IsPrefix(UrlHttpPrefixStr)){
    return UrlStr.GetLc().IsPrefix(UrlHttpAbsPrefixStr);
  } else {
    int ColonChN=UrlStr.SearchCh(':'); int SlashChN=UrlStr.SearchCh('/');
    return (ColonChN!=-1)&&((SlashChN==-1)||((SlashChN!=-1)&&(ColonChN<SlashChN)));
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

bool TUrl::IsBaseUrl ( ) [inline]

Definition at line 38 of file url.h.

{return !BaseUrlStr.Empty();}
bool TUrl::IsDefFinalUrl ( ) const [inline]

Definition at line 57 of file url.h.

References EAssert, and usHttp.

Referenced by DefFinalUrl(), and ToLcPath().

                             {
    EAssert(IsOk(usHttp)); return !FinalUrlStr.Empty();}

Here is the caller graph for this function:

bool TUrl::IsHttpRqStr ( ) const [inline]

Definition at line 74 of file url.h.

{return !HttpRqStr.Empty();}
bool TUrl::IsInHost ( const TStr _HostNm) const [inline]

Definition at line 78 of file url.h.

References EAssert, and TStr::GetUc().

                                           {
    EAssert(IsOk()); return HostNm.GetUc().IsSuffix(_HostNm.GetUc());}

Here is the call graph for this function:

bool TUrl::IsInPath ( const TStr _PathStr) const [inline]

Definition at line 80 of file url.h.

References EAssert, and TStr::GetUc().

                                            {
    EAssert(IsOk()); return PathStr.GetUc().IsPrefix(_PathStr.GetUc());}

Here is the call graph for this function:

bool TUrl::IsIpNum ( ) const [inline]

Definition at line 52 of file url.h.

{return !IpNum.Empty();}
bool TUrl::IsOk ( const TUrlScheme  _Scheme = usUndef) const [inline]
bool TUrl::IsPortOk ( ) const [inline]

Definition at line 43 of file url.h.

References EAssert.

{ EAssert(IsOk()); return (PortN > 0); }
bool TUrl::IsScript ( const TStr UrlStr) [static]

Definition at line 333 of file url.cpp.

References TStr::IsChIn().

                                     {
  return UrlStr.IsChIn('?');
}

Here is the call graph for this function:

bool TUrl::IsSite ( const TStr UrlStr) [static]

Definition at line 337 of file url.cpp.

References TStr::Empty(), GetFragIdStr(), GetPathStr(), GetSearchStr(), IsOk(), New(), and usHttp.

                                   {
  PUrl Url=TUrl::New(UrlStr);
  return Url->IsOk(usHttp) && (Url->GetPathStr()=="/") &&
   Url->GetSearchStr().Empty() && Url->GetFragIdStr().Empty();
}

Here is the call graph for this function:

static PUrl TUrl::Load ( TSIn ) [inline, static]

Definition at line 29 of file url.h.

References Fail.

{Fail; return NULL;}
static PUrl TUrl::New ( const TStr RelUrlStr,
const TStr BaseUrlStr = TStr() 
) [inline, static]

Definition at line 25 of file url.h.

Referenced by GetAbsFromBase(), GetTopDownDocNm(), TWebPg::GetUrl(), GetUrlFromShortcut(), and IsSite().

                                                                       {
    return PUrl(new TUrl(RelUrlStr, BaseUrlStr));}

Here is the caller graph for this function:

void TUrl::PutHttpRqStr ( const TStr _HttpRqStr) [inline]

Definition at line 72 of file url.h.

{HttpRqStr=_HttpRqStr;}
void TUrl::PutIpNum ( const TStr _IpNum) [inline]

Definition at line 53 of file url.h.

{IpNum=_IpNum;}
void TUrl::Save ( TSOut ) [inline]

Definition at line 30 of file url.h.

References Fail.

{Fail;}
void TUrl::ToLcPath ( )

Definition at line 302 of file url.cpp.

References TStr::Clr(), DefFinalUrl(), TStr::Empty(), FinalHostNm, FinalUrlStr, HostNm, IsDefFinalUrl(), TStr::IsLc(), TVec< TVal >::Len(), PathSegV, PathStr, PortStr, SchemeNm, SearchStr, TStr::ToLc(), and UrlStr.

                   {
  // test if the conversion is needed
  if (!PathStr.IsLc()){
    // convert path strings to lower-case
    PathStr.ToLc();
    for (int PathSegN=0; PathSegN<PathSegV.Len(); PathSegN++){
      PathSegV[PathSegN].ToLc();}
    // recompose url
    TChA UrlChA;
    UrlChA+=SchemeNm; UrlChA+="://";
    UrlChA+=HostNm;
    if (!PortStr.Empty()){
      UrlChA+=":"; UrlChA+=PortStr;}
    UrlChA+=PathStr;
    UrlChA+=SearchStr;
    UrlStr=UrlChA;
    // recompose final-url
    if (IsDefFinalUrl()){
      FinalUrlStr.Clr(); DefFinalUrl(FinalHostNm);}
  }
}

Here is the call graph for this function:


Friends And Related Function Documentation

friend class TPt< TUrl > [friend]

Definition at line 7 of file url.h.


Member Data Documentation

Definition at line 12 of file url.h.

Referenced by GetAbsFromBase(), and TUrl().

TCRef TUrl::CRef [private]

Definition at line 7 of file url.h.

Definition at line 18 of file url.h.

Referenced by DefFinalUrl(), and ToLcPath().

Definition at line 18 of file url.h.

Referenced by DefFinalUrl(), and ToLcPath().

TStr TUrl::FragIdStr [private]

Definition at line 14 of file url.h.

Referenced by GetAbs().

TStr TUrl::HostNm [private]

Definition at line 13 of file url.h.

Referenced by DefFinalUrl(), GetAbs(), GetDmNm(), GetTopDownDocNm(), and ToLcPath().

TStr TUrl::HttpRqStr [private]

Definition at line 19 of file url.h.

TStr TUrl::IpNum [private]

Definition at line 17 of file url.h.

TStrV TUrl::PathSegV [private]

Definition at line 16 of file url.h.

Referenced by GetAbs(), and ToLcPath().

TStr TUrl::PathStr [private]

Definition at line 14 of file url.h.

Referenced by DefFinalUrl(), GetAbs(), and ToLcPath().

int TUrl::PortN [private]

Definition at line 15 of file url.h.

Referenced by GetAbs().

TStr TUrl::PortStr [private]

Definition at line 14 of file url.h.

Referenced by DefFinalUrl(), GetAbs(), and ToLcPath().

TStr TUrl::RelUrlStr [private]

Definition at line 12 of file url.h.

Referenced by GetAbsFromBase(), and TUrl().

Definition at line 11 of file url.h.

Referenced by GetAbs(), and TUrl().

TStr TUrl::SchemeNm [private]

Definition at line 13 of file url.h.

Referenced by DefFinalUrl(), GetAbs(), and ToLcPath().

TStr TUrl::SearchStr [private]

Definition at line 14 of file url.h.

Referenced by DefFinalUrl(), GetAbs(), and ToLcPath().

const TStr TUrl::UrlHttpAbsPrefixStr = "http://" [static, private]

Definition at line 10 of file url.h.

Referenced by GetUrlFromShortcut(), and IsAbs().

const TStr TUrl::UrlHttpPrefixStr = "http:" [static, private]

Definition at line 9 of file url.h.

Referenced by GetAbsFromBase(), and IsAbs().

TStr TUrl::UrlStr [private]

Definition at line 12 of file url.h.

Referenced by DecodeUrlStr(), DefFinalUrl(), GetAbs(), GetUrlFromShortcut(), and ToLcPath().


The documentation for this class was generated from the following files: