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
TUrlEnv Class Reference

#include <url.h>

Collaboration diagram for TUrlEnv:

List of all members.

Public Member Functions

 TUrlEnv ()
 TUrlEnv (const TUrlEnv &UrlEnv)
 ~TUrlEnv ()
 TUrlEnv (TSIn &SIn)
void Save (TSOut &SOut)
TUrlEnvoperator= (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 >

Detailed Description

Definition at line 102 of file url.h.


Constructor & Destructor Documentation

TUrlEnv::TUrlEnv ( ) [inline]

Definition at line 108 of file url.h.

Referenced by MkClone().

           :
    KeyNmV(), KeyNmToValH(10){}

Here is the caller graph for this function:

TUrlEnv::TUrlEnv ( const TUrlEnv UrlEnv) [inline]

Definition at line 110 of file url.h.

                                :
    KeyNmV(UrlEnv.KeyNmV), KeyNmToValH(UrlEnv.KeyNmToValH){}
TUrlEnv::~TUrlEnv ( ) [inline]

Definition at line 125 of file url.h.

{}
TUrlEnv::TUrlEnv ( TSIn SIn) [inline]

Definition at line 126 of file url.h.

: KeyNmV(SIn), KeyNmToValH(SIn){}

Member Function Documentation

void TUrlEnv::AddKeyVal ( const TStr KeyNm,
const TStr ValStr 
) [inline]

Definition at line 139 of file url.h.

Referenced by New().

                                                       {
    if (!IsKey(KeyNm)){KeyNmV.Add(KeyNm); KeyNmToValH.AddKey(KeyNm);}
    KeyNmToValH.GetDat(KeyNm).Clr();
    KeyNmToValH.GetDat(KeyNm).Add(ValStr);}

Here is the caller graph for this function:

void TUrlEnv::AddToKeyVal ( const TStr KeyNm,
const TStr ValStr 
) [inline]

Definition at line 143 of file url.h.

Referenced by THttpRq::ParseSearch().

                                                         {
    if (!IsKey(KeyNm)){KeyNmV.Add(KeyNm); KeyNmToValH.AddKey(KeyNm);}
    KeyNmToValH.GetDat(KeyNm).Add(ValStr);}

Here is the caller graph for this function:

bool TUrlEnv::Empty ( ) const [inline]

Definition at line 148 of file url.h.

{return KeyNmV.Empty();}
TStr TUrlEnv::GetBaseUrlStr ( ) const [inline]

Definition at line 136 of file url.h.

{return BaseUrlStr;}

Definition at line 445 of file url.cpp.

References BaseUrlStr, THash< TKey, TDat, THashFunc >::GetDat(), GetKeyNm(), GetKeys(), TUrl::GetUrlSearchStr(), KeyNmToValH, and TVec< TVal >::Len().

Referenced by THtmlDoc::_IsTagRedir().

                                  {
  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;
}

Here is the call graph for this function:

Here is the caller graph for this function:

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]

Definition at line 152 of file url.h.

Referenced by GetFullUrlStr().

{return KeyNmV[KeyN];}

Here is the caller graph for this function:

int TUrlEnv::GetKeys ( ) const [inline]

Definition at line 149 of file url.h.

Referenced by GetFullUrlStr().

{return KeyNmV.Len();}

Here is the caller graph for this function:

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]

Definition at line 155 of file url.h.

                                     {
    return KeyNmToValH.GetDat(KeyNmV[KeyN]).Len();}
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]

Definition at line 127 of file url.h.

{return new TUrlEnv(SIn);}
PUrlEnv TUrlEnv::MkClone ( const PUrlEnv UrlEnv) [static]

Definition at line 465 of file url.cpp.

References TUrlEnv().

                                             {
  PUrlEnv CloneUrlEnv=
   PUrlEnv(new TUrlEnv(*UrlEnv));
  return CloneUrlEnv;
}

Here is the call graph for this function:

static PUrlEnv TUrlEnv::New ( ) [inline, static]

Definition at line 112 of file url.h.

{return new TUrlEnv();}
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.

References AddKeyVal(), and PutBaseUrlStr().

                                                         {
    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;}

Here is the call graph for this function:

TUrlEnv& TUrlEnv::operator= ( const TUrlEnv Env) [inline]

Definition at line 130 of file url.h.

References KeyNmToValH, and KeyNmV.

                                        {
    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.

Referenced by New().

{BaseUrlStr=_BaseUrlStr;}

Here is the caller graph for this function:

void TUrlEnv::Save ( TSOut SOut) [inline]

Definition at line 128 of file url.h.

{KeyNmV.Save(SOut); KeyNmToValH.Save(SOut);}

Friends And Related Function Documentation

friend class TPt< TUrlEnv > [friend]

Definition at line 102 of file url.h.


Member Data Documentation

Definition at line 104 of file url.h.

Referenced by GetFullUrlStr().

TCRef TUrlEnv::CRef [private]

Definition at line 102 of file url.h.

Definition at line 106 of file url.h.

Referenced by GetFullUrlStr(), and operator=().

Definition at line 105 of file url.h.

Referenced by operator=().


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