SNAP Library , User Reference
2013-01-07 14:03:36
SNAP, a general purpose, high performance system for analysis and manipulation of large networks
|
#include <url.h>
Public Member Functions | |
TUrlEnv () | |
TUrlEnv (const TUrlEnv &UrlEnv) | |
~TUrlEnv () | |
TUrlEnv (TSIn &SIn) | |
void | Save (TSOut &SOut) |
TUrlEnv & | operator= (const TUrlEnv &Env) |
void | PutBaseUrlStr (const TStr &_BaseUrlStr) |
TStr | GetBaseUrlStr () const |
void | AddKeyVal (const TStr &KeyNm, const TStr &ValStr) |
void | AddToKeyVal (const TStr &KeyNm, const TStr &ValStr) |
bool | Empty () const |
int | GetKeys () const |
bool | IsKey (const TStr &KeyNm) const |
int | GetKeyN (const TStr &KeyNm) const |
TStr | GetKeyNm (const int &KeyN) const |
int | GetVals (const int &KeyN) const |
int | GetVals (const TStr &KeyNm) const |
TStr | GetVal (const int &KeyN, const int &ValN=0) const |
TStr | GetVal (const TStr &KeyNm, const int &ValN=0, const TStr &DfVal="") const |
TStr | GetFullUrlStr () const |
Static Public Member Functions | |
static PUrlEnv | New () |
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()) |
static PUrlEnv | Load (TSIn &SIn) |
static PUrlEnv | MkClone (const PUrlEnv &UrlEnv) |
Private Attributes | |
TCRef | CRef |
TStr | BaseUrlStr |
TStrV | KeyNmV |
TStrStrVH | KeyNmToValH |
Friends | |
class | TPt< TUrlEnv > |
TUrlEnv::TUrlEnv | ( | ) | [inline] |
Definition at line 108 of file url.h.
: KeyNmV(), KeyNmToValH(10){}
TUrlEnv::TUrlEnv | ( | const TUrlEnv & | UrlEnv | ) | [inline] |
Definition at line 110 of file url.h.
: KeyNmV(UrlEnv.KeyNmV), KeyNmToValH(UrlEnv.KeyNmToValH){}
TUrlEnv::~TUrlEnv | ( | ) | [inline] |
TUrlEnv::TUrlEnv | ( | TSIn & | SIn | ) | [inline] |
Definition at line 126 of file url.h.
: KeyNmV(SIn), KeyNmToValH(SIn){}
void TUrlEnv::AddKeyVal | ( | const TStr & | KeyNm, |
const TStr & | ValStr | ||
) | [inline] |
Definition at line 139 of file url.h.
{ if (!IsKey(KeyNm)){KeyNmV.Add(KeyNm); KeyNmToValH.AddKey(KeyNm);} KeyNmToValH.GetDat(KeyNm).Clr(); KeyNmToValH.GetDat(KeyNm).Add(ValStr);}
void TUrlEnv::AddToKeyVal | ( | const TStr & | KeyNm, |
const TStr & | ValStr | ||
) | [inline] |
Definition at line 143 of file url.h.
{ if (!IsKey(KeyNm)){KeyNmV.Add(KeyNm); KeyNmToValH.AddKey(KeyNm);} KeyNmToValH.GetDat(KeyNm).Add(ValStr);}
bool TUrlEnv::Empty | ( | ) | const [inline] |
TStr TUrlEnv::GetBaseUrlStr | ( | ) | const [inline] |
Definition at line 136 of file url.h.
{return BaseUrlStr;}
TStr TUrlEnv::GetFullUrlStr | ( | ) | const |
Definition at line 445 of file url.cpp.
{ if (GetKeys()==0){return TStr();} TChA SearchChA; SearchChA+=BaseUrlStr; SearchChA+="?"; int KeyVals=0; for (int KeyN=0; KeyN<GetKeys(); KeyN++){ TStr KeyNm=GetKeyNm(KeyN); TStrV ValStrV=KeyNmToValH.GetDat(KeyNm); for (int ValStrN=0; ValStrN<ValStrV.Len(); ValStrN++){ if (KeyVals>0){SearchChA+="&";} SearchChA+=TUrl::GetUrlSearchStr(KeyNm); SearchChA+='='; SearchChA+=TUrl::GetUrlSearchStr(ValStrV[ValStrN]); KeyVals++; } } return SearchChA; }
int TUrlEnv::GetKeyN | ( | const TStr & | KeyNm | ) | const [inline] |
Definition at line 151 of file url.h.
{return KeyNmV.SearchForw(KeyNm);}
TStr TUrlEnv::GetKeyNm | ( | const int & | KeyN | ) | const [inline] |
int TUrlEnv::GetKeys | ( | ) | const [inline] |
TStr TUrlEnv::GetVal | ( | const int & | KeyN, |
const int & | ValN = 0 |
||
) | const [inline] |
Definition at line 159 of file url.h.
{ return KeyNmToValH.GetDat(KeyNmV[KeyN])[ValN];}
TStr TUrlEnv::GetVal | ( | const TStr & | KeyNm, |
const int & | ValN = 0 , |
||
const TStr & | DfVal = "" |
||
) | const [inline] |
Definition at line 161 of file url.h.
{ if (KeyNmToValH.IsKey(KeyNm)){ return KeyNmToValH.GetDat(KeyNm)[ValN];} else {return DfVal;}}
int TUrlEnv::GetVals | ( | const int & | KeyN | ) | const [inline] |
int TUrlEnv::GetVals | ( | const TStr & | KeyNm | ) | const [inline] |
Definition at line 157 of file url.h.
{ return KeyNmToValH.GetDat(KeyNm).Len();}
bool TUrlEnv::IsKey | ( | const TStr & | KeyNm | ) | const [inline] |
Definition at line 150 of file url.h.
{return KeyNmV.SearchForw(KeyNm)!=-1;}
static PUrlEnv TUrlEnv::Load | ( | TSIn & | SIn | ) | [inline, static] |
PUrlEnv TUrlEnv::MkClone | ( | const PUrlEnv & | UrlEnv | ) | [static] |
static PUrlEnv TUrlEnv::New | ( | ) | [inline, static] |
static PUrlEnv TUrlEnv::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() |
||
) | [inline, static] |
Definition at line 113 of file url.h.
{ PUrlEnv UrlEnv=New(); UrlEnv->PutBaseUrlStr(BaseUrlStr); if (!KeyNm1.Empty()){UrlEnv->AddKeyVal(KeyNm1, ValStr1);} if (!KeyNm2.Empty()){UrlEnv->AddKeyVal(KeyNm2, ValStr2);} if (!KeyNm3.Empty()){UrlEnv->AddKeyVal(KeyNm3, ValStr3);} if (!KeyNm4.Empty()){UrlEnv->AddKeyVal(KeyNm4, ValStr4);} return UrlEnv;}
Definition at line 130 of file url.h.
{ if (this!=&Env){KeyNmV=Env.KeyNmV; KeyNmToValH=Env.KeyNmToValH;} return *this;}
void TUrlEnv::PutBaseUrlStr | ( | const TStr & | _BaseUrlStr | ) | [inline] |
Definition at line 135 of file url.h.
{BaseUrlStr=_BaseUrlStr;}
void TUrlEnv::Save | ( | TSOut & | SOut | ) | [inline] |
TStr TUrlEnv::BaseUrlStr [private] |
TCRef TUrlEnv::CRef [private] |
TStrStrVH TUrlEnv::KeyNmToValH [private] |
TStrV TUrlEnv::KeyNmV [private] |