SNAP Library 2.1, User Reference  2013-09-25 10:47:25
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
TUrlLx Class Reference

List of all members.

Public Member Functions

 TUrlLx (const TStr &_Str)
bool Eof () const
char GetCh ()
char PeekCh () const
char GetCh (const char &Ch)
TStr GetStr (const TStr &Str)
const char * GetStr (const char *Str)
bool IsSchemeCh () const
char GetSchemeCh ()
bool IsDigitCh () const
char GetDigitCh ()
bool IsHSegmentCh () const
char GetHSegmentCh ()
TStr GetToCh (const char &Ch=TUrlLxChDef::EofCh)
TStr GetScheme ()
TStr GetHost ()
TStr GetDigits ()
TStr GetHostPort (TStr &HostNm, TStr &PortStr, int &PortN)
TStr GetHPath (TStrV &PathSegV)
TStr GetSearch ()

Static Public Attributes

static const TUrlLxChDef ChDef

Private Attributes

TChA Bf
int BfC

Static Private Attributes

static const char EofCh = TUrlLxChDef::EofCh

Detailed Description

Definition at line 76 of file url.cpp.


Constructor & Destructor Documentation

TUrlLx::TUrlLx ( const TStr _Str) [inline]

Definition at line 83 of file url.cpp.

: Bf(_Str), BfC(0){}

Member Function Documentation

bool TUrlLx::Eof ( ) const [inline]

Definition at line 84 of file url.cpp.

{return BfC==Bf.Len();};
char TUrlLx::GetCh ( ) [inline]

Definition at line 85 of file url.cpp.

{if (Eof()){return EofCh;} else {return Bf[BfC++];}}
char TUrlLx::GetCh ( const char &  Ch) [inline]

Definition at line 87 of file url.cpp.

{EAssertR(GetCh()==Ch, ""); return Ch;}
char TUrlLx::GetDigitCh ( ) [inline]

Definition at line 99 of file url.cpp.

{EAssertR(IsDigitCh(), ""); return GetCh();}
TStr TUrlLx::GetDigits ( ) [inline]

Definition at line 109 of file url.cpp.

                  {TChA Str;
    do {Str+=GetDigitCh();} while (IsDigitCh()); return Str;}

Definition at line 119 of file url.cpp.

                    {TChA Str;
  EAssertR(ChDef.IsHostCh(PeekCh()), "");
  do {
    while (ChDef.IsHostCh(PeekCh())){Str+=GetCh();}
    if (PeekCh()=='.'){Str+=GetCh('.');}
    else if (PeekCh()=='@'){GetCh('@'); Str.Clr();} // still unexplained
  } while (ChDef.IsHostCh(PeekCh()));
  Str.ToLc();
  return Str;
}
TStr TUrlLx::GetHostPort ( TStr HostNm,
TStr PortStr,
int &  PortN 
)

Definition at line 130 of file url.cpp.

                                                               {TChA Str;
  Str+=HostNm=GetHost();
  if (PeekCh()==':'){
    Str+=GetCh(':');
    if (IsDigitCh()){Str+=PortStr=GetDigits(); PortN=PortStr.GetInt();}
  }
  return Str;
}
TStr TUrlLx::GetHPath ( TStrV PathSegV)

Definition at line 139 of file url.cpp.

                                    {TChA Str; TChA HSegStr; bool Cont;
  do {
    while (PeekCh()=='/'){GetCh('/');} // prevent multiple '/'
    HSegStr.Clr(); while (IsHSegmentCh()){HSegStr+=GetHSegmentCh();}
    Str+=HSegStr; PathSegV.Add(HSegStr);
    Cont=(PeekCh()=='/'); if (Cont){Str+=GetCh('/');}
  } while (Cont);
  return Str;
}
char TUrlLx::GetHSegmentCh ( ) [inline]

Definition at line 101 of file url.cpp.

{EAssertR(IsHSegmentCh(), ""); return GetCh();}
TStr TUrlLx::GetScheme ( ) [inline]

Definition at line 105 of file url.cpp.

                  {TChA Str;
    Str+=GetSchemeCh(); while (IsSchemeCh()){Str+=GetCh();}
    Str.ToLc(); return Str;}
char TUrlLx::GetSchemeCh ( ) [inline]

Definition at line 97 of file url.cpp.

{EAssertR(IsSchemeCh(), ""); return GetCh();}
TStr TUrlLx::GetSearch ( ) [inline]

Definition at line 113 of file url.cpp.

{return GetToCh('#');}
TStr TUrlLx::GetStr ( const TStr Str) [inline]

Definition at line 88 of file url.cpp.

                              {
    for (int ChN=0; ChN<Str.Len(); ChN++){GetCh(Str[ChN]);} return Str;}
const char* TUrlLx::GetStr ( const char *  Str) [inline]

Definition at line 90 of file url.cpp.

                                     {
        int Len = (int) strlen(Str);
    for (int ChN=0; ChN<Len; ChN++){GetCh(Str[ChN]);} 
        return Str;
  }
TStr TUrlLx::GetToCh ( const char &  Ch = TUrlLxChDef::EofCh) [inline]

Definition at line 102 of file url.cpp.

                                               {TChA Str;
    while ((PeekCh()!=EofCh)&&(PeekCh()!=Ch)){Str+=GetCh();} return Str;}
bool TUrlLx::IsDigitCh ( ) const [inline]

Definition at line 98 of file url.cpp.

{return ChDef.IsDigitCh(PeekCh());}
bool TUrlLx::IsHSegmentCh ( ) const [inline]

Definition at line 100 of file url.cpp.

{return ChDef.IsHSegmentCh(PeekCh());}
bool TUrlLx::IsSchemeCh ( ) const [inline]

Definition at line 96 of file url.cpp.

{return ChDef.IsSchemeCh(PeekCh());}
char TUrlLx::PeekCh ( ) const [inline]

Definition at line 86 of file url.cpp.

{if (Eof()){return EofCh;} else {return Bf[BfC];}}

Member Data Documentation

TChA TUrlLx::Bf [private]

Definition at line 79 of file url.cpp.

int TUrlLx::BfC [private]

Definition at line 80 of file url.cpp.

const TUrlLxChDef TUrlLx::ChDef [static]

Definition at line 82 of file url.cpp.

const char TUrlLx::EofCh = TUrlLxChDef::EofCh [static, private]

Definition at line 78 of file url.cpp.


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