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

#include <lx.h>

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.

                                           :
  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;
  }
}
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.

                                                    {
  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;
  }
}
int TLxChDef::GetChTy ( const char &  Ch) const [inline]

Definition at line 25 of file lx.h.

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

Definition at line 32 of file lx.h.

{return UcChV[Ch-TCh::Mn];}
TStr TLxChDef::GetUcStr ( const TStr Str) const

Definition at line 71 of file lx.cpp.

                                             {
  TChA UcStr;
  for (int ChN=0; ChN<Str.Len(); ChN++){
    UcStr.AddCh(GetUc(Str.GetCh(ChN)));}
  return UcStr;
}
bool TLxChDef::IsAlNum ( const char &  Ch) const [inline]

Definition at line 30 of file lx.h.

                                     {
    return (ChTyV[Ch-TCh::Mn]==TInt(lctAlpha))||(ChTyV[Ch-TCh::Mn]==TInt(lctNum));}
bool TLxChDef::IsAlpha ( const char &  Ch) const [inline]

Definition at line 28 of file lx.h.

{return ChTyV[Ch-TCh::Mn]==TInt(lctAlpha);}
bool TLxChDef::IsNmStr ( const TStr Str) const

Definition at line 63 of file lx.cpp.

                                            {
  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;
}
bool TLxChDef::IsNum ( const char &  Ch) const [inline]

Definition at line 29 of file lx.h.

{return ChTyV[Ch-TCh::Mn]==TInt(lctNum);}
bool TLxChDef::IsSpace ( const char &  Ch) const [inline]

Definition at line 27 of file lx.h.

{return ChTyV[Ch-TCh::Mn]==TInt(lctSpace);}
bool TLxChDef::IsTerm ( const char &  Ch) const [inline]

Definition at line 26 of file lx.h.

{return ChTyV[Ch-TCh::Mn]==TInt(lctTerm);}
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.

                                                            {
    return PLxChDef(new TLxChDef(ChDefTy));}
TLxChDef& TLxChDef::operator= ( const TLxChDef ChDef) [inline]

Definition at line 22 of file lx.h.

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

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

Definition at line 3 of file lx.cpp.

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

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.

TCRef TLxChDef::CRef [private]

Definition at line 8 of file lx.h.

TChV TLxChDef::UcChV [private]

Definition at line 11 of file lx.h.


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