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

#include <lx.h>

Collaboration diagram for TLxChDef:

List of all members.

Public Member Functions

 TLxChDef (const TLxChDefTy &ChDefTy)
 TLxChDef (TSIn &SIn)
void Save (TSOut &SOut)
TLxChDefoperator= (const TLxChDef &ChDef)
int GetChTy (const char &Ch) const
bool IsTerm (const char &Ch) const
bool IsSpace (const char &Ch) const
bool IsAlpha (const char &Ch) const
bool IsNum (const char &Ch) const
bool IsAlNum (const char &Ch) const
char GetUc (const char &Ch) const
bool IsNmStr (const TStr &Str) const
TStr GetUcStr (const TStr &Str) const

Static Public Member Functions

static PLxChDef New (const TLxChDefTy &ChDefTy=lcdtUsAscii)
static PLxChDef Load (TSIn &SIn)
static PLxChDef GetChDef (const TLxChDefTy &ChDefTy=lcdtUsAscii)

Private Member Functions

void SetUcCh (const TStr &Str)
void SetChTy (const TLxChTy &ChTy, const TStr &Str)

Private Attributes

TCRef CRef
TIntV ChTyV
TChV UcChV

Friends

class TPt< TLxChDef >

Detailed Description

Definition at line 8 of file lx.h.


Constructor & Destructor Documentation

TLxChDef::TLxChDef ( const TLxChDefTy ChDefTy)

Definition at line 13 of file lx.cpp.

References ChTyV, TCh::CrCh, TCh::EofCh, Fail, lcdtUsAscii, lcdtYuAscii, lctAlpha, lctNum, lctSpace, lctSSym, lctTerm, TCh::LfCh, TCh::Mn, TCh::Mx, TVec< TVal >::PutAll(), SetChTy(), SetUcCh(), and UcChV.

                                           :
  ChTyV(TCh::Vals), UcChV(TCh::Vals){

  if (ChDefTy==lcdtUsAscii){
    // Character-Types
    ChTyV.PutAll(TInt(lctSpace));
    SetChTy(lctNum, "0123456789");
    SetChTy(lctAlpha, "ABCDEFGHIJKLMNOPQRSTUVWXYZ");
    SetChTy(lctAlpha, "abcdefghijklmnopqrstuvwxyz");
    SetChTy(lctAlpha, "@_");
    SetChTy(lctSSym, "\"'.,:;+-*/%!#|&<=>?()[]{}");
    SetChTy(lctTerm, TStr(TCh::CrCh));
    SetChTy(lctTerm, TStr(TCh::LfCh));
    SetChTy(lctTerm, TStr(TCh::EofCh));

    // Upper-Case
    for (int Ch=TCh::Mn; Ch<=TCh::Mx; Ch++){UcChV[Ch-TCh::Mn]=TCh(char(Ch));}
    SetUcCh("Aa"); SetUcCh("Bb"); SetUcCh("Cc"); SetUcCh("Dd"); SetUcCh("Ee");
    SetUcCh("Ff"); SetUcCh("Gg"); SetUcCh("Hh"); SetUcCh("Ii"); SetUcCh("Jj");
    SetUcCh("Kk"); SetUcCh("Ll"); SetUcCh("Mm"); SetUcCh("Nn"); SetUcCh("Oo");
    SetUcCh("Pp"); SetUcCh("Qq"); SetUcCh("Rr"); SetUcCh("Ss"); SetUcCh("Tt");
    SetUcCh("Uu"); SetUcCh("Vv"); SetUcCh("Ww"); SetUcCh("Xx"); SetUcCh("Yy");
    SetUcCh("Zz");
  } else
  if (ChDefTy==lcdtYuAscii){
    // Character-Types
    ChTyV.PutAll(TInt(lctSpace));
    SetChTy(lctNum, "0123456789");
    SetChTy(lctAlpha, "ABC^]D\\EFGHIJKLMNOPQRS[TUVWXYZ@");
    SetChTy(lctAlpha, "abc~}d|efghijklmnopqrs{tuvwxyz`");
    SetChTy(lctAlpha, "_");
    SetChTy(lctSSym, "\".,:;+-*/%!#&<=>?()");
    SetChTy(lctTerm, TStr(TCh::CrCh));
    SetChTy(lctTerm, TStr(TCh::LfCh));
    SetChTy(lctTerm, TStr(TCh::EofCh));

    // Upper-Case
    for (int Ch=TCh::Mn; Ch<=TCh::Mx; Ch++){UcChV[Ch-TCh::Mn]=TCh(char(Ch));}
    SetUcCh("Aa"); SetUcCh("Bb"); SetUcCh("Cc"); SetUcCh("^~"); SetUcCh("]}");
    SetUcCh("Dd"); SetUcCh("\\|"); SetUcCh("Ee"); SetUcCh("Ff"); SetUcCh("Gg");
    SetUcCh("Hh"); SetUcCh("Ii"); SetUcCh("Jj"); SetUcCh("Kk"); SetUcCh("Ll");
    SetUcCh("Mm"); SetUcCh("Nn"); SetUcCh("Oo"); SetUcCh("Pp"); SetUcCh("Qq");
    SetUcCh("Rr"); SetUcCh("Ss"); SetUcCh("[{"); SetUcCh("Tt"); SetUcCh("Uu");
    SetUcCh("Vv"); SetUcCh("Ww"); SetUcCh("Xx"); SetUcCh("Yy"); SetUcCh("Zz");
    SetUcCh("@`");
  } else {
    Fail;
  }
}

