SNAP Library 2.0, User Reference  2013-05-13 16:33:57
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
TOLx Class Reference

#include <lx.h>

List of all members.

Public Member Functions

 TOLx (const PSOut &_SOut, const TFSet &OptSet, const TLxChDefTy &ChDefTy=lcdtUsAscii)
TOLxoperator= (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
TSOutRSOut
bool IsCmtAlw
bool IsFrcEoln
bool IsSigNum
bool IsUniStr
bool IsCsSens
bool IsTabSep
bool IsVarIndent
int VarIndentLev
TStrIntH RwStrH
TIntStrH RwSymH
TLxSym PrevSym

Detailed Description

Definition at line 251 of file lx.h.


Constructor & Destructor Documentation

TOLx::TOLx ( const PSOut _SOut,
const TFSet OptSet,
const TLxChDefTy ChDefTy = lcdtUsAscii 
)

Definition at line 718 of file lx.cpp.

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

Member Function Documentation

TLxSym TOLx::AddRw ( const TStr Str)

Definition at line 741 of file lx.cpp.

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

Definition at line 271 of file lx.h.

                                  {
    RSOut.PutCh(SepCh); return SOut;}
TOLx& TOLx::operator= ( const TOLx ) [inline]

Definition at line 267 of file lx.h.

{Fail; return *this;}
void TOLx::PutBool ( const TBool Bool) [inline]

Definition at line 275 of file lx.h.

void TOLx::PutDosLn ( const int &  IndentLev = 0) [inline]

Definition at line 305 of file lx.h.

                                       {
    Assert(IsFrcEoln);
    PutSep(syEoln); RSOut.PutDosLn(); RSOut.PutCh(' ', IndentLev*2);}
void TOLx::PutFlt ( const TFlt Flt,
const int &  Width = -1,
const int &  Prec = -1 
) [inline]

Definition at line 280 of file lx.h.

                                                                       {
    if (!IsSigNum){Assert(Flt>=0);}
    PutSep(syFlt); RSOut.PutStr(TFlt::GetStr(Flt, Width, Prec));}
void TOLx::PutIdStr ( const TStr Str,
const bool &  CheckIdStr = true 
) [inline]

Definition at line 286 of file lx.h.

                                                             {
    if (CheckIdStr){Assert(ChDef->IsNmStr(Str));}
    PutSep(syIdStr); RSOut.PutStr(Str);}
void TOLx::PutIndent ( const int &  IndentLev) [inline]

Definition at line 299 of file lx.h.

                                      {
    RSOut.PutCh(' ', IndentLev*2);}
void TOLx::PutInt ( const TInt Int) [inline]

Definition at line 277 of file lx.h.

                              {
    if (!IsSigNum){Assert(int(Int)>=0);}
    PutSep(syInt); RSOut.PutStr(TInt::GetStr(Int));}
void TOLx::PutLn ( const int &  IndentLev = 0) [inline]

Definition at line 302 of file lx.h.

                                    {
    Assert(IsFrcEoln);
    PutSep(syEoln); RSOut.PutLn(); RSOut.PutCh(' ', IndentLev*2);}
void TOLx::PutLnCmt ( const TStr Str,
const int &  IndentLev = 0 
) [inline]

Definition at line 295 of file lx.h.

                                                        {
    Assert(IsCmtAlw); PutStr(" // "); PutStr(Str); PutLn(IndentLev);}
void TOLx::PutParCmt ( const TStr Str) [inline]

Definition at line 297 of file lx.h.

                                 {
    Assert(IsCmtAlw); PutStr(" /* "); PutStr(Str); PutStr(" */ ");}
void TOLx::PutQStr ( const TStr Str) [inline]

Definition at line 289 of file lx.h.

                               {
    PutSep(syQStr); RSOut.PutCh('"'); RSOut.PutStr(Str); RSOut.PutCh('"');}
void TOLx::PutQStr ( const TChA ChA) [inline]

Definition at line 291 of file lx.h.

                               {
    PutSep(syQStr); RSOut.PutCh('"'); RSOut.PutStr(ChA); RSOut.PutCh('"');}
void TOLx::PutSep ( const TLxSym Sym) [private]

Definition at line 712 of file lx.cpp.

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

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

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

void TOLx::PutUQStr ( const TStr Str) [inline]

Definition at line 293 of file lx.h.

                                {
    PutSep(syIdStr); RSOut.PutStr(Str);}
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.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Member Data Documentation

PLxChDef TOLx::ChDef [private]

Definition at line 253 of file lx.h.

bool TOLx::IsCmtAlw [private]

Definition at line 256 of file lx.h.

bool TOLx::IsCsSens [private]

Definition at line 257 of file lx.h.

bool TOLx::IsFrcEoln [private]

Definition at line 256 of file lx.h.

bool TOLx::IsSigNum [private]

Definition at line 256 of file lx.h.

bool TOLx::IsTabSep [private]

Definition at line 257 of file lx.h.

bool TOLx::IsUniStr [private]

Definition at line 256 of file lx.h.

bool TOLx::IsVarIndent [private]

Definition at line 257 of file lx.h.

TLxSym TOLx::PrevSym [private]

Definition at line 261 of file lx.h.

TSOut& TOLx::RSOut [private]

Definition at line 255 of file lx.h.

Definition at line 259 of file lx.h.

Definition at line 260 of file lx.h.

PSOut TOLx::SOut [private]

Definition at line 254 of file lx.h.

int TOLx::VarIndentLev [private]

Definition at line 258 of file lx.h.


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