SNAP Library 4.0, Developer Reference
2017-07-27 13:18:06
SNAP, a general purpose, high performance system for analysis and manipulation of large networks
|
#include <json.h>
Public Member Functions | |
TJsonVal () | |
TJsonVal (TSIn &SIn) | |
void | Save (TSOut &SOut) const |
TStr | SaveStr () |
bool | operator== (const TJsonVal &JsonVal) const |
bool | operator!= (const TJsonVal &JsonVal) const |
void | PutNull () |
void | PutBool (const bool &BoolVal) |
void | PutNum (const double &NumVal) |
void | PutStr (const TStr &StrVal) |
void | PutArr () |
void | AddToArr (const PJsonVal &Val) |
void | PutObj () |
void | AddToObj (const TStr &KeyNm, const PJsonVal &Val) |
void | AddToObj (const TStr &KeyNm, const int &Val) |
void | AddToObj (const TStr &KeyNm, const double &Val) |
void | AddToObj (const TStr &KeyNm, const TStr &Val) |
void | AddToObj (const TStr &KeyNm, const char *Val) |
void | AddToObj (const TStr &KeyNm, const bool &Val) |
void | AddToObj (const TStr &KeyNm, const TJsonValV &ValV) |
void | AddToObj (const PJsonVal &Val) |
TJsonValType | GetJsonValType () const |
bool | IsDef () const |
bool | IsNull () const |
bool | IsBool () const |
bool | IsNum () const |
bool | IsStr () const |
bool | IsArr () const |
bool | IsObj () const |
bool | GetBool () const |
double | GetNum () const |
TStr | GetStr () const |
int | GetArrVals () const |
PJsonVal | GetArrVal (const int &ValN) const |
int | GetObjKeys () const |
void | GetObjKeyVal (const int &KeyValN, TStr &Key, PJsonVal &Val) const |
bool | IsObjKey (const TStr &Key) const |
bool | IsObjKey (const char *Key) const |
PJsonVal | GetObjKey (const TStr &Key) const |
PJsonVal | GetObjKey (const char *Key) const |
bool | GetObjBool (const TStr &Key) const |
bool | GetObjBool (const char *Key) const |
double | GetObjNum (const TStr &Key) const |
double | GetObjNum (const char *Key) const |
TStr | GetObjStr (const TStr &Key) const |
TStr | GetObjStr (const char *Key) const |
bool | GetObjBool (const TStr &Key, const bool &DefBool) const |
bool | GetObjBool (const char *Key, const bool &DefBool) const |
double | GetObjNum (const TStr &Key, const double &DefNum) const |
double | GetObjNum (const char *Key, const double &DefNum) const |
TStr | GetObjStr (const TStr &Key, const TStr &DefStr) const |
TStr | GetObjStr (const char *Key, const TStr &DefStr) const |
Static Public Member Functions | |
static PJsonVal | New () |
static PJsonVal | Load (TSIn &SIn) |
static PJsonVal | NewNull () |
static PJsonVal | NewBool (const bool &Bool) |
static PJsonVal | NewNum (const double &Num) |
static PJsonVal | NewStr (const TStr &Str) |
static PJsonVal | NewArr () |
static PJsonVal | NewArr (const TJsonValV &ValV) |
static PJsonVal | NewArr (const TIntV &IntV) |
static PJsonVal | NewArr (const TFltV &FltV) |
static PJsonVal | NewArr (const TStrV &StrV) |
static PJsonVal | NewArr (const TFltPr &FltPr) |
static PJsonVal | NewObj () |
static PJsonVal | NewObj (const TStr &KeyNm, const PJsonVal &ObjVal) |
static PJsonVal | NewObj (const TStr &KeyNm, const int &ObjVal) |
static PJsonVal | NewObj (const TStr &KeyNm, const double &ObjVal) |
static PJsonVal | NewObj (const TStr &KeyNm, const TStr &ObjVal) |
static PJsonVal | NewObj (const TStr &KeyNm, const bool &ObjVal) |
static PJsonVal | GetValFromLx (TILx &Lx) |
static PJsonVal | GetValFromSIn (const PSIn &SIn) |
static PJsonVal | GetValFromStr (const TStr &JsonStr) |
static void | AddEscapeChAFromStr (const TStr &Str, TChA &ChA) |
static TStr | AddEscapeStrFromStr (const TStr &Str) |
static void | AddQChAFromStr (const TStr &Str, TChA &ChA) |
static void | GetChAFromVal (const PJsonVal &Val, TChA &ChA) |
static TStr | GetStrFromVal (const PJsonVal &Val) |
Private Member Functions | |
UndefCopyAssign (TJsonVal) | |
Private Attributes | |
TCRef | CRef |
TJsonValType | JsonValType |
TBool | Bool |
TFlt | Num |
TStr | Str |
TJsonValV | ValV |
THash< TStr, PJsonVal > | KeyValH |
Friends | |
class | TPt< TJsonVal > |
Definition at line 188 of file json.cpp.
References TChA::AddCh(), TUnicode::DecodeUtf8(), TStr::Fmt(), TUnicodeDef::GetDef(), TUnicodeDef::IsDef(), TStr::Len(), and TVec< TVal, TSizeTy >::Len().
Referenced by AddQChAFromStr().
Definition at line 113 of file json.h.
Definition at line 242 of file json.cpp.
References AddEscapeChAFromStr().
Referenced by GetChAFromVal().
|
inline |
Definition at line 39 of file json.h.
References EAssert, and jvtObj.
Referenced by AddToObj().
|
inline |
Definition at line 41 of file json.h.
References AddToObj().
Referenced by AddToObj().
|
inline |
Definition at line 42 of file json.h.
References AddToObj().
Referenced by AddToObj().
Definition at line 43 of file json.h.
References AddToObj().
Referenced by AddToObj().
|
inline |
Definition at line 44 of file json.h.
References AddToObj().
Referenced by AddToObj().
|
inline |
Definition at line 45 of file json.h.
References AddToObj().
Referenced by AddToObj().
Definition at line 46 of file json.h.
References AddToObj().
Referenced by AddToObj().
void TJsonVal::AddToObj | ( | const PJsonVal & | Val | ) |
Definition at line 31 of file json.cpp.
References AddToObj(), and EAssert.
|
inline |
Definition at line 248 of file json.cpp.
References AddQChAFromStr(), TStr::Fmt(), jvtArr, jvtBool, jvtNull, jvtNum, jvtObj, jvtStr, and TExcept::Throw().
Referenced by GetStrFromVal().
|
inline |
|
inline |
bool TJsonVal::GetObjBool | ( | const TStr & | Key, |
const bool & | DefBool | ||
) | const |
bool TJsonVal::GetObjBool | ( | const char * | Key, |
const bool & | DefBool | ||
) | const |
PJsonVal TJsonVal::GetObjKey | ( | const char * | Key | ) | const |
|
inline |
double TJsonVal::GetObjNum | ( | const TStr & | Key, |
const double & | DefNum | ||
) | const |
double TJsonVal::GetObjNum | ( | const char * | Key, |
const double & | DefNum | ||
) | const |
Definition at line 99 of file json.h.
References TStr::GetStr().
|
inline |
Definition at line 100 of file json.h.
References TStr::GetStr().
|
inline |
Definition at line 281 of file json.cpp.
References GetChAFromVal().
Referenced by SaveStr().
Definition at line 120 of file json.cpp.
References TILx::Flt, forever, TILx::GetSym(), New(), TILx::Str, syColon, syComma, syFlt, syIdStr, syLBrace, syLBracket, TILx::Sym, syQStr, syRBrace, syRBracket, and TExcept::Throw().
Referenced by GetValFromSIn().
Definition at line 166 of file json.cpp.
References TILx::GetSym(), GetValFromLx(), iloCmtAlw, iloCsSens, iloExcept, iloSigNum, New(), syLBrace, and syLBracket.
Referenced by GetValFromStr().
Definition at line 183 of file json.cpp.
References GetValFromSIn(), and TStrIn::New().
|
inline |
Definition at line 80 of file json.h.
References jvtObj.
Referenced by GetObjBool(), GetObjKey(), GetObjNum(), and GetObjStr().
|
inline |
Definition at line 91 of file json.h.
References EAssert.
Referenced by GetObjBool(), GetObjKey(), GetObjNum(), and GetObjStr().
|
inline |
|
inlinestatic |
Definition at line 20 of file json.h.
Referenced by GetValFromLx(), GetValFromSIn(), NewArr(), NewBool(), NewNull(), NewNum(), NewObj(), and NewStr().
|
inlinestatic |
Definition at line 39 of file json.cpp.
References TVec< TVal, TSizeTy >::Len(), and NewArr().
Definition at line 47 of file json.cpp.
References TVec< TVal, TSizeTy >::Len(), NewArr(), and NewNum().
Definition at line 55 of file json.cpp.
References TVec< TVal, TSizeTy >::Len(), NewArr(), and NewNum().
Definition at line 63 of file json.cpp.
References TVec< TVal, TSizeTy >::Len(), NewArr(), and NewStr().
Definition at line 71 of file json.cpp.
References NewArr(), NewNum(), TPair< TVal1, TVal2 >::Val1, and TPair< TVal1, TVal2 >::Val2.
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
bool TJsonVal::operator!= | ( | const TJsonVal & | JsonVal | ) | const |
bool TJsonVal::operator== | ( | const TJsonVal & | JsonVal | ) | const |
|
inline |
|
inline |
|
inline |
void TJsonVal::Save | ( | TSOut & | SOut | ) | const |
Definition at line 7 of file json.cpp.
References Bool, JsonValType, KeyValH, Num, TStr::Save(), TVec< TVal, TSizeTy >::Save(), TBool::Save(), TInt::Save(), TFlt::Save(), Str, and ValV.
TStr TJsonVal::SaveStr | ( | ) |
Definition at line 14 of file json.cpp.
References GetStrFromVal().
|
private |
|
private |
Definition at line 12 of file json.h.
Referenced by operator==(), and Save().
|
private |
Definition at line 11 of file json.h.
Referenced by operator==(), and Save().
Definition at line 16 of file json.h.
Referenced by GetObjBool(), GetObjKey(), GetObjNum(), GetObjStr(), operator==(), and Save().
|
private |
Definition at line 13 of file json.h.
Referenced by operator==(), and Save().
|
private |
Definition at line 14 of file json.h.
Referenced by operator==(), and Save().
|
private |
Definition at line 15 of file json.h.
Referenced by operator==(), and Save().