|
SNAP Library , Developer Reference
2013-01-07 14:03:36
SNAP, a general purpose, high performance system for analysis and manipulation of large networks
|
#include <lx.h>

Public Member Functions | |
| TLxChDef (const TLxChDefTy &ChDefTy) | |
| TLxChDef (TSIn &SIn) | |
| void | Save (TSOut &SOut) |
| TLxChDef & | operator= (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 > |
| 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; } }

| TLxChDef::TLxChDef | ( | TSIn & | SIn | ) | [inline] |
| 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;
}
}

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

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


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


| bool TLxChDef::IsNum | ( | const char & | Ch | ) | const [inline] |
| bool TLxChDef::IsSpace | ( | const char & | Ch | ) | const [inline] |
| bool TLxChDef::IsTerm | ( | const char & | Ch | ) | const [inline] |
| static PLxChDef TLxChDef::Load | ( | TSIn & | SIn | ) | [inline, static] |
| static PLxChDef TLxChDef::New | ( | const TLxChDefTy & | ChDefTy = lcdtUsAscii | ) | [inline, static] |
Definition at line 16 of file lx.h.
Referenced by GetChDef().

| void TLxChDef::Save | ( | TSOut & | SOut | ) | [inline] |
| 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().


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


TIntV TLxChDef::ChTyV [private] |
Definition at line 10 of file lx.h.
Referenced by operator=(), SetChTy(), and TLxChDef().
TCRef TLxChDef::CRef [private] |
TChV TLxChDef::UcChV [private] |
Definition at line 11 of file lx.h.
Referenced by operator=(), SetUcCh(), and TLxChDef().