SNAP Library 2.2, Developer Reference
2014-03-11 19:15:55
SNAP, a general purpose, high performance system for analysis and manipulation of large networks
|
#include <lx.h>
Public Member Functions | |
TOLx (const PSOut &_SOut, const TFSet &OptSet, const TLxChDefTy &ChDefTy=lcdtUsAscii) | |
TOLx & | operator= (const TOLx &) |
void | SetOpt (const int &Opt, const bool &Val) |
TLxSym | AddRw (const TStr &Str) |
PSOut | GetSOut (const char &SepCh) |
void | PutSym (const TLxSym &Sym) |
void | PutBool (const TBool &Bool) |
void | PutInt (const TInt &Int) |
void | PutFlt (const TFlt &Flt, const int &Width=-1, const int &Prec=-1) |
void | PutStr (const TStr &Str) |
void | PutIdStr (const TStr &Str, const bool &CheckIdStr=true) |
void | PutQStr (const TStr &Str) |
void | PutQStr (const TChA &ChA) |
void | PutUQStr (const TStr &Str) |
void | PutLnCmt (const TStr &Str, const int &IndentLev=0) |
void | PutParCmt (const TStr &Str) |
void | PutIndent (const int &IndentLev) |
void | PutTab () const |
void | PutLn (const int &IndentLev=0) |
void | PutDosLn (const int &IndentLev=0) |
void | PutVar (const TStr &VarNm, const bool &LBracket=false, const bool &NewLn=false, const bool &CheckIdStr=true) |
void | PutVarEnd (const bool &RBracket=false, const bool &NewLn=false) |
void | PutVarBool (const TStr &VarNm, const bool &Bool, const bool &NewLn=true, const bool &CheckIdStr=true) |
void | PutVarInt (const TStr &VarNm, const int &Int, const bool &NewLn=true, const bool &CheckIdStr=true) |
void | PutVarFlt (const TStr &VarNm, const double &Flt, const bool &NewLn=true, const bool &CheckIdStr=true) |
void | PutVarStr (const TStr &VarNm, const TStr &Str, const bool &NewLn=true, const bool &CheckIdStr=true) |
void | PutVarSecTm (const TStr &VarNm, const TSecTm &SecTm, const bool &NewLn=true, const bool &CheckIdStr=true) |
void | PutVarBoolV (const TStr &VarNm, const TBoolV &BoolV, const bool &NewLn=true, const bool &CheckIdStr=true) |
void | PutVarIntV (const TStr &VarNm, const TIntV &IntV, const bool &NewLn=true, const bool &CheckIdStr=true) |
void | PutVarFltV (const TStr &VarNm, const TFltV &FltV, const bool &NewLn=true, const bool &CheckIdStr=true) |
void | PutVarStrV (const TStr &VarNm, const TStrV &StrV, const bool &NewLn=true, const bool &CheckIdStr=true) |
void | PutVarStrPrV (const TStr &VarNm, const TStrPrV &StrPrV, const bool &NewLn=true, const bool &CheckIdStr=true) |
void | PutVarStrVV (const TStr &VarNm, const TVec< TStrV > &StrVV, const bool &NewLn=true, const bool &CheckIdStr=true) |
Private Member Functions | |
void | PutSep (const TLxSym &Sym) |
Private Attributes | |
PLxChDef | ChDef |
PSOut | SOut |
TSOut & | RSOut |
bool | IsCmtAlw |
bool | IsFrcEoln |
bool | IsSigNum |
bool | IsUniStr |
bool | IsCsSens |
bool | IsTabSep |
bool | IsVarIndent |
int | VarIndentLev |
TStrIntH | RwStrH |
TIntStrH | RwSymH |
TLxSym | PrevSym |
TOLx::TOLx | ( | const PSOut & | _SOut, |
const TFSet & | OptSet, | ||
const TLxChDefTy & | ChDefTy = lcdtUsAscii |
||
) |
Definition at line 718 of file lx.cpp.
References TFSet::In(), oloMx, and SetOpt().
: ChDef(TLxChDef::GetChDef(ChDefTy)), SOut(_SOut), RSOut(*SOut), IsCmtAlw(false), IsFrcEoln(false), IsSigNum(false), IsUniStr(false), IsCsSens(false), IsTabSep(false), IsVarIndent(false), VarIndentLev(0), RwStrH(50), RwSymH(50), PrevSym(syUndef){ for (int Opt=0; Opt<oloMx; Opt++){ if (OptSet.In(Opt)){SetOpt(Opt, true);}} }
TLxSym TOLx::AddRw | ( | const TStr & | Str | ) |
Definition at line 741 of file lx.cpp.
References THash< TKey, TDat, THashFunc >::AddDat(), ChDef, TLxChDef::GetUcStr(), IAssert, THash< TKey, TDat, THashFunc >::IsKey(), THash< TKey, TDat, THashFunc >::Len(), RwStrH, RwSymH, syMnRw, and syMxRw.
{ IAssert(RwStrH.Len()<syMxRw-syMnRw+1); TStr UcStr=ChDef->GetUcStr(Str); IAssert(!RwStrH.IsKey(UcStr)); TLxSym RwSym=TLxSym(syMnRw+RwStrH.Len()); RwStrH.AddDat(Str, TInt(int(RwSym))); RwSymH.AddDat(TInt(int(RwSym)), Str); return RwSym; }
PSOut TOLx::GetSOut | ( | const char & | SepCh | ) | [inline] |
void TOLx::PutBool | ( | const TBool & | Bool | ) | [inline] |
Definition at line 275 of file lx.h.
References TBool::GetStr(), PutSep(), TSOut::PutStr(), RSOut, and syIdStr.
Referenced by PutVarBool(), PutVarBoolV(), and TPpVal::SaveTxt().
{ PutSep(syIdStr); RSOut.PutStr(TBool::GetStr(Bool));}
void TOLx::PutDosLn | ( | const int & | IndentLev = 0 | ) | [inline] |
void TOLx::PutFlt | ( | const TFlt & | Flt, |
const int & | Width = -1 , |
||
const int & | Prec = -1 |
||
) | [inline] |
Definition at line 280 of file lx.h.
References Assert, TFlt::GetStr(), IsSigNum, PutSep(), TSOut::PutStr(), RSOut, and syFlt.
Referenced by PutVarFlt(), PutVarFltV(), TExpVal::SaveTxt(), and TPpVal::SaveTxt().
void TOLx::PutIdStr | ( | const TStr & | Str, |
const bool & | CheckIdStr = true |
||
) | [inline] |
Definition at line 286 of file lx.h.
References Assert, ChDef, TLxChDef::IsNmStr(), PutSep(), TSOut::PutStr(), RSOut, and syIdStr.
Referenced by PutVar(), PutVarBool(), PutVarFlt(), PutVarInt(), PutVarSecTm(), PutVarStr(), TPpTag::SaveTxt(), TExpVal::SaveTxt(), TPpVal::SaveTxt(), TPp::SaveTxt(), and TExp::SaveTxt().
void TOLx::PutIndent | ( | const int & | IndentLev | ) | [inline] |
Definition at line 299 of file lx.h.
References TSOut::PutCh(), and RSOut.
Referenced by PutVar(), PutVarBool(), PutVarBoolV(), PutVarEnd(), PutVarFlt(), PutVarFltV(), PutVarInt(), PutVarIntV(), PutVarSecTm(), PutVarStr(), PutVarStrPrV(), PutVarStrV(), and PutVarStrVV().
void TOLx::PutInt | ( | const TInt & | Int | ) | [inline] |
Definition at line 277 of file lx.h.
References Assert, TInt::GetStr(), IsSigNum, PutSep(), TSOut::PutStr(), RSOut, and syInt.
Referenced by PutVarInt(), PutVarIntV(), TPpVal::SaveTxt(), TRnd::SaveTxt(), and TSecTm::SaveTxt().
void TOLx::PutLn | ( | const int & | IndentLev = 0 | ) | [inline] |
Definition at line 302 of file lx.h.
References Assert, IsFrcEoln, TSOut::PutCh(), TSOut::PutLn(), PutSep(), RSOut, and syEoln.
Referenced by PutLnCmt(), PutVar(), PutVarBool(), PutVarBoolV(), PutVarEnd(), PutVarFlt(), PutVarFltV(), PutVarInt(), PutVarIntV(), PutVarSecTm(), PutVarStr(), PutVarStrPrV(), PutVarStrV(), and PutVarStrVV().
void TOLx::PutLnCmt | ( | const TStr & | Str, |
const int & | IndentLev = 0 |
||
) | [inline] |
void TOLx::PutParCmt | ( | const TStr & | Str | ) | [inline] |
void TOLx::PutQStr | ( | const TStr & | Str | ) | [inline] |
Definition at line 289 of file lx.h.
References TSOut::PutCh(), PutSep(), TSOut::PutStr(), RSOut, and syQStr.
Referenced by PutVarStr(), PutVarStrPrV(), PutVarStrV(), PutVarStrVV(), TExpVal::SaveTxt(), TPpVal::SaveTxt(), and TPp::SaveTxt().
void TOLx::PutQStr | ( | const TChA & | ChA | ) | [inline] |
void TOLx::PutSep | ( | const TLxSym & | Sym | ) | [private] |
Definition at line 712 of file lx.cpp.
References TLxSymStr::IsSep(), IsTabSep, PrevSym, TSOut::PutCh(), RSOut, and TCh::TabCh.
Referenced by PutBool(), PutDosLn(), PutFlt(), PutIdStr(), PutInt(), PutLn(), PutQStr(), PutStr(), PutSym(), and PutUQStr().
{ if (TLxSymStr::IsSep(PrevSym, Sym)){ if (IsTabSep){RSOut.PutCh(TCh::TabCh);} else {RSOut.PutCh(' ');}} PrevSym=Sym; }
void TOLx::PutStr | ( | const TStr & | Str | ) | [inline] |
Definition at line 283 of file lx.h.
References ChDef, TLxChDef::IsNmStr(), IsUniStr, TSOut::PutCh(), PutSep(), TSOut::PutStr(), RSOut, syIdStr, and syStr.
Referenced by PutLnCmt(), and PutParCmt().
{ if ((IsUniStr)&&(ChDef->IsNmStr(Str))){PutSep(syIdStr); RSOut.PutStr(Str);} else {PutSep(syStr); RSOut.PutCh('"'); RSOut.PutStr(Str); RSOut.PutCh('"');}}
void TOLx::PutSym | ( | const TLxSym & | Sym | ) |
Definition at line 751 of file lx.cpp.
References TLxSymStr::GetSymStr(), PutSep(), TSOut::PutStr(), RSOut, RwSymH, syMnRw, and syMxRw.
Referenced by PutVar(), PutVarBool(), PutVarEnd(), PutVarFlt(), PutVarInt(), PutVarSecTm(), PutVarStr(), PutVarStrPrV(), PutVarStrVV(), TExpVal::SaveTxt(), TPpVal::SaveTxt(), TPp::SaveTxt(), TExp::SaveTxt(), and TExp::SaveTxtOp().
{ TStr Str; if ((syMnRw<=Sym)&&(Sym<=syMxRw)){ Str=Str=RwSymH[Sym]; } else { Str=TLxSymStr::GetSymStr(Sym); } PutSep(Sym); RSOut.PutStr(Str); }
void TOLx::PutTab | ( | ) | const [inline] |
Definition at line 301 of file lx.h.
References TSOut::PutCh(), RSOut, and TCh::TabCh.
{RSOut.PutCh(TCh::TabCh);}
void TOLx::PutUQStr | ( | const TStr & | Str | ) | [inline] |
void TOLx::PutVar | ( | const TStr & | VarNm, |
const bool & | LBracket = false , |
||
const bool & | NewLn = false , |
||
const bool & | CheckIdStr = true |
||
) | [inline] |
Definition at line 309 of file lx.h.
References IsVarIndent, PutIdStr(), PutIndent(), PutLn(), PutSym(), syColon, syLBracket, and VarIndentLev.
Referenced by PutVarBoolV(), PutVarFltV(), PutVarIntV(), PutVarStrPrV(), PutVarStrV(), PutVarStrVV(), and TPp::SaveTxt().
{ if (IsVarIndent){PutIndent(VarIndentLev);} PutIdStr(VarNm, CheckIdStr); PutSym(syColon); if (LBracket){PutSym(syLBracket);} if (NewLn){PutLn(); VarIndentLev++;}}
void TOLx::PutVarBool | ( | const TStr & | VarNm, |
const bool & | Bool, | ||
const bool & | NewLn = true , |
||
const bool & | CheckIdStr = true |
||
) | [inline] |
Definition at line 319 of file lx.h.
References IsVarIndent, PutBool(), PutIdStr(), PutIndent(), PutLn(), PutSym(), syColon, and VarIndentLev.
{ if (IsVarIndent){PutIndent(VarIndentLev);} PutIdStr(VarNm, CheckIdStr); PutSym(syColon); PutBool(Bool); if (NewLn){PutLn();}}
void TOLx::PutVarBoolV | ( | const TStr & | VarNm, |
const TBoolV & | BoolV, | ||
const bool & | NewLn = true , |
||
const bool & | CheckIdStr = true |
||
) |
Definition at line 761 of file lx.cpp.
References IsVarIndent, TVec< TVal, TSizeTy >::Len(), PutBool(), PutIndent(), PutLn(), PutVar(), PutVarEnd(), and VarIndentLev.
{ PutVar(VarNm, true, NewLn, CheckIdStr); for (int BoolN=0; BoolN<BoolV.Len(); BoolN++){ if (IsVarIndent){PutIndent(VarIndentLev);} PutBool(BoolV[BoolN]); if (NewLn){PutLn();} } PutVarEnd(true, NewLn); }
void TOLx::PutVarEnd | ( | const bool & | RBracket = false , |
const bool & | NewLn = false |
||
) | [inline] |
Definition at line 315 of file lx.h.
References IsVarIndent, PutIndent(), PutLn(), PutSym(), syRBracket, and VarIndentLev.
Referenced by PutVarBoolV(), PutVarFltV(), PutVarIntV(), PutVarStrPrV(), PutVarStrV(), and PutVarStrVV().
{ if (IsVarIndent){PutIndent(VarIndentLev-1);} if (RBracket){PutSym(syRBracket);} if (NewLn){PutLn(); VarIndentLev--;}}
void TOLx::PutVarFlt | ( | const TStr & | VarNm, |
const double & | Flt, | ||
const bool & | NewLn = true , |
||
const bool & | CheckIdStr = true |
||
) | [inline] |
Definition at line 329 of file lx.h.
References IsVarIndent, PutFlt(), PutIdStr(), PutIndent(), PutLn(), PutSym(), syColon, and VarIndentLev.
{ if (IsVarIndent){PutIndent(VarIndentLev);} PutIdStr(VarNm, CheckIdStr); PutSym(syColon); PutFlt(Flt); if (NewLn){PutLn();}}
void TOLx::PutVarFltV | ( | const TStr & | VarNm, |
const TFltV & | FltV, | ||
const bool & | NewLn = true , |
||
const bool & | CheckIdStr = true |
||
) |
Definition at line 783 of file lx.cpp.
References IsVarIndent, TVec< TVal, TSizeTy >::Len(), PutFlt(), PutIndent(), PutLn(), PutVar(), PutVarEnd(), and VarIndentLev.
{ PutVar(VarNm, true, NewLn, CheckIdStr); for (int FltN=0; FltN<FltV.Len(); FltN++){ if (IsVarIndent){PutIndent(VarIndentLev);} PutFlt(FltV[FltN]); if (NewLn){PutLn();} } PutVarEnd(true, NewLn); }
void TOLx::PutVarInt | ( | const TStr & | VarNm, |
const int & | Int, | ||
const bool & | NewLn = true , |
||
const bool & | CheckIdStr = true |
||
) | [inline] |
Definition at line 324 of file lx.h.
References IsVarIndent, PutIdStr(), PutIndent(), PutInt(), PutLn(), PutSym(), syColon, and VarIndentLev.
Referenced by TMBlobBs::SaveMain().
{ if (IsVarIndent){PutIndent(VarIndentLev);} PutIdStr(VarNm, CheckIdStr); PutSym(syColon); PutInt(Int); if (NewLn){PutLn();}}
void TOLx::PutVarIntV | ( | const TStr & | VarNm, |
const TIntV & | IntV, | ||
const bool & | NewLn = true , |
||
const bool & | CheckIdStr = true |
||
) |
Definition at line 772 of file lx.cpp.
References IsVarIndent, TVec< TVal, TSizeTy >::Len(), PutIndent(), PutInt(), PutLn(), PutVar(), PutVarEnd(), and VarIndentLev.
{ PutVar(VarNm, true, NewLn, CheckIdStr); for (int IntN=0; IntN<IntV.Len(); IntN++){ if (IsVarIndent){PutIndent(VarIndentLev);} PutInt(IntV[IntN]); if (NewLn){PutLn();} } PutVarEnd(true, NewLn); }
void TOLx::PutVarSecTm | ( | const TStr & | VarNm, |
const TSecTm & | SecTm, | ||
const bool & | NewLn = true , |
||
const bool & | CheckIdStr = true |
||
) | [inline] |
Definition at line 339 of file lx.h.
References IsVarIndent, PutIdStr(), PutIndent(), PutLn(), PutSym(), TSecTm::SaveTxt(), syColon, and VarIndentLev.
{ if (IsVarIndent){PutIndent(VarIndentLev);} PutIdStr(VarNm, CheckIdStr); PutSym(syColon); SecTm.SaveTxt(*this); if (NewLn){PutLn();}}
void TOLx::PutVarStr | ( | const TStr & | VarNm, |
const TStr & | Str, | ||
const bool & | NewLn = true , |
||
const bool & | CheckIdStr = true |
||
) | [inline] |
Definition at line 334 of file lx.h.
References IsVarIndent, PutIdStr(), PutIndent(), PutLn(), PutQStr(), PutSym(), syColon, and VarIndentLev.
Referenced by TMBlobBs::SaveMain().
{ if (IsVarIndent){PutIndent(VarIndentLev);} PutIdStr(VarNm, CheckIdStr); PutSym(syColon); PutQStr(Str); if (NewLn){PutLn();}}
void TOLx::PutVarStrPrV | ( | const TStr & | VarNm, |
const TStrPrV & | StrPrV, | ||
const bool & | NewLn = true , |
||
const bool & | CheckIdStr = true |
||
) |
Definition at line 805 of file lx.cpp.
References IsVarIndent, TVec< TVal, TSizeTy >::Len(), PutIndent(), PutLn(), PutQStr(), PutSym(), PutVar(), PutVarEnd(), syLBracket, syRBracket, and VarIndentLev.
{ PutVar(VarNm, true, NewLn, CheckIdStr); for (int StrPrN=0; StrPrN<StrPrV.Len(); StrPrN++){ if (IsVarIndent){PutIndent(VarIndentLev);} PutSym(syLBracket); PutQStr(StrPrV[StrPrN].Val1); PutQStr(StrPrV[StrPrN].Val2); PutSym(syRBracket); if (NewLn){PutLn();} } PutVarEnd(true, NewLn); }
void TOLx::PutVarStrV | ( | const TStr & | VarNm, |
const TStrV & | StrV, | ||
const bool & | NewLn = true , |
||
const bool & | CheckIdStr = true |
||
) |
Definition at line 794 of file lx.cpp.
References IsVarIndent, TVec< TVal, TSizeTy >::Len(), PutIndent(), PutLn(), PutQStr(), PutVar(), PutVarEnd(), and VarIndentLev.
{ PutVar(VarNm, true, NewLn, CheckIdStr); for (int StrN=0; StrN<StrV.Len(); StrN++){ if (IsVarIndent){PutIndent(VarIndentLev);} PutQStr(StrV[StrN]); if (NewLn){PutLn();} } PutVarEnd(true, NewLn); }
void TOLx::PutVarStrVV | ( | const TStr & | VarNm, |
const TVec< TStrV > & | StrVV, | ||
const bool & | NewLn = true , |
||
const bool & | CheckIdStr = true |
||
) |
Definition at line 818 of file lx.cpp.
References IsVarIndent, TVec< TVal, TSizeTy >::Len(), PutIndent(), PutLn(), PutQStr(), PutSym(), PutVar(), PutVarEnd(), syLBracket, syRBracket, and VarIndentLev.
{ PutVar(VarNm, true, NewLn, CheckIdStr); for (int StrVN=0; StrVN<StrVV.Len(); StrVN++){ if (IsVarIndent){PutIndent(VarIndentLev);} PutSym(syLBracket); for (int StrN=0; StrN<StrVV[StrVN].Len(); StrN++){ PutQStr(StrVV[StrVN][StrN]);} PutSym(syRBracket); if (NewLn){PutLn();} } PutVarEnd(true, NewLn); }
void TOLx::SetOpt | ( | const int & | Opt, |
const bool & | Val | ||
) |
Definition at line 728 of file lx.cpp.
References Fail, IsCmtAlw, IsCsSens, IsFrcEoln, IsSigNum, IsTabSep, IsUniStr, IsVarIndent, oloCmtAlw, oloCsSens, oloFrcEoln, oloSigNum, oloTabSep, oloUniStr, and oloVarIndent.
Referenced by TOLx().
{ switch (Opt){ case oloCmtAlw: IsCmtAlw=Val; break; case oloFrcEoln: IsFrcEoln=Val; break; case oloSigNum: IsSigNum=Val; break; case oloUniStr: IsUniStr=Val; break; case oloCsSens: IsCsSens=Val; break; case oloTabSep: IsTabSep=Val; break; case oloVarIndent: IsVarIndent=Val; break; default: Fail; } }
PLxChDef TOLx::ChDef [private] |
Definition at line 253 of file lx.h.
Referenced by AddRw(), PutIdStr(), and PutStr().
bool TOLx::IsCmtAlw [private] |
Definition at line 256 of file lx.h.
Referenced by PutLnCmt(), PutParCmt(), and SetOpt().
bool TOLx::IsCsSens [private] |
bool TOLx::IsFrcEoln [private] |
Definition at line 256 of file lx.h.
Referenced by PutDosLn(), PutLn(), and SetOpt().
bool TOLx::IsSigNum [private] |
bool TOLx::IsTabSep [private] |
bool TOLx::IsUniStr [private] |
bool TOLx::IsVarIndent [private] |
Definition at line 257 of file lx.h.
Referenced by PutVar(), PutVarBool(), PutVarBoolV(), PutVarEnd(), PutVarFlt(), PutVarFltV(), PutVarInt(), PutVarIntV(), PutVarSecTm(), PutVarStr(), PutVarStrPrV(), PutVarStrV(), PutVarStrVV(), and SetOpt().
TLxSym TOLx::PrevSym [private] |
TSOut& TOLx::RSOut [private] |
Definition at line 255 of file lx.h.
Referenced by GetSOut(), PutBool(), PutDosLn(), PutFlt(), PutIdStr(), PutIndent(), PutInt(), PutLn(), PutQStr(), PutSep(), PutStr(), PutSym(), PutTab(), and PutUQStr().
TStrIntH TOLx::RwStrH [private] |
TIntStrH TOLx::RwSymH [private] |
PSOut TOLx::SOut [private] |
int TOLx::VarIndentLev [private] |
Definition at line 258 of file lx.h.
Referenced by PutVar(), PutVarBool(), PutVarBoolV(), PutVarEnd(), PutVarFlt(), PutVarFltV(), PutVarInt(), PutVarIntV(), PutVarSecTm(), PutVarStr(), PutVarStrPrV(), PutVarStrV(), and PutVarStrVV().