Here is the call graph for this function:

TLxChDef::TLxChDef ( TSIn SIn) [inline]

Definition at line 18 of file lx.h.

: ChTyV(SIn), UcChV(SIn){}

Member Function Documentation

PLxChDef TLxChDef::GetChDef ( const TLxChDefTy ChDefTy = lcdtUsAscii) [static]

Definition at line 79 of file lx.cpp.

References TPt< TRec >::Empty(), Fail, lcdtUsAscii, lcdtYuAscii, and New().

                                                    {
  static PLxChDef UsAsciiChDef=NULL;
  static PLxChDef YuAsciiChDef=NULL;
  switch (ChDefTy){
    case lcdtUsAscii:
      if (UsAsciiChDef.Empty()){UsAsciiChDef=TLxChDef::New(lcdtUsAscii);}
      return UsAsciiChDef;
    case lcdtYuAscii:
      if (YuAsciiChDef.Empty()){YuAsciiChDef=TLxChDef::New(lcdtYuAscii);}
      return YuAsciiChDef;
    default: Fail; return NULL;
  }
}

Here is the call graph for this function:

int TLxChDef::GetChTy ( const char &  Ch) const [inline]

Definition at line 25 of file lx.h.

References TCh::Mn.

{return ChTyV[Ch-TCh::Mn];}
char TLxChDef::GetUc ( const char &  Ch) const [inline]

Definition at line 32 of file lx.h.

References TCh::Mn.

Referenced by TILx::GetStrToCh(), TILx::GetStrToEoln(), TILx::GetStrToEolnAndCh(), TILx::GetStrToEolnOrCh(), TILx::GetSym(), and GetUcStr().

{return UcChV[Ch-TCh::Mn];}

Here is the caller graph for this function:

TStr TLxChDef::GetUcStr ( const TStr Str) const

Definition at line 71 of file lx.cpp.

References TChA::AddCh(), TStr::GetCh(), GetUc(), and TStr::Len().

Referenced by TILx::AddRw(), and TOLx::AddRw().

                                             {
  TChA UcStr;
  for (int ChN=0; ChN<Str.Len(); ChN++){
    UcStr.AddCh(GetUc(Str.GetCh(ChN)));}
  return UcStr;
}

Here is the call graph for this function:

Here is the caller graph for this function:

bool TLxChDef::IsAlNum ( const char &  Ch) const [inline]

Definition at line 30 of file lx.h.

References lctAlpha, lctNum, and TCh::Mn.

Referenced by TILx::GetSym(), and IsNmStr().

                                     {
    return (ChTyV[Ch-TCh::Mn]==TInt(lctAlpha))||(ChTyV[Ch-TCh::Mn]==TInt(lctNum));}

Here is the caller graph for this function:

bool TLxChDef::IsAlpha ( const char &  Ch) const [inline]

