SNAP Library 2.4, User Reference  2015-05-11 19:40:56
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>

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.

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:947
static const char Mx
Definition: dt.h:940
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:1130
Definition: dt.h:935
static const char Mn
Definition: dt.h:939
TIntV ChTyV
Definition: lx.h:10
static const char LfCh
Definition: dt.h:945
Definition: dt.h:1042
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:946
void SetUcCh(const TStr &Str)
Definition: lx.cpp:3
Definition: lx.h:5
static const int Vals
Definition: dt.h:941
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.

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
int TLxChDef::GetChTy ( const char &  Ch) const
inline

Definition at line 25 of file lx.h.

25 {return ChTyV[Ch-TCh::Mn];}
static const char Mn
Definition: dt.h:939
TIntV ChTyV
Definition: lx.h:10
char TLxChDef::GetUc ( const char &  Ch) const
inline

Definition at line 32 of file lx.h.

32 {return UcChV[Ch-TCh::Mn];}
static const char Mn
Definition: dt.h:939
TChV UcChV
Definition: lx.h:11
TStr TLxChDef::GetUcStr ( const TStr Str) const

Definition at line 71 of file lx.cpp.

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
bool TLxChDef::IsAlNum ( const char &  Ch) const
inline

Definition at line 30 of file lx.h.

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:939
TIntV ChTyV
Definition: lx.h:10
Definition: dt.h:1042
Definition: lx.h:5
bool TLxChDef::IsAlpha ( const char &  Ch) const
inline

Definition at line 28 of file lx.h.

28 {return ChTyV[Ch-TCh::Mn]==TInt(lctAlpha);}
Definition: lx.h:5
static const char Mn
Definition: dt.h:939
TIntV ChTyV
Definition: lx.h:10
Definition: dt.h:1042
bool TLxChDef::IsNmStr ( const TStr Str) const

Definition at line 63 of file lx.cpp.

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
bool TLxChDef::IsNum ( const char &  Ch) const
inline

Definition at line 29 of file lx.h.

29 {return ChTyV[Ch-TCh::Mn]==TInt(lctNum);}
static const char Mn
Definition: dt.h:939
TIntV ChTyV
Definition: lx.h:10
Definition: dt.h:1042
Definition: lx.h:5
bool TLxChDef::IsSpace ( const char &  Ch) const
inline

Definition at line 27 of file lx.h.

27 {return ChTyV[Ch-TCh::Mn]==TInt(lctSpace);}
Definition: lx.h:5
static const char Mn
Definition: dt.h:939
TIntV ChTyV
Definition: lx.h:10
Definition: dt.h:1042
bool TLxChDef::IsTerm ( const char &  Ch) const
inline

Definition at line 26 of file lx.h.

26 {return ChTyV[Ch-TCh::Mn]==TInt(lctTerm);}
Definition: lx.h:5
static const char Mn
Definition: dt.h:939
TIntV ChTyV
Definition: lx.h:10
Definition: dt.h:1042
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.

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

Definition at line 22 of file lx.h.

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:885
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.

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:939
TIntV ChTyV
Definition: lx.h:10
Definition: dt.h:1042
void TLxChDef::SetUcCh ( const TStr Str)
private

Definition at line 3 of file lx.cpp.

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:935
static const char Mn
Definition: dt.h:939
TChV UcChV
Definition: lx.h:11

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.

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: