SNAP Library 4.0, Developer Reference  2017-07-27 13:18:06
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
TLxChDef Class Reference

#include <lx.h>

Collaboration diagram for TLxChDef:

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, TSizeTy >::PutAll(), SetChTy(), SetUcCh(), and UcChV.

13  :
15 
16  if (ChDefTy==lcdtUsAscii){
17  // Character-Types
19  SetChTy(lctNum, "0123456789");
20  SetChTy(lctAlpha, "ABCDEFGHIJKLMNOPQRSTUVWXYZ");
21  SetChTy(lctAlpha, "abcdefghijklmnopqrstuvwxyz");
22  SetChTy(lctAlpha, "@_");
23  SetChTy(lctSSym, "\"'.,:;+-*/%!#|&<=>?()[]{}");
27 
28  // Upper-Case
29  for (int Ch=TCh::Mn; Ch<=TCh::Mx; Ch++){UcChV[Ch-TCh::Mn]=TCh(char(Ch));}
30  SetUcCh("Aa"); SetUcCh("Bb"); SetUcCh("Cc"); SetUcCh("Dd"); SetUcCh("Ee");
31  SetUcCh("Ff"); SetUcCh("Gg"); SetUcCh("Hh"); SetUcCh("Ii"); SetUcCh("Jj");
32  SetUcCh("Kk"); SetUcCh("Ll"); SetUcCh("Mm"); SetUcCh("Nn"); SetUcCh("Oo");
33  SetUcCh("Pp"); SetUcCh("Qq"); SetUcCh("Rr"); SetUcCh("Ss"); SetUcCh("Tt");
34  SetUcCh("Uu"); SetUcCh("Vv"); SetUcCh("Ww"); SetUcCh("Xx"); SetUcCh("Yy");
35  SetUcCh("Zz");
36  } else
37  if (ChDefTy==lcdtYuAscii){
38  // Character-Types
40  SetChTy(lctNum, "0123456789");
41  SetChTy(lctAlpha, "ABC^]D\\EFGHIJKLMNOPQRS[TUVWXYZ@");
42  SetChTy(lctAlpha, "abc~}d|efghijklmnopqrs{tuvwxyz`");
43  SetChTy(lctAlpha, "_");
44  SetChTy(lctSSym, "\".,:;+-*/%!#&<=>?()");
48 
49  // Upper-Case
50  for (int Ch=TCh::Mn; Ch<=TCh::Mx; Ch++){UcChV[Ch-TCh::Mn]=TCh(char(Ch));}
51  SetUcCh("Aa"); SetUcCh("Bb"); SetUcCh("Cc"); SetUcCh("^~"); SetUcCh("]}");
52  SetUcCh("Dd"); SetUcCh("\\|"); SetUcCh("Ee"); SetUcCh("Ff"); SetUcCh("Gg");
53  SetUcCh("Hh"); SetUcCh("Ii"); SetUcCh("Jj"); SetUcCh("Kk"); SetUcCh("Ll");
54  SetUcCh("Mm"); SetUcCh("Nn"); SetUcCh("Oo"); SetUcCh("Pp"); SetUcCh("Qq");
55  SetUcCh("Rr"); SetUcCh("Ss"); SetUcCh("[{"); SetUcCh("Tt"); SetUcCh("Uu");
56  SetUcCh("Vv"); SetUcCh("Ww"); SetUcCh("Xx"); SetUcCh("Yy"); SetUcCh("Zz");
57  SetUcCh("@`");
58  } else {
59  Fail;
60  }
61 }
Definition: lx.h:6
Definition: lx.h:5
#define Fail
Definition: bd.h:238
Definition: lx.h:5
Definition: lx.h:5
static const char EofCh
Definition: dt.h:1037
static const char Mx
Definition: dt.h:1030
Definition: lx.h:6
Definition: lx.h:5
void PutAll(const TVal &Val)
Sets all elements of the vector to value Val.
Definition: ds.h:1229
Definition: dt.h:1025
static const char Mn
Definition: dt.h:1029
TIntV ChTyV
Definition: lx.h:10
static const char LfCh
Definition: dt.h:1035
Definition: dt.h:1134
TChV UcChV
Definition: lx.h:11
void SetChTy(const TLxChTy &ChTy, const TStr &Str)
Definition: lx.cpp:8
Definition: dt.h:412
static const char CrCh
Definition: dt.h:1036
void SetUcCh(const TStr &Str)
Definition: lx.cpp:3
Definition: lx.h:5
static const int Vals
Definition: dt.h:1031

Here is the call graph for this function:

TLxChDef::TLxChDef ( TSIn SIn)
inline

Definition at line 18 of file lx.h.

18 : ChTyV(SIn), UcChV(SIn){}
TIntV ChTyV
Definition: lx.h:10
TChV UcChV
Definition: lx.h:11

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().

79  {
80  static PLxChDef UsAsciiChDef=NULL;
81  static PLxChDef YuAsciiChDef=NULL;
82  switch (ChDefTy){
83  case lcdtUsAscii:
84  if (UsAsciiChDef.Empty()){UsAsciiChDef=TLxChDef::New(lcdtUsAscii);}
85  return UsAsciiChDef;
86  case lcdtYuAscii:
87  if (YuAsciiChDef.Empty()){YuAsciiChDef=TLxChDef::New(lcdtYuAscii);}
88  return YuAsciiChDef;
89  default: Fail; return NULL;
90  }
91 }
Definition: lx.h:6
static PLxChDef New(const TLxChDefTy &ChDefTy=lcdtUsAscii)
Definition: lx.h:16
#define Fail
Definition: bd.h:238
bool Empty() const
Definition: bd.h:501
Definition: lx.h:6

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.