Definition at line 28 of file lx.h.

References lctAlpha, and TCh::Mn.

Referenced by TILx::GetSym(), and IsNmStr().

{return ChTyV[Ch-TCh::Mn]==TInt(lctAlpha);}

Here is the caller graph for this function:

bool TLxChDef::IsNmStr ( const TStr Str) const

Definition at line 63 of file lx.cpp.

References TStr::GetCh(), IsAlNum(), IsAlpha(), and TStr::Len().

Referenced by TOLx::PutIdStr(), and TOLx::PutStr().

                                            {
  if (Str.Len()==0){return false;}
  if (!IsAlpha(Str.GetCh(0))){return false;}
  for (int ChN=1; ChN<Str.Len(); ChN++){
    if (!IsAlNum(Str.GetCh(ChN))){return false;}}
  return true;
}

Here is the call graph for this function:

Here is the caller graph for this function:

bool TLxChDef::IsNum ( const char &  Ch) const [inline]

Definition at line 29 of file lx.h.

References lctNum, and TCh::Mn.

Referenced by TILx::GetSym().

{return ChTyV[Ch-TCh::Mn]==TInt(lctNum);}

Here is the caller graph for this function:

bool TLxChDef::IsSpace ( const char &  Ch) const [inline]

Definition at line 27 of file lx.h.

References lctSpace, and TCh::Mn.

Referenced by TILx::GetSym().

{return ChTyV[Ch-TCh::Mn]==TInt(lctSpace);}

Here is the caller graph for this function:

bool TLxChDef::IsTerm ( const char &  Ch) const [inline]

Definition at line 26 of file lx.h.

References lctTerm, and TCh::Mn.

Referenced by TILx::GetSym().

{return ChTyV[Ch-TCh::Mn]==TInt(lctTerm);}

Here is the caller graph for this function:

static PLxChDef TLxChDef::Load ( TSIn SIn) [inline, static]

Definition at line 19 of file lx.h.

{return new TLxChDef(SIn);}
static PLxChDef TLxChDef::New ( const TLxChDefTy ChDefTy = lcdtUsAscii) [inline, static]

Definition at line 16 of file lx.h.

Referenced by GetChDef().

                                                            {
    return PLxChDef(new TLxChDef(ChDefTy));}

Here is the caller graph for this function:

TLxChDef& TLxChDef::operator= ( const TLxChDef ChDef) [inline]

Definition at line 22 of file lx.h.

References ChTyV, and UcChV.

                                            {
    ChTyV=ChDef.ChTyV; UcChV=ChDef.UcChV; return *this;}
void TLxChDef::Save ( TSOut SOut) [inline]

Definition at line 20 of file lx.h.

{ChTyV.Save(SOut); UcChV.Save(SOut);}
void TLxChDef::SetChTy ( const TLxChTy ChTy,
const TStr Str 
) [private]

Definition at line 8 of file lx.cpp.

References ChTyV, TStr::Len(), and TCh::Mn.

Referenced by TLxChDef().

                                                          {
  for (int CC=0; CC<Str.Len(); CC++){
    ChTyV[Str[CC]-TCh::Mn]=TInt(ChTy);}
}

Here is the call graph for this function:

Here is the caller graph for this function:

void TLxChDef::SetUcCh ( const TStr Str) [private]

Definition at line 3 of file lx.cpp.

References TStr::Len(), TCh::Mn, and UcChV.

Referenced by TLxChDef().

                                     {
  for (int CC=1; CC<Str.Len(); CC++){
    UcChV[Str[CC]-TCh::Mn]=TCh(Str[0]);}
}

Here is the call graph for this function:

Here is the caller graph for this function:


Friends And Related Function Documentation

friend class TPt< TLxChDef > [friend]

Definition at line 8 of file lx.h.


Member Data Documentation

Definition at line 10 of file lx.h.

Referenced by operator=(), SetChTy(), and TLxChDef().

TCRef TLxChDef::CRef [private]

Definition at line 8 of file lx.h.

TChV TLxChDef::UcChV [private]

Definition at line 11 of file lx.h.

Referenced by operator=(), SetUcCh(), and TLxChDef().


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