SNAP Library 4.1, User Reference  2018-07-26 16:30:42
SNAP, a general purpose, high performance system for analysis and manipulation of large networks
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
TUrlLx Class Reference

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.

83 : Bf(_Str), BfC(0){}
TChA Bf
Definition: url.cpp:79
int BfC
Definition: url.cpp:80

Member Function Documentation

bool TUrlLx::Eof ( ) const
inline

Definition at line 84 of file url.cpp.

84 {return BfC==Bf.Len();};
int Len() const
Definition: dt.h:259
TChA Bf
Definition: url.cpp:79
int BfC
Definition: url.cpp:80
char TUrlLx::GetCh ( )
inline

Definition at line 85 of file url.cpp.

85 {if (Eof()){return EofCh;} else {return Bf[BfC++];}}
static const char EofCh
Definition: url.cpp:78
bool Eof() const
Definition: url.cpp:84
TChA Bf
Definition: url.cpp:79
int BfC
Definition: url.cpp:80
char TUrlLx::GetCh ( const char &  Ch)
inline

Definition at line 87 of file url.cpp.

87 {EAssertR(GetCh()==Ch, ""); return Ch;}
char GetCh()
Definition: url.cpp:85
#define EAssertR(Cond, MsgStr)
Definition: bd.h:283
char TUrlLx::GetDigitCh ( )
inline

Definition at line 99 of file url.cpp.

99 {EAssertR(IsDigitCh(), ""); return GetCh();}
char GetCh()
Definition: url.cpp:85
#define EAssertR(Cond, MsgStr)
Definition: bd.h:283
bool IsDigitCh() const
Definition: url.cpp:98
TStr TUrlLx::GetDigits ( )
inline

Definition at line 109 of file url.cpp.

109  {TChA Str;
110  do {Str+=GetDigitCh();} while (IsDigitCh()); return Str;}
Definition: dt.h:201
char GetDigitCh()
Definition: url.cpp:99
bool IsDigitCh() const
Definition: url.cpp:98
TStr TUrlLx::GetHost ( )

Definition at line 119 of file url.cpp.

119  {TChA Str;
120  EAssertR(ChDef.IsHostCh(PeekCh()), "");
121  do {
122  while (ChDef.IsHostCh(PeekCh())){Str+=GetCh();}
123  if (PeekCh()=='.'){Str+=GetCh('.');}
124  else if (PeekCh()=='@'){GetCh('@'); Str.Clr();} // still unexplained
125  } while (ChDef.IsHostCh(PeekCh()));
126  Str.ToLc();
127  return Str;
128 }
bool IsHostCh(const char &Ch) const
Definition: url.cpp:21
char GetCh()
Definition: url.cpp:85
void Clr()
Definition: dt.h:258
char PeekCh() const
Definition: url.cpp:86
static const TUrlLxChDef ChDef
Definition: url.cpp:82
TChA & ToLc()
Definition: dt.cpp:552
Definition: dt.h:201
#define EAssertR(Cond, MsgStr)
Definition: bd.h:283
TStr TUrlLx::GetHostPort ( TStr HostNm,
TStr PortStr,
int &  PortN 
)

Definition at line 130 of file url.cpp.

130  {TChA Str;
131  Str+=HostNm=GetHost();
132  if (PeekCh()==':'){
133  Str+=GetCh(':');
134  if (IsDigitCh()){Str+=PortStr=GetDigits(); PortN=PortStr.GetInt();}
135  }
136  return Str;
137 }
int GetInt() const
Definition: dt.h:578
char GetCh()
Definition: url.cpp:85
TStr GetDigits()
Definition: url.cpp:109
char PeekCh() const
Definition: url.cpp:86
Definition: dt.h:201
TStr GetHost()
Definition: url.cpp:119
bool IsDigitCh() const
Definition: url.cpp:98
TStr TUrlLx::GetHPath ( TStrV PathSegV)

Definition at line 139 of file url.cpp.

139  {TChA Str; TChA HSegStr; bool Cont;
140  do {
141  while (PeekCh()=='/'){GetCh('/');} // prevent multiple '/'
142  HSegStr.Clr(); while (IsHSegmentCh()){HSegStr+=GetHSegmentCh();}
143  Str+=HSegStr; PathSegV.Add(HSegStr);
144  Cont=(PeekCh()=='/'); if (Cont){Str+=GetCh('/');}
145  } while (Cont);
146  return Str;
147 }
char GetCh()
Definition: url.cpp:85
void Clr()
Definition: dt.h:258
bool IsHSegmentCh() const
Definition: url.cpp:100
char PeekCh() const
Definition: url.cpp:86
Definition: dt.h:201
char GetHSegmentCh()
Definition: url.cpp:101
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:602
char TUrlLx::GetHSegmentCh ( )
inline