25 {return ChTyV[Ch-TCh::Mn];}
static const char Mn
Definition: dt.h:1029
TIntV ChTyV
Definition: lx.h:10
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().

32 {return UcChV[Ch-TCh::Mn];}
static const char Mn
Definition: dt.h:1029
TChV UcChV
Definition: lx.h:11

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().

71  {
72  TChA UcStr;
73  for (int ChN=0; ChN<Str.Len(); ChN++){
74  UcStr.AddCh(GetUc(Str.GetCh(ChN)));}
75  return UcStr;
76 }
int Len() const
Definition: dt.h:487
void AddCh(const char &Ch, const int &MxLen=-1)
Definition: dt.h:271
char GetUc(const char &Ch) const
Definition: lx.h:32
char GetCh(const int &ChN) const
Definition: dt.h:483
Definition: dt.h:201

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().

30  {
31  return (ChTyV[Ch-TCh::Mn]==TInt(lctAlpha))||(ChTyV[Ch-TCh::Mn]==TInt(lctNum));}
Definition: lx.h:5
static const char Mn
Definition: dt.h:1029
TIntV ChTyV
Definition: lx.h:10
Definition: dt.h:1134
Definition: lx.h:5

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().

28 {return ChTyV[Ch-TCh::Mn]==TInt(lctAlpha);}
Definition: lx.h:5
static const char Mn
Definition: dt.h:1029
TIntV ChTyV
Definition: lx.h:10
Definition: dt.h:1134

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().

63  {
64  if (Str.Len()==0){return false;}
65  if (!IsAlpha(Str.GetCh(0))){return false;}
66  for (int ChN=1; ChN<Str.Len(); ChN++){
67  if (!IsAlNum(Str.GetCh(ChN))){return false;}}
68  return true;
69 }
int Len() const
Definition: dt.h:487
bool IsAlNum(const char &Ch) const
Definition: lx.h:30
bool IsAlpha(const char &Ch) const
Definition: lx.h:28
char GetCh(const int &ChN) const
Definition: dt.h:483

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().

29 {return ChTyV[Ch-TCh::Mn]==TInt(lctNum);}
static const char Mn
Definition: dt.h:1029
TIntV ChTyV
Definition: lx.h:10
Definition: dt.h:1134
Definition: lx.h:5

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().

27 {return ChTyV[Ch-TCh::Mn]==TInt(lctSpace);}
Definition: lx.h:5
static const char Mn
Definition: dt.h:1029
TIntV ChTyV
Definition: lx.h:10
Definition: dt.h:1134

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().

26 {return ChTyV[Ch-TCh::Mn]==TInt(lctTerm);}
Definition: lx.h:5
static const char Mn
Definition: dt.h:1029
TIntV ChTyV
Definition: lx.h:10
Definition: dt.h:1134

Here is the caller graph for this function:

static PLxChDef TLxChDef::Load ( TSIn SIn)
inlinestatic

Definition at line 19 of file lx.h.

19 {return new TLxChDef(SIn);}
TLxChDef(const TLxChDefTy &ChDefTy)
Definition: lx.cpp:13
static PLxChDef TLxChDef::New ( const TLxChDefTy ChDefTy = lcdtUsAscii)
inlinestatic

Definition at line 16 of file lx.h.

Referenced by GetChDef().

16  {
17  return PLxChDef(new TLxChDef(ChDefTy));}
TLxChDef(const TLxChDefTy &ChDefTy)
Definition: lx.cpp:13
TPt< TLxChDef > PLxChDef
Definition: lx.h:8

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.

22  {
23  ChTyV=ChDef.ChTyV; UcChV=ChDef.UcChV; return *this;}
TIntV ChTyV
Definition: lx.h:10
TChV UcChV
Definition: lx.h:11
void TLxChDef::Save ( TSOut SOut)
inline

Definition at line 20 of file lx.h.

20 {ChTyV.Save(SOut); UcChV.Save(SOut);}
void Save(TSOut &SOut) const
Definition: ds.h:954
TIntV ChTyV
Definition: lx.h:10
TChV UcChV
Definition: lx.h:11
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().

8  {
9  for (int CC=0; CC<Str.Len(); CC++){
10  ChTyV[Str[CC]-TCh::Mn]=TInt(ChTy);}
11 }
int Len() const
Definition: dt.h:487
static const char Mn
Definition: dt.h:1029
TIntV ChTyV
Definition: lx.h:10
Definition: dt.h:1134

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().

3  {
4  for (int CC=1; CC<Str.Len(); CC++){
5  UcChV[Str[CC]-TCh::Mn]=TCh(Str[0]);}
6 }
int Len() const
Definition: dt.h:487
Definition: dt.h:1025
static const char Mn
Definition: dt.h:1029
TChV UcChV
Definition: lx.h:11

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

TIntV TLxChDef::ChTyV
private

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: