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 <pp.h>
Public Member Functions | |
TPpVal () | |
TPpVal (const TPpVal &PpVal) | |
TPpVal (const bool &b) | |
TPpVal (const TBool &b) | |
TPpVal (const int &_Int) | |
TPpVal (const TInt &_Int) | |
TPpVal (const double &_Flt) | |
TPpVal (const TFlt &_Flt) | |
TPpVal (const TStr &_Str) | |
TPpVal (const char *CStr) | |
TPpVal (const TVec< TPpVal > &_ValV) | |
TPpVal (TSIn &SIn) | |
void | Save (TSOut &SOut) |
TPpVal & | operator= (const TPpVal &PpVal) |
bool | operator== (const TPpVal &PpVal) const |
bool | operator< (const TPpVal &PpVal) const |
int | GetTag () const |
TBool | GetBool () const |
TInt | GetInt () const |
TFlt | GetFlt () const |
TStr | GetStr () const |
TVec< TPpVal > | GetValV () const |
TStr | GetValStr (const bool &DoAddTag=false) const |
void | SaveTxt (TOLx &Lx) const |
Static Public Member Functions | |
static TPpVal | LoadTxt (TILx &Lx) |
Private Attributes | |
TInt | Tag |
TBool | Bool |
TInt | Int |
TFlt | Flt |
TStr | Str |
TVec< TPpVal > | ValV |
TPpVal::TPpVal | ( | ) | [inline] |
TPpVal::TPpVal | ( | const TPpVal & | PpVal | ) | [inline] |
TPpVal::TPpVal | ( | const bool & | b | ) | [inline] |
TPpVal::TPpVal | ( | const TBool & | b | ) | [inline] |
TPpVal::TPpVal | ( | const int & | _Int | ) | [inline] |
TPpVal::TPpVal | ( | const TInt & | _Int | ) | [inline] |
TPpVal::TPpVal | ( | const double & | _Flt | ) | [inline] |
TPpVal::TPpVal | ( | const TFlt & | _Flt | ) | [inline] |
TPpVal::TPpVal | ( | const TStr & | _Str | ) | [inline] |
TPpVal::TPpVal | ( | const char * | CStr | ) | [inline] |
TPpVal::TPpVal | ( | const TVec< TPpVal > & | _ValV | ) | [inline] |
TPpVal::TPpVal | ( | TSIn & | SIn | ) | [inline] |
TBool TPpVal::GetBool | ( | ) | const [inline] |
TFlt TPpVal::GetFlt | ( | ) | const [inline] |
TInt TPpVal::GetInt | ( | ) | const [inline] |
TStr TPpVal::GetStr | ( | ) | const [inline] |
Definition at line 55 of file pp.h.
References IAssert, ptStr, Str, and Tag.
Referenced by GetValStr(), TPp::GetValStr(), and TPp::PutVal().
int TPpVal::GetTag | ( | ) | const [inline] |
Definition at line 51 of file pp.h.
References Tag.
Referenced by TPp::AddCcVal(), TPp::PutMnMxVal(), TPp::PutVal(), and TPp::SaveTxt().
{return (int)Tag;}
TStr TPpVal::GetValStr | ( | const bool & | DoAddTag = false | ) | const |
Definition at line 46 of file pp.cpp.
References Bool, Fail, Flt, GetStr(), Int, TVec< TVal >::Len(), ptBool, ptFlt, ptInt, ptStr, ptUndef, ptValV, Str, Tag, and ValV.
Referenced by TPp::GetChA().
{ TChA ChA; if (DoAddTag){ChA+='<'; ChA+=TPpTag::GetStr(Tag); ChA+='>';} switch (Tag){ case ptUndef: break; case ptBool: ChA+=TBool::GetStr(Bool); break; case ptInt: ChA+=TInt::GetStr(Int); break; case ptFlt: ChA+=TFlt::GetStr(Flt); break; case ptStr: ChA+='"'; ChA+=Str; ChA+='"'; break; case ptValV:{ ChA+='['; for (int ValN=0; ValN<ValV.Len(); ValN++){ if (ValN>0){ChA+=' ';} ChA+=ValV[ValN].GetValStr(DoAddTag); } ChA+=']'; break;} default: Fail; } return ChA; }
TVec<TPpVal> TPpVal::GetValV | ( | ) | const [inline] |
TPpVal TPpVal::LoadTxt | ( | TILx & | Lx | ) | [static] |
Definition at line 67 of file pp.cpp.
References TVec< TVal >::Add(), Fail, TILx::GetBool(), TILx::GetFlt(), TILx::GetInt(), TILx::GetQStr(), TILx::GetSym(), TILx::PeekSym(), ptBool, ptFlt, ptInt, ptStr, ptUndef, ptValV, syColon, syIdStr, syLBracket, syRBracket, Tag, TPpVal(), and ValV.
Referenced by TPp::LoadTxt().
{ TPpTagVal Tag=TPpTag::LoadTxt(Lx); if (Tag==ptUndef){ return TPpVal(); } else { Lx.GetSym(syColon); switch (Tag){ case ptBool: return TPpVal(Lx.GetBool()); case ptInt: return TPpVal(Lx.GetInt()); case ptFlt: return TPpVal(Lx.GetFlt()); case ptStr: return TPpVal(Lx.GetQStr()); case ptValV:{ TPpValV ValV; Lx.GetSym(syLBracket); while (Lx.PeekSym()==syIdStr){ValV.Add(LoadTxt(Lx));} Lx.GetSym(syRBracket); return TPpVal(ValV);} default: Fail; return TPpVal(); } } }
bool TPpVal::operator< | ( | const TPpVal & | PpVal | ) | const [inline] |
bool TPpVal::operator== | ( | const TPpVal & | PpVal | ) | const |
Definition at line 31 of file pp.cpp.
References Bool, Fail, Flt, Int, ptBool, ptFlt, ptInt, ptSel, ptSet, ptStr, ptUndef, ptValV, Str, Tag, and ValV.
{ if (Tag!=PpVal.Tag){return false;} switch (Tag){ case ptUndef: return true; case ptBool: return Bool==PpVal.Bool; case ptInt: return Int==PpVal.Int; case ptFlt: return Flt==PpVal.Flt; case ptStr: return Str==PpVal.Str; case ptValV: return ValV==PpVal.ValV; case ptSel: case ptSet: default: Fail; return false; } }
void TPpVal::Save | ( | TSOut & | SOut | ) | [inline] |
Definition at line 38 of file pp.h.
References Bool, Flt, Int, TVec< TVal >::Save(), TStr::Save(), TBool::Save(), TInt::Save(), TFlt::Save(), Str, Tag, and ValV.
Referenced by TPp::Save().
{ Tag.Save(SOut); Bool.Save(SOut); Int.Save(SOut); Flt.Save(SOut); Str.Save(SOut); ValV.Save(SOut);}
void TPpVal::SaveTxt | ( | TOLx & | Lx | ) | const |
Definition at line 89 of file pp.cpp.
References Bool, Fail, Flt, TPpTag::GetStr(), Int, TVec< TVal >::Len(), ptBool, ptFlt, ptInt, ptStr, ptUndef, ptValV, TOLx::PutBool(), TOLx::PutFlt(), TOLx::PutIdStr(), TOLx::PutInt(), TOLx::PutQStr(), TOLx::PutSym(), Str, syColon, syLBracket, syRBracket, Tag, and ValV.
Referenced by TPp::SaveTxt().
{ Lx.PutIdStr(TPpTag::GetStr(Tag)); if (int(Tag)!=ptUndef){ Lx.PutSym(syColon); switch (Tag){ case ptBool: Lx.PutBool(Bool); break; case ptInt: Lx.PutInt(Int); break; case ptFlt: Lx.PutFlt(Flt); break; case ptStr: Lx.PutQStr(Str); break; case ptValV:{ Lx.PutSym(syLBracket); for (int ValN=0; ValN<ValV.Len(); ValN++){ValV[ValN].SaveTxt(Lx);} Lx.PutSym(syRBracket); break;} default: Fail; } } }
TBool TPpVal::Bool [private] |
Definition at line 22 of file pp.h.
Referenced by GetBool(), GetValStr(), operator=(), operator==(), Save(), and SaveTxt().
TFlt TPpVal::Flt [private] |
Definition at line 22 of file pp.h.
Referenced by GetFlt(), GetValStr(), operator<(), operator=(), operator==(), Save(), and SaveTxt().
TInt TPpVal::Int [private] |
Definition at line 22 of file pp.h.
Referenced by GetInt(), GetValStr(), operator<(), operator=(), operator==(), Save(), and SaveTxt().
TStr TPpVal::Str [private] |
Definition at line 22 of file pp.h.
Referenced by GetStr(), GetValStr(), operator=(), operator==(), Save(), and SaveTxt().
TInt TPpVal::Tag [private] |
Definition at line 21 of file pp.h.
Referenced by GetBool(), GetFlt(), GetInt(), GetStr(), GetTag(), GetValStr(), GetValV(), LoadTxt(), operator<(), operator=(), operator==(), Save(), and SaveTxt().
TVec<TPpVal> TPpVal::ValV [private] |
Definition at line 22 of file pp.h.
Referenced by GetValStr(), GetValV(), LoadTxt(), operator=(), operator==(), Save(), and SaveTxt().