Definition at line 101 of file url.cpp.

101 {EAssertR(IsHSegmentCh(), ""); return GetCh();}
char GetCh()
Definition: url.cpp:85
bool IsHSegmentCh() const
Definition: url.cpp:100
#define EAssertR(Cond, MsgStr)
Definition: bd.h:283
TStr TUrlLx::GetScheme ( )
inline

Definition at line 105 of file url.cpp.

105  {TChA Str;
106  Str+=GetSchemeCh(); while (IsSchemeCh()){Str+=GetCh();}
107  Str.ToLc(); return Str;}
char GetSchemeCh()
Definition: url.cpp:97
char GetCh()
Definition: url.cpp:85
bool IsSchemeCh() const
Definition: url.cpp:96
TChA & ToLc()
Definition: dt.cpp:552
Definition: dt.h:201
char TUrlLx::GetSchemeCh ( )
inline

Definition at line 97 of file url.cpp.

97 {EAssertR(IsSchemeCh(), ""); return GetCh();}
char GetCh()
Definition: url.cpp:85
bool IsSchemeCh() const
Definition: url.cpp:96
#define EAssertR(Cond, MsgStr)
Definition: bd.h:283
TStr TUrlLx::GetSearch ( )
inline

Definition at line 113 of file url.cpp.

113 {return GetToCh('#');}
TStr GetToCh(const char &Ch=TUrlLxChDef::EofCh)
Definition: url.cpp:102
TStr TUrlLx::GetStr ( const TStr Str)
inline

Definition at line 88 of file url.cpp.

88  {
89  for (int ChN=0; ChN<Str.Len(); ChN++){GetCh(Str[ChN]);} return Str;}
int Len() const
Definition: dt.h:487
char GetCh()
Definition: url.cpp:85
const char* TUrlLx::GetStr ( const char *  Str)
inline

Definition at line 90 of file url.cpp.

90  {
91  int Len = (int) strlen(Str);
92  for (int ChN=0; ChN<Len; ChN++){GetCh(Str[ChN]);}
93  return Str;
94  }
char GetCh()
Definition: url.cpp:85
TStr TUrlLx::GetToCh ( const char &  Ch = TUrlLxChDef::EofCh)
inline

Definition at line 102 of file url.cpp.

102  {TChA Str;
103  while ((PeekCh()!=EofCh)&&(PeekCh()!=Ch)){Str+=GetCh();} return Str;}
char GetCh()
Definition: url.cpp:85
static const char EofCh
Definition: url.cpp:78
char PeekCh() const
Definition: url.cpp:86
Definition: dt.h:201
bool TUrlLx::IsDigitCh ( ) const
inline

Definition at line 98 of file url.cpp.

98 {return ChDef.IsDigitCh(PeekCh());}
char PeekCh() const
Definition: url.cpp:86
static const TUrlLxChDef ChDef
Definition: url.cpp:82
bool IsDigitCh(const char &Ch) const
Definition: url.cpp:19
bool TUrlLx::IsHSegmentCh ( ) const
inline

Definition at line 100 of file url.cpp.

100 {return ChDef.IsHSegmentCh(PeekCh());}
char PeekCh() const
Definition: url.cpp:86
bool IsHSegmentCh(const char &Ch) const
Definition: url.cpp:22
static const TUrlLxChDef ChDef
Definition: url.cpp:82
bool TUrlLx::IsSchemeCh ( ) const
inline

Definition at line 96 of file url.cpp.

96 {return ChDef.IsSchemeCh(PeekCh());}
bool IsSchemeCh(const char &Ch) const
Definition: url.cpp:20
char PeekCh() const
Definition: url.cpp:86
static const TUrlLxChDef ChDef
Definition: url.cpp:82
char TUrlLx::PeekCh ( ) const
inline

Definition at line 86 of file url.cpp.

86 {if (Eof()){return EofCh;} else {return Bf[BfC];}}
static const char EofCh
Definition: url.cpp:78
bool Eof() const
Definition: url.cpp:84
TChA Bf
Definition: url.cpp:79
int BfC
Definition: url.cpp:80

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
staticprivate

Definition at line 78 of file url.cpp.